Using a default route will save router’s resources because there is no need to run SPF algorithm each time when external network changes occur. In this lab we will examine how to propagate a default route in an OSPF standard area. Any router in OSPF domain can be configured to generate a default route, and then the router becomes an ASBR.To configure a router to generate a default route use the following command:
default-information originate [always] [metric metric-value] [metric-type type-value] [route-map map-name]
Keywords in brackets are optional:
- always – advertise always a default route
- metric – metric of generated default route (by default is 1)
- metric-type – it can be E1 (metric will change through network) or E2 (which is default, remains constant)
- route-map – check against a route-map
- When advertising router has a default route – then you don’t need to use
- When advertising router doesn’t have a default route – then you need to use
alwayskeyword, and a default route will be generated anyway.
Please take a look at the scenario below. In this lab we’ll configure R1 to advertise a default route in OSPF domain, where internet connection will be simulated by R1’s loopback interface. R1 and R2 routers will be neighbors in Area 0.
R1(config)#interface fastEthernet 0/0 R1(config-if)#ip address 192.168.0.1 255.255.255.0 R1(config-if)#no shutdown R1(config)#router ospf 1 R1(config-router)#network 192.168.0.0 0.0.0.255 area 0
R2(config)#interface fastEthernet 0/0 R2(config-if)#ip address 192.168.0.2 255.255.255.0 R2(config-if)#no shutdown R2(config)#router ospf 1 R2(config-router)#network 192.168.0.0 0.0.0.255 area 0
Now on R1 add under OSPF configuration mode:
R1(config-router)#default-information originate always
You’ve probably noticed that I used
always keyword, because R1 doesn’t have a default route. Further let’s see routing table on R2
R2#show ip route ... output ommited ... Gateway of last resort is 192.168.0.1 to network 0.0.0.0 C 192.168.0.0/24 is directly connected, FastEthernet0/0 O*E2 0.0.0.0/0 [110/1] via 192.168.0.1, 00:05:16, FastEthernet0/0 R2#
Good! Default route was generated, metric-type is 2 as default (
O*E2), and metric value is 1 as default (
In OSPF database you can see default route as type 5 LSA
Type-5 AS External Link States Link ID ADV Router Age Seq# Checksum Tag 0.0.0.0 10.0.0.1 770 0x80000001 0x00DACC 1This output is on R2 where
10.0.0.1is R1’s Router ID (taken from loopback interface) And the last step will be to send a ping from R2 to R1’s loopback interface.
R2#ping 10.0.0.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.0.0.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 16/21/28 ms R2#