OSPF Default Route on Juniper

Juniper, OSPF, Topology, rjlogs, GNS3, Junos

Continue the previous post “Configure OSPF on Juniper” , now we will configure the default route.

The scenario is IP loopback interface of J1 (1.1.1.1/32) will not advertised through OSPF, but J2 and J3 will reach it through the default route that injected into OSPF.

First of all, remove the loopback interface of J1 from OSPF :

[edit]
root@J1# edit protocols ospf area 0

[edit protocols ospf area 0.0.0.0]
root@J1# delete interface lo0.0

Now, let’s check before commit :

[edit protocols ospf area 0.0.0.0]
root@J1# show | compare
[edit protocols ospf area 0.0.0.0]
–   interface lo0.0 {
–        passive;
–   }

As shown above, this will remove interface lo0.0 from OSPF after commit.

[edit protocols ospf area 0.0.0.0]
root@J1# commit

Now, let’s check from J2 :

root@J2> show route table inet.0

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

2.2.2.2/32                    *[Direct/0] 00:14:35
> via lo0.0
3.3.3.3/32                    *[OSPF/10] 00:08:47, metric 1
> to 172.29.1.4 via ge-0/0/1.0
172.28.1.0/24              *[Direct/0] 00:14:14
> via ge-0/0/0.0
172.28.1.4/32              *[Local/0] 00:14:23
Local via ge-0/0/0.0
172.29.1.0/24              *[Direct/0] 00:14:14
> via ge-0/0/1.0
172.29.1.3/32              *[Local/0] 00:14:23
Local via ge-0/0/1.0
224.0.0.5/32                 *[OSPF/10] 00:14:40, metric 1
MultiRecv

Well, 1.1.1.1/32 has gone from the routing table of J2.

OK, now we can configure J1 to advertise a default route.
Create a null route for 0/0 on J1, tell the router to discard packets that match this statement and not to install the route in the forwarding table.

[edit]
root@J1# set routing-options static route 0.0.0.0/0 discard

[edit]
root@J1# set routing-options static route 0.0.0.0/0 no-install

OK, now we have a static 0/0 route and we need to configure the policy to allow this route to be advertised.

[edit]
root@J1# set policy-options policy-statement Default-Route from protocol static

[edit]
root@J1# set policy-options policy-statement Default-Route from route-filter 0.0.0.0/0 exact

[edit]
root@J1# set policy-options policy-statement Default-Route then accept

Now, we need to apply that policy to the OSPF :

[edit]
root@J1# set protocols ospf export Default-Route

[edit]
root@J1# commit

Now check on J2 and J3 :

root@J2> show route table inet.0

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

0.0.0.0/0                             *[OSPF/150] 00:01:41, metric 0, tag 0
                                              > to 172.28.1.3 via ge-0/0/0.0
2.2.2.2/32                           *[Direct/0] 01:53:45
> via lo0.0
3.3.3.3/32                           *[OSPF/10] 01:47:57, metric 1
> to 172.29.1.4 via ge-0/0/1.0
172.28.1.0/24                     *[Direct/0] 01:53:24
> via ge-0/0/0.0
172.28.1.4/32                     *[Local/0] 01:53:33
Local via ge-0/0/0.0
172.29.1.0/24                     *[Direct/0] 01:53:24
> via ge-0/0/1.0
172.29.1.3/32                     *[Local/0] 01:53:33
Local via ge-0/0/1.0
224.0.0.5/32                       *[OSPF/10] 01:53:50, metric 1
MultiRecv

root@J2> 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 = 9.158/13.157/16.960/2.752 ms

root@J3> show route table inet.0

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

0.0.0.0/0                               *[OSPF/150] 00:02:52, metric 0, tag 0
                                                 > to 172.29.1.3 via ge-0/0/0.0
2.2.2.2/32                             *[OSPF/10] 01:49:10, metric 1
> to 172.29.1.3 via ge-0/0/0.0
3.3.3.3/32                             *[Direct/0] 01:49:33
> via lo0.0
172.28.1.0/24                       *[OSPF/10] 01:49:10, metric 2
> to 172.29.1.3 via ge-0/0/0.0
172.29.1.0/24                       *[Direct/0] 01:49:16
> via ge-0/0/0.0
172.29.1.4/32                       *[Local/0] 01:49:18
Local via ge-0/0/0.0
224.0.0.5/32                         *[OSPF/10] 01:49:39, metric 1
MultiRecv

root@J3> 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 = 14.128/17.769/23.327/3.542 ms

Well, they have a default route now, and can reach 1.1.1.1/32 of J1.

 

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s