Static Route Configuration
on Juniper Routers
In this article we will focus on static route configuration on Juniper routers. Here, we will use Juniper JuNOS and we will be familiar with some JuNOS commands.
The basic topology that we will use is below. We have three routers and two network. We will provide the route from one network to another.
First of all we will give IP addresses to the interfaces. On JUNOS1 Router use the below commands to assign an ip to the interface em0.
root@JUNOS1> configure  root@JUNOS1# edit interfeces em0 [edit interfaces em0] root@JUNOS1# edit unit 0 [edit interfaces em0 unit 0] root@JUNOS1# edit family inet [edit interfaces em0 unit 0 family inet] root@JUNOS1# set address 10.0.0.1/24 [edit interfaces em0 unit 0 family inet] root@JUNOS1# commit
On JUNOS2 Router you can use the full command in only one line like below. But here we have two interfaces, so we will give to ip addresses that are in different network.
root@JUNOS2> configure  root@JUNOS2# set interfeces em0 unit 0 family inet address 10.0.0.2/24  root@JUNOS2# set interfeces em1 unit 0 family inet address 172.29.2.2/24  root@JUNOS2# commit
For the last router, JUNOS3 Router use the below commands. Here we can also give ip address to the second interface but there is no device is connected to that interface.
root@JUNOS3> configure  root@JUNOS3# set interfeces em0 unit 0 family inet address 172.29.2.1/24  root@JUNOS3# set interfeces em1 unit 0 family inet address 192.168.0.2/24  root@JUNOS3# commit
Now it is time to set the static routes on both JUNOS1 Router and JUNOS3 Router. To set a static route we will go to the “routing-options” hierarchy on JUNOS.
 root@JUNOS1# edit routing-options [edit routing-options] root@JUNOS1# set static route 172.29.2.0/24 next-hop 10.0.0.2 [edit routing-options] root@ JUNOS1# commit
Here, we are saying that to the JUNOS1 router, use 10.0.0.2 interface to reach to the 172.29.2.0 network. Like this we will say to the JUNOS3 Router, use 172.29.2.2 to reach the 10.0.0.0 network.
 root@JUNOS3# edit routing-options [edit routing-options] root@JUNOS3# set static route 10.0.0.0/24 next-hop 172.29.2.2 [edit routing-options] root@ JUNOS3# commit
To check our configuration we can use “show configuration” command alone or with “display set”. If we use it alone we will see the whole configuration with hierarchy. But if we use it with “display set“ option, then we will see the whole configuration line by line with set command. The screenshots for the routers’ configuration are below:
On the routing tables, we can see the static entry routes beside the directly connected interfaces. As you can see, the directly connected interfaces have preference value of 0. But the static ones have the value of 5. In Cisco IOS, we use “administrative distance” instead of “preference” value in JuNOS.
To check the reachability from JUNOS1 Router to JUNOS3 Router, let’s ping the JUNOS3 Router’s em0 interface.
As you can see, the ping is successful. To see the way to JUNOS3 Router, we can use traceroute command too.
With this command we can realize that to reach 172.29.2.1 interface, JUNOS1 Router goes to 10.0.0.2 interface first.And after that interface it reach the destination. This command is not important for such a basic topology.But in a huge topology, with many routers and hops, you can realize the importance of this command.
You can download the GNS3 example here.
You can download “GNS3” in Tools section.
To be continued with different Juniper JuNOS configurations. Keep on ipcisco.com!!!
You can reach the Static Route Configurations on Other Vendor Routers below: