Juniper Lab Scenarios

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 21

Static Routing Practical

Step-by-Step Procedure

The following example requires you to navigate


various levels in the configuration hierarchy. For
information about navigating the CLI, see Using
the CLI Editor in Configuration Mode in the CLI
User Guide.

To configure basic static routes:

1. On Device B, configure the interfaces.

[edit interfaces]

user@B# set ge-1/2/0 unit 0 description


B->D

user@B# set ge-1/2/0 unit 0 family inet address 172.16.1.1/24

user@B# set lo0 unit 57 family inet address 10.0.0.1/32

user@B# set lo0 unit 57 family inet address 10.0.0.2/32

2. On Device B, create a static route and set the next-hop address.

[edit routing-options]

user@B# set static route 192.168.47.0/24 next-hop 172.16.1.2

3. If you are done configuring Device B, commit the configuration.


[edit interfaces]

user@B# commit

4. On Device D, configure the interfaces.

[edit interfaces]

user@D# set ge-1/2/0 unit 1 description D->B

user@D# set ge-1/2/0 unit 1 family inet address 172.16.1.2/24

user@D# set lo0 unit 2 family inet address 192.168.47.5/32

user@D# set lo0 unit 2 family inet address 192.168.47.6/32

5. On Device D, create a static route and set the next-hop address.

[edit routing-options]

user@D# set static route 0.0.0.0/0 next-hop 172.16.1.1

6. If you are done configuring Device D, commit the configuration.

[edit]

user@D# commit

Results

Confirm your configuration by issuing the show interfaces and show routing-options commands.
If the output does not display the intended configuration, repeat the instructions in this example
to correct the configuration.

Device B

user@B# show interfaces


ge-1/2/0 {
unit 0 {
description B->D;
family inet {
address 172.16.1.1/24;
}
}
}
lo0 {
unit 57 {
family inet {
address 10.0.0.1/32;
address 10.0.0.2/32;
}
}
}
user@B# show routing-options
static {
route 192.168.47.0/24 next-hop 172.16.1.2;
}

Device D

user@D# show interfaces


ge-1/2/0 {
unit 1 {
description D->B;
family inet {
address 172.16.1.2/24;
}
}
}
lo0 {
unit 2 {
family inet {
address 192.168.47.5/32;
address 192.168.47.6/32;
}
}
}
user@D# show routing-options
static {
route 0.0.0.0/0 next-hop 172.16.1.1;
}

Verification

Confirm that the configuration is working properly.

 Checking the Routing Tables


 Pinging the Remote Addresses

Checking the Routing Tables

Purpose
Make sure that the static routes appear in the routing tables of Device B and Device D.

Action

user@B> show route


inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

10.0.0.1/32 *[Direct/0] 00:29:43


> via lo0.57
10.0.0.2/32 *[Direct/0] 00:29:43
> via lo0.57
172.16.1.0/24 *[Direct/0] 00:34:40
> via ge-1/2/0.0
172.16.1.1/32 *[Local/0] 00:34:40
Local via ge-1/2/0.0
192.168.47.0/24 *[Static/5] 00:31:23
> to 172.16.1.2 via ge-1/2/0.0
user@D> show route
inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

0.0.0.0/0 *[Static/5] 00:31:24


> to 172.16.1.1 via ge-1/2/0.1
172.16.1.0/24 *[Direct/0] 00:35:21
> via ge-1/2/0.1
172.16.1.2/32 *[Local/0] 00:35:21
Local via ge-1/2/0.1
192.168.47.5/32 *[Direct/0] 00:35:22
> via lo0.2
192.168.47.6/32 *[Direct/0] 00:35:21
> via lo0.2

Meaning

The static routes are in the routing tables.

Pinging the Remote Addresses

Purpose

Verify that the static routes are working.

From Device B, ping one of the loopback interface addresses on Device D.

From Device D, ping one of the loopback interface addresses on Device B.

Action

user@B> ping 192.168.47.5


PING 192.168.47.5 (192.168.47.5): 56 data bytes
64 bytes from 192.168.47.5: icmp_seq=0 ttl=64 time=156.126 ms
64 bytes from 192.168.47.5: icmp_seq=1 ttl=64 time=120.393 ms
64 bytes from 192.168.47.5: icmp_seq=2 ttl=64 time=175.361 ms
user@D> ping 10.0.0.1
PING 10.0.0.1 (10.0.0.1): 56 data bytes
64 bytes from 10.0.0.1: icmp_seq=0 ttl=64 time=1.315 ms
64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=31.819 ms
64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=1.268 ms

JunOs2 configuration:

login: root
root@% Cli

root > configure

[edit]

root # set interfaces em0 unit 0 family inet address 172.16.1.1/24

You can also configure some loopback with these commands:

root # set interfaces lo0 unit 55 family inet address 111.0.0.1/32

root # commit

Having issue with commit command visit missing mandatory statement'root-authentication'

JunOs3 configuration:

Cli

configure

set interfaces em0 unit 0 family inet address 172.16.1.2/24

set interfaces em1 unit 0 family inet address 192.168.1.1/24

commit

JunOs4 configuration:

Cli

configure

set interfaces em0 unit 0 family inet address 192.168.1.2/24


You can also configure some loopback with these commands:

set interfaces lo0 unit 55 family inet address 222.0.0.1/32

commit

Configure static routing on Juniper routers:


For configuration of static routing you need next hope addresses:

Static routing on JunOs2 


On junos2 111.0.0.1/32 and 172.16.1.0/24 are directly connected networks whereas 192.168.1.1/24 and
222.0.0.1/32 are remote or destination networks and inaccessible from junos2 . You need to
configure static routes for making these routes accessible on junos2. Nex-hop address is 172.16.1.2 for
all these routes.          

Cli
configure

set routing-options static route 192.168.1.0/24 next-hop 172.16.1.2

set routing-options static route 222.0.0.0/32 next-hop 172.16.1.2

Static routing on JunOs3


111.0.0.1/32 and 222.0.0.1/32 are inaccessible networks on junos3 and need static routes. Nex-hop
addresses are 172.16.1.1 for 111.0.0.1/32 and 192.168.1.2 for 222.0.0.1/32.

Cli

configure

set routing-options static route 222.0.0.0/32 next-hop 172.16.1.1

set routing-options static route 111.0.0.0/32 next-hop 192.168.1.2


Static routing on JunOs4
Nex-hop address for all routes on junos4 is 192.168.1.1.          

Cli

configure

set routing-options static route 172.16.1.0/24 next-hop 192.168.1.1

set routing-options static route 111.0.0.0/32 next-hop 192.168.1.1

Testing:
You can verify your configurations with following results:

Ping from junos2 to 222.0.0.1 should be successful.


How to enter into Command-line interface mode:
After logging into JunOS by your user name and password, you can enter into Command-line interface
by typing CLI

root@% cli

root>

How to access configuration mode on Juniper:


You can enter into configuration mode by typing configure in configuration mode.

root> configure

[edit]

root#

How to check current configurations on Juniper:


In cli mode:

root> show configurations

Show configurations with include specific group of commands:


This command will show all the command from configuration starting with "Set"

root> show configurations | display set

How to check all interfaces on Juniper:


You can show all the interface on Juniper with following command:

root# show interfaces

How to see status of specific interface on Juniper:


root# show interfaces <interface name>

Command example:
root# show interfaces em0

How to set the IPv4 address of juniper router:


In Configuration mode you can use the following command:

set interfaces  <interface-name> unit <unit number> family inet <IP address>/mask

Suppose you want to set IP address 22.2.2.2 to interface ge-0/0/2 you can do it like this:

set interfaces ge-0/0/2 unit 0 family inet 22.2.2.2/24

How to set host name on Juniper Router:


root# set system host-name <type-name>

How to set root's password on JunOS:


In configuration mode type the following command for setting password for juniper router.

set system root-authentication plain-text-password

How to save your current configuration on Juniper:


You can use the Commit command for saving configuration on Juniper, if you having any issue in save
configuration you see error in saving configuration onjuniper for troubleshooting.

root# commit

How to see the all routes on JunOS:


root> show route

How to setup gateway or static route for Juniper:


Following command will set a static route for network 222.0.0.0/32.

root# set routing-options static route 222.0.0.0/32 next-hop 172.16.1.1


Configure different routing protocols with Juniper:
You can use the set protocols command in configuration mode for configuring different routing
protocols on JunOS, some of commands examples are as listed below. But you can see more details
regarding each routing protocols with given links or explore more with google.

root # set protocols rip group rip-routes neighbor em0           RIP on JunOS

root # set protocols ospf area 0.0.0.0 interface em0               OSPF on JunOS

root # set protocols isis interface em0

Lab Tasks:

We have three JunOS routers in our topology, our task is to configure all the routers in same
OSPF area 0.
Few commands are required for the configuration of OSPF on juniper but  if you want to explore
how to configure IP addresses to JunOS interfaces you can visit IP & static routing on JunOS.
Configuration of OSPF on JunOS2:
login: root
root@% Cli
root > configure
[edit]
root # set interfaces em0 unit 0 family inet address 172.16.1.1/24
root # set protocols ospf area 0.0.0.0 interface em0
root #Commit
Having issue with commit command visit missing mandatory statement'root-authentication'
learn more about the configuration of junos in gns3 you can see how to configure junos on
gns3 and Juniper commands.
Configuration of OSPF on JunOS3:

login: root
root@% Cli
root > configure
[edit]
root # set interfaces em0 unit 0 family inet address 172.16.1.2/24
root # set interfaces em1 unit 0 family inet address 192.168.1.1/24
OSPF Configurations commands
root # set protocols ospf area 0.0.0.0 interface em0
root # set protocols ospf area 0.0.0.0 interface em1
root #Commit
Configuration of OSPF on JunOS4:

login: root
root@% Cli
root > configure
[edit]
root # set interfaces em0 unit 0 family inet address 192.168.1.2/24

root # set protocols ospf area 0.0.0.0 interface em0

How to test lab configuration:

You can ping 192.168.1.2 from JunOS2 and it will be successful in case of correct
configurations, also find the show route command output on JunOS2 which is showing some
OSPF routes in routing table.
If you want learn more about the configuration of junos in gns3 you can visit how to
configure junos on gns3 and Juniper commands.

Lab Requirements:
There are three Junos routers in given topology which are connected with each other and already
configured with correct IP addresses according to topology. If you want to explore how to
configure IP addresses to JunOS interfaces you can visit IP & static routing on JunOS. We have
the following task for this Gns3 Lab:

 Configure RIP routing protocol on all these routers

Explanation:
Configuration of RIP on junOS is very simple, you need only few commands and then good to
go..:).
By default JunOS don't advertise RIP routes & the routes received from neighbors, so we need to
define a routing policy for advertisement of RIP routes.

Configuration of RIP on JunOS2:  

You can start configuring JunOS2 in following way.

login: root
root@% Cli
root > configure
[edit]
root # set protocols rip group rip-routes neighbor em0 
where rip-routes is the group name, which you can set it of own choice and em0 is the connected
interface of Junos2.

root #set policy-options policy-statement advertise-RIProutes from protocol direct


root #set policy-options policy-statement advertise-RIProutes from protocol rip
root #set policy-options policy-statement advertise-RIProutes then accept

Where "advertise-RIProutes" is the name of policy. now you need to apply this policy with
following command.
root # set protocols rip group rip-routes export advertise-RIProutes
root # commit
Useful link: how to save current configuration in junos.

RIP Configuration  on JunOS3: 

root
Cli
configure
set protocols rip group rip-routes neighbor em0 
set protocols rip group rip-routes neighbor em1

Set policy-options policy-statement advertise-RIProutes from protocol direct


set policy-options policy-statement advertise-RIProutes from protocol rip
set policy-options policy-statement advertise-RIProutes then accept
set protocols rip group rip-routes export advertise-RIProutes
 commit

RIP Configuration  on JunOS4: 

root
Cli
configure
set protocols rip group rip-routes neighbor em0

Set policy-options policy-statement advertise-RIProutes from protocol direct


set policy-options policy-statement advertise-RIProutes from protocol rip
set policy-options policy-statement advertise-RIProutes then accept
set protocols rip group rip-routes export advertise-RIProutes
 commit
How to verify configuration:

You can test your configuration by ping from junos2 to 222.0.0.1 which is a loopback address on
junos4. Also "show route" will show all routes on all routers. An output of show route command
will have the following routes:
Junos static route configuration:
In this article i will show you how to configure static routing with junier router on gns3. For configuring
static routing you need to define the route as static and with a next-hop address with it. 
Please note this lab is performed only for study and practice purposes using Junos
olive , which is unsupported and unsupportable platform & it is not suitable for any type of
commercial use.
Lab Requirements
You have three juniper routers connected with each other, you have the following tasks to perform:

 Configure all the interfaces with right IP address (According to figure)


 Configure static routes between all routers so that they can communicate with each other.

Other Detail:
Junos image version= JunOS Olive image 12.1 
Gns3 version= Gns3 1.1 (you can use any version)
VM VirtualBox version=  4.2.4 (you can use any version)

you can visit how to configure junos on gns3 and Basic JunOS commands.


Set IP addresses of all interfaces of juniper router:
For setting ip address of interface you need the following commands.
JunOs2 configuration:

login: root

root@% Cli

root > configure

[edit]

root # set interfaces em0 unit 0 family inet address 172.16.1.1/24

You can also configure some loopback with these commands:

root # set interfaces lo0 unit 55 family inet address 111.0.0.1/32

root # commit

Having issue with commit command visit missing mandatory statement'root-authentication'

JunOs3 configuration:

Cli

configure

set interfaces em0 unit 0 family inet address 172.16.1.2/24

set interfaces em1 unit 0 family inet address 192.168.1.1/24

commit

JunOs4 configuration:

Cli
configure

set interfaces em0 unit 0 family inet address 192.168.1.2/24

You can also configure some loopback with these commands:

set interfaces lo0 unit 55 family inet address 222.0.0.1/32

commit

Configure static routing on Juniper routers:


For configuration of static routing you need next hope addresses:

Static routing on JunOs2 


On junos2 111.0.0.1/32 and 172.16.1.0/24 are directly connected networks whereas 192.168.1.1/24 and
222.0.0.1/32 are remote or destination networks and inaccessible from junos2 . You need to
configure static routes for making these routes accessible on junos2. Nex-hop address is 172.16.1.2 for
all these routes.          

Cli
configure

set routing-options static route 192.168.1.0/24 next-hop 172.16.1.2

set routing-options static route 222.0.0.0/32 next-hop 172.16.1.2

Static routing on JunOs3


111.0.0.1/32 and 222.0.0.1/32 are inaccessible networks on junos3 and need static routes. Nex-hop
addresses are 172.16.1.1 for 111.0.0.1/32 and 192.168.1.2 for 222.0.0.1/32.

Cli
configure

set routing-options static route 222.0.0.0/32 next-hop 172.16.1.1

set routing-options static route 111.0.0.0/32 next-hop 192.168.1.2

Static routing on JunOs4


Nex-hop address for all routes on junos4 is 192.168.1.1.          

Cli

configure

set routing-options static route 172.16.1.0/24 next-hop 192.168.1.1

set routing-options static route 111.0.0.0/32 next-hop 192.168.1.1

Testing:
You can verify your configurations with following results:

Ping from junos2 to 222.0.0.1 should be successful.

Show route brief on JunOS 4 will have following output 

You might also like