Static Route Configuration on Juniper Routers

Juniper Static Configuration

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.

Juniper Static Route GNS3 Configuration Example
 

Juniper Static Route Configuration
Example Topology

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
[edit]
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
[edit]
root@JUNOS2# set interfeces em0 unit 0 family inet address 10.0.0.2/24
[edit]
root@JUNOS2# set interfeces em1 unit 0 family inet address 172.29.2.2/24
[edit]
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
[edit]
root@JUNOS3# set interfeces em0 unit 0 family inet address 172.29.2.1/24
[edit]
root@JUNOS3# set interfeces em1 unit 0 family inet address 192.168.0.2/24
[edit]
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.

[edit]
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.

[edit]
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:

Juniper Static Route GNS3 Configuration Example
 

Juniper Static Route GNS3 Configuration Example
 

Juniper Static Route GNS3 Configuration Example

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.
Juniper Static Route GNS3 Configuration Example
 

Juniper Static Route GNS3 Configuration Example
 

Juniper Static Route GNS3 Configuration Example

To check the reachability from JUNOS1 Router to JUNOS3 Router, let’s ping the JUNOS3 Router’s em0 interface.
Juniper Static Route GNS3 Configuration Example

As you can see, the ping is successful. To see the way to JUNOS3 Router, we can use traceroute command too.
Juniper Static Route GNS3 Configuration Example

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:

Static Route Configuration on Juniper Routers
Static Route Configuration on Cisco Routers
Static Routing Configuration on Alcatel-Lucent Routers

 

7 Responses to “Static Route Configuration on Juniper Routers”


  • krishan shakya / Reply

    Good One dear….please share more on juniper


    • gokhankosem / Reply

      Thank you Krishan…More on Juniper will come with next articles, keep on;)


  • Khan / Reply

    please share how to upgrade junos IOS


  • Syareefdol / Reply

    Salam gokhan..whats difference between unit 1 n unit 0?thks


    • gokhankosem / Reply

      Hi Syareefdol, it is the logical interface name taht you can give numver 0 through 16384. For example there is an interface, ge-0/0/1.0 . Here the “0” after “.” is unit number;)


  • mumtaz / Reply

    u didnt upload more, ? plz upload more


  • kausik maitra / Reply

    Sir,
    We have two set routing-options static route but i want to change default next hop i don know what is previous preference, how to change it please help me


Leave a Reply