Home You are here: HomeArchiveArticalsLatest Articleshow to use default routes in OSPF
how to use default routes in OSPF PDF Print E-mail
Written by Timaz Mohsenzadeh   
Monday, 27 June 2011 02:25

In this article I want to show you how to use default routes in OSPF domain. The topology is as follows.

ospf default route

 

As you can get from the topology shown above, R1, R2, R3 and R4 are inside the OSPF domain. Router R3 has one exit point from OSPF domain but R4 has 2 exit points. In this article, I’m going to use “default-information originate” command to flood default route inside OSPF domain. Besides, R3 originates the default route with its default parameters and R4 does this as a E1 route.

At the first phase, we need to create static default route on each of border routers with “ip route” command. So let’s do it together.

 

R4(config)#ip route 0.0.0.0 0.0.0.0 fast0/0
R4(config)#ip route 0.0.0.0 0.0.0.0 se0/1 10


I want R4 to prefer the route toward Fa0/0 interface over se0/1; because this path has higher bandwidth than other one. So to have this works, we need to assign better administrative distance to the preferred default route.

At the second phase, we must configure the border routers to send their default routes to other routers inside the OSPF domain. To do this, we need to use “default-information originate” command under the OSPF sub-configuration mode.

 

R4(config-router)#default-info originate metric-type 1 metric 50
R3(config-router)#default-information originate metric 50


As rules say, the routers prefer E1 route over E2. In this scenario, R4 floods his default route as E1 and thus, routers reside inside OSPF domain, will prefer it over default route originated by R3 (that is E2 route). Let’s test it on R1 and R2.

 

R2#sh ip route

  Codes: 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

Gateway of last resort is 4.4.4.4 to network 0.0.0.0

        1.0.0.0/24 is subnetted, 1 subnets
C         1.1.1.0 is directly connected, FastEthernet0/0
        2.0.0.0/24 is subnetted, 1 subnets
C         2.2.2.0 is directly connected, FastEthernet0/1
        4.0.0.0/24 is subnetted, 1 subnets
C         4.4.4.0 is directly connected, Serial0/0
        11.0.0.0/32 is subnetted, 1 subnets
O         11.11.11.11 [110/11] via 1.1.1.1, 00:20:22, FastEthernet0/0
O*E1      0.0.0.0/0 [110/114] via 4.4.4.4, 00:19:08, Serial0/0

----------------------------------------------------------------------------------------------------------------------

R1#sh ip route

  Codes: 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

Gateway of last resort is 1.1.1.2 to network 0.0.0.0

        1.0.0.0/24 is subnetted, 1 subnets
C         1.1.1.0 is directly connected, FastEthernet0/0
        2.0.0.0/24 is subnetted, 1 subnets
O         2.2.2.0 [110/20] via 1.1.1.2, 00:47:19, FastEthernet0/0
        4.0.0.0/24 is subnetted, 1 subnets
O         4.4.4.0 [110/74] via 1.1.1.2, 00:19:56, FastEthernet0/0
        11.0.0.0/32 is subnetted, 1 subnets
C         11.11.11.11 is directly connected, Loopback0
O*E1      0.0.0.0/0 [110/124] via 1.1.1.2, 00:19:46, FastEthernet0/0


You see that the metric of E1 routes is cumulative and thus, as route takes its way hop-by-hop, its metric changes too. So when you compare the metric of default route on R2 (metric: 114)and R1 (metric: 124), you will notice this difference.

Maybe, some of you may have questions about 2 different default routes on R4. Because we have created 2 separate default routes on R4 which have different administrative distances, the R4 prefers the route with lower administrative distance and installs it (and only it) on the routing table.


R4(config)#do sh ip route
  Codes: 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

Gateway of last resort is 0.0.0.0 to network 0.0.0.0

        1.0.0.0/24 is subnetted, 1 subnets
O         1.1.1.0 [110/74] via 4.4.4.2, 00:28:22, Serial0/0
        2.0.0.0/24 is subnetted, 1 subnets
O         2.2.2.0 [110/74] via 4.4.4.2, 00:28:22, Serial0/0
        4.0.0.0/24 is subnetted, 1 subnets
C         4.4.4.0 is directly connected, Serial0/0
        5.0.0.0/24 is subnetted, 1 subnets
C         5.5.5.0 is directly connected, FastEthernet0/0
        6.0.0.0/24 is subnetted, 1 subnets
C         6.6.6.0 is directly connected, Serial0/1
        11.0.0.0/32 is subnetted, 1 subnets
O         11.11.11.11 [110/75] via 4.4.4.2, 00:28:23, Serial0/0
S*        0.0.0.0/0 is directly connected, FastEthernet0/0


But it does not mean the other default route does not exist anymore. We can test it with shutting down the fast0/0 interfaces on R4. After that, you can see another default route on the routing table that will install automatically.


R4(config)#inter fast0/0
R4(config-if)#shut
R4(config-if)#
*Mar 1 01:02:14.223: %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to administratively down
*Mar 1 01:02:15.223: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to down
R4(config-if)#
R4(config-if)#do sh ip route

  Codes: 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

Gateway of last resort is 0.0.0.0 to network 0.0.0.0

        1.0.0.0/24 is subnetted, 1 subnets
O         1.1.1.0 [110/74] via 4.4.4.2, 00:31:02, Serial0/0
        2.0.0.0/24 is subnetted, 1 subnets
O         2.2.2.0 [110/74] via 4.4.4.2, 00:31:02, Serial0/0
        4.0.0.0/24 is subnetted, 1 subnets
C         4.4.4.0 is directly connected, Serial0/0
        6.0.0.0/24 is subnetted, 1 subnets
C         6.6.6.0 is directly connected, Serial0/1
        11.0.0.0/32 is subnetted, 1 subnets
O         11.11.11.11 [110/75] via 4.4.4.2, 00:31:02, Serial0/0
S*        0.0.0.0/0 is directly connected, Serial0/1


Even if one of the exit paths from OSPF domain corrupted, the reachability will remain. You can test it by using extended ping on R1 with repeat count of 1000, for example, and disabling exit paths one by one.

Unlike, EIGRP, we cannot originate default route with redistributing it. In other words, you cannot create static default route and then redistribute it under OSPF sub-configuration mode with "redistribute" command. Using "default-information originate" is the only valid way of getting to the goal.


R1#ping 55.55.55.55
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 55.55.55.55, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5)

Last Updated on Friday, 10 February 2012 15:49
 

Add comment


Security code
Refresh

Who's Online

We have 1 guest online

Copyright © 2011 ciscoworlds. All Rights Reserved.