Reliable Default Route – OSPF

By | October 6, 2013

In this post we will configure and test a reliable default route using OSPF.

First we need to look at the network digram.

R1, R2 and R3 are all in the same OSPF area. R3 and R4 are peering via BGP. All devices have a loopback interface x.0.0.0/8 where X is the routers number. As an example R3 loopback is 3.3.3.3/8.

We will be setting ip our Reliable default route on R3. To begain with we need to setup the basic OSPF and BGP.

router ospf 1
 auto-cost reference-bandwidth 1000
 network 3.3.3.3 0.0.0.0 area 0
 network 10.0.0.0 0.255.255.255 area 0

The network statement 10.0.0.0 cover all the interface uses on R3. The auto cost command is used as we are using links more the 100Mbps.

router bgp 200
 redistribute connected
 redistribute ospf 1
 neighbor 10.1.43.4 remote-as 100
 no auto-summary

For this example we are redistributing connected and OSPF routes in to BGP. Now we need to verfiy we have the correct neighbours for OSPF and BGP.

R3#show ip ospf neighbor

Neighbor ID     Pri   State     Dead Time   Address    Interface
2.2.2.2           1   FULL/DR   00:00:34    10.1.23.2  FastEthernet1/0
1.1.1.1           1   FULL/DR   00:00:37    10.1.13.1  GigabitEthernet0/0

 

R3#show ip bgp summary
BGP router identifier 3.3.3.3, local AS number 200
BGP table version is 44, main routing table version 44
8 network entries using 968 bytes of memory
9 path entries using 468 bytes of memory
5/4 BGP path/bestpath attribute entries using 380 bytes of memory
1 BGP AS-PATH entries using 24 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 1840 total bytes of memory
BGP activity 15/7 prefixes, 36/27 paths, scan interval 60 secs

Neighbor   V    AS MsgRcvd MsgSent TblVer  InQ OutQ Up/Down  State/PfxRcd
10.1.43.4  4   100       5       6       43    0    0 00:00:02  2

We can see that all the peers are up. Now we need to set up IP SLA and a Track object.

ip sla 1
 icmp-echo 4.4.4.4 source-ip 10.1.43.3
 timeout 1000
 frequency 3
ip sla schedule 1 life forever start-time now
!
track 1 rtr 1 reachability

We now set up IP SLA to ping the loopback of R4 which we have learnt via our BGP session and use the source ip address of the interface we use to connect to R4. This then run’s every 3 seconds and is linked to a track object.

R3#show ip sla statistics

Round Trip Time (RTT) for       Index 1
        Latest RTT: 28 ms
Latest operation start time: *19:18:37.514 UTC Mon Oct 7 2013
Latest operation return code: OK
Number of successes: 14
Number of failures: 0
Operation time to live: Forever

R3#
R3#show track 1
Track 1
  Response Time Reporter 1 reachability
  Reachability is Up
    1 changes, last change 00:00:10
  Latest operation return code: OK
  Latest RTT (millisecs) 28
  Tracked by:
    STATIC-IP-ROUTING 0

We can now see the track object is up and running. we now create a static route to null0 and assign the track object to it.

ip route 169.255.1.1 255.255.255.255 Null0 track 1

This can be any route as this is used to deside if we advertise a default or not. Now we need to create a Access-list and route map for this.

access-list 1 permit 169.255.1.1
!
route-map OSPF_DEF permit 10
 match ip address 1

Now we are ready to send a default route to our OSPF peers.

router ospf 1
default-information originate route-map OSPF_DEF

Now lets see if the other routers have the default route.

R2#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       + - replicated route, % - next hop override

Gateway of last resort is 10.1.23.3 to network 0.0.0.0

O*E2  0.0.0.0/0 [110/1] via 10.1.23.3, 00:00:57, FastEthernet1/0
      1.0.0.0/32 is subnetted, 1 subnets
O        1.1.1.1 [110/2] via 10.1.12.1, 07:26:18, GigabitEthernet0/0
      2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        2.0.0.0/8 is directly connected, Loopback1
L        2.2.2.2/32 is directly connected, Loopback1
      3.0.0.0/32 is subnetted, 1 subnets
O        3.3.3.3 [110/2] via 10.1.23.3, 07:07:21, FastEthernet1/0

we can now see we have a default route. Now we will shutdown the interface to R4 and re-test.

interface fa1/1
shutdown
R3#sh track 1
Track 1
  Response Time Reporter 1 reachability
  Reachability is Down
    2 changes, last change 00:00:01
  Latest operation return code: Timeout
  Tracked by:
    STATIC-IP-ROUTING 0

now we check the router on R2 again.

R2#show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       + - replicated route, % - next hop override

Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
O        1.1.1.1 [110/2] via 10.1.12.1, 07:28:34, GigabitEthernet0/0
      2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        2.0.0.0/8 is directly connected, Loopback1
L        2.2.2.2/32 is directly connected, Loopback1
      3.0.0.0/32 is subnetted, 1 subnets
O        3.3.3.3 [110/2] via 10.1.23.3, 07:09:37, FastEthernet1/0

We can now see we don’t have a default route. We have successfully set-up and tested a Reliable Default Route with OSPF.