How to setup basic OSPF on JunOS

By | April 22, 2012

Just as in the Cisco post we first need to set up the network using the below diagram

Now we need to set the IP address on the interface.

root@% cli
root> configure
Entering configuration mode

[edit]
root# edit interfaces em0

[edit interfaces em0]
root# edit unit 0

[edit interfaces em0 unit 0]
root# set family inet address 172.16.10.2/24

[edit interfaces em0 unit 0]
root# top

[edit]
root# commit
commit complete

We use the commit command to apply and save the changes we have just made. We need to repete this on the other router. To make sure that we have sussefuly added the IP address to the interface we need to exit out of configuration mode and use the below command


Now we have our IP address we need to enable OSPF on our routers

[edit]
root# edit protocols ospf

[edit protocols ospf]
root# edit area 0

[edit protocols ospf area 0.0.0.0]
root# set interface em0.0

[edit protocols ospf area 0.0.0.0]
root# top

[edit]
root# commit.

To check OSPF is working we can use the below.

Now I have connected the Cisco routers to the Juniper routers and added the IP address 192.168.20.x to both R1 and JUNOS1 and put that as part of the OSPF process. This can been seen in the below diagram


Now to check if the juniper router have the routes to get to the Cisco routers

We can see that it now has routes to get to the Cisco routers. Now we will try a ping to 2.2.2.2 to ensure reachability.

and now we will do the same but ping 172.16.10.1 from the Cisco router

We can see all is working. All the config gets saved when we use commit on the juniper routers.