Configure OSPF on Juniper

Anggara
Network Warrior
Published in
2 min readNov 19, 2017

With this simple topology we will configure OSPF single area on Juniper routers.

Let’s start from J1, setup the IP Addresses :

[edit]
root@J1# set interfaces ge-0/0/0 unit 0 family inet address 172.28.1.3/24
[edit]
root@J1# set interfaces lo0 unit 0 family inet address 1.1.1.1/32
[edit]
root@J1# commit

Now configure J1 for OSPF :

[edit]
root@J1# set protocols ospf area 0 interface ge-0/0/0.0
[edit]
root@J1# set protocols ospf area 0 interface lo0.0 passive
[edit]
root@J1# commit

Now move to J2, setup the IP addresses :

[edit]
root@J2# set interfaces ge-0/0/0 unit 0 family inet address 172.28.1.4/24
[edit]
root@J2# set interfaces lo0 unit 0 family inet address 2.2.2.2/32
[edit]
root@J2# set interfaces ge-0/0/1 unit 0 family inet address 172.29.1.3/24
[edit]
root@J2# commit

Configure J2 for OSPF :

[edit]
root@J2# set protocols ospf area 0 interface ge-0/0/0.0
[edit]
root@J2# set protocols ospf area 0 interface ge-0/0/1.0
[edit]
root@J2# set protocols ospf area 0 interface lo0.0 passive
[edit]
root@J2# commit

And the last, move to J3 :

[edit]
root@J3# set interfaces ge-0/0/0 unit 0 family inet address 172.29.1.4/24
[edit]
root@J3# set interfaces lo0 unit 0 family inet address 3.3.3.3/32
[edit]
root@J3# commit

Configure J3 for OSPF :

[edit]
root@J3# set protocols ospf area 0 interface ge-0/0/0.0
[edit]
root@J3# set protocols ospf area 0 interface lo0.0 passive
[edit]
root@J3# commit

Ok, now we check OSPF neighbor from the middle (J2) :

[edit]
root@J2# run show ospf neighbor
Address Interface State ID Pri Dead
172.28.1.3 ge-0/0/0.0 Full 1.1.1.1 128 33
172.29.1.4 ge-0/0/1.0 Full 3.3.3.3 128 33

Good, J1 and J3 are OSPF neighbors.

Wanna check routing table and doing ping test?

[edit]
root@J2# run show route table inet.0
inet.0: 8 destinations, 8 routes (8 active, 0 holddown, 0 hidden) + = Active Route, - = Last Active, * = Both1.1.1.1/32 *[OSPF/10] 00:09:23, metric 1
> to 172.28.1.3 via ge-0/0/0.0
2.2.2.2/32 *[Direct/0] 05:47:43
> via lo0.0
3.3.3.3/32 *[OSPF/10] 00:03:59, metric 1
> to 172.29.1.4 via ge-0/0/1.0
172.28.1.0/24 *[Direct/0] 05:47:43
> via ge-0/0/0.0
172.28.1.4/32 *[Local/0] 05:47:43
Local via ge-0/0/0.0
172.29.1.0/24 *[Direct/0] 05:43:37
> via ge-0/0/1.0
172.29.1.3/32 *[Local/0] 05:43:37
Local via ge-0/0/1.0
224.0.0.5/32 *[OSPF/10] 00:09:34, metric 1
MultiRecv
[edit]
root@J2# run ping 1.1.1.1 rapid
PING 1.1.1.1 (1.1.1.1): 56 data bytes
!!!!!
--- 1.1.1.1 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max/stddev = 7.277/26.049/87.017/30.579 ms
[edit]
root@J2# run ping 3.3.3.3 rapid
PING 3.3.3.3 (3.3.3.3): 56 data bytes
!!!!!
--- 3.3.3.3 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max/stddev = 4.650/22.053/41.350/14.841 ms

We have full connectivity.

Find another story about OSPF ? Check this one OSPF Default Route on Cisco Router.

Please hit the ❤ button if you liked this post. You’ll help others find it. Thanks!

--

--

Anggara
Network Warrior

An ordinary person who has extraordinary life | a traveler | a seeker