|
Many networks need just a default route to reach an uplink router, that has connection to the outside world. No other routing information is needed. Static default routes are not flexible and stay in the routing table, even if the uplink router has no means of forwarding a paket any more.
The dynamic generation of default routes is possible in OSPF. OSPF uses the command "default-information originate" for this. This works fine, as long as the router finds a default route in its routing table. This can be a route to interface NULL. If you do not have an default route available the command "default-information originate always" generates a default route anyway.
This tutorials is about "always". Lets take a lab of 4 routers with basic OSPF configuration:
The basic OSPF configuration includes OSPF on the serial links. No redistribution is done. The loopback interfaces are not announced into OSPF.
In the first step only router R1 will generate a default route, in step 2 router R2 will also generate a default route for the network. All routers are in area 0.
In the beginning no default route is in the routing table. We look at R3:
R3#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 not set
172.17.0.0/32 is subnetted, 1 subnets
C 172.17.0.3 is directly connected, Loopback0
192.168.100.0/30 is subnetted, 4 subnets
O 192.168.100.12 [110/128] via 192.168.100.10, 00:04:23, Serial1/2
C 192.168.100.8 is directly connected, Serial1/2
C 192.168.100.4 is directly connected, Serial1/1
O 192.168.100.0 [110/128] via 192.168.100.5, 00:04:23, Serial1/1
R3#
Go to R1 and enter:
R1#conf t
R1(config)#router ospf 100
R1(config-router)#default-information originate always
R1(config-router)#end
R1#
R2 has got a default route from R1. This will be important to remember when we start to announce a default route from R2 as well.
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 192.168.100.1 to network 0.0.0.0
172.17.0.0/32 is subnetted, 1 subnets
C 172.17.0.2 is directly connected, Loopback0
192.168.100.0/30 is subnetted, 4 subnets
O 192.168.100.12 [110/128] via 192.168.100.1, 00:00:00, Serial1/0
O 192.168.100.8 [110/128] via 192.168.100.6, 00:00:00, Serial1/1
C 192.168.100.4 is directly connected, Serial1/1
C 192.168.100.0 is directly connected, Serial1/0
O*E2 0.0.0.0/0 [110/1] via 192.168.100.1, 00:00:00, Serial1/0
R2#
The router R3 installed 2 default routes, because it gets two equal announcements from R2 and R4.
R3#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 192.168.100.5 to network 0.0.0.0
172.17.0.0/32 is subnetted, 1 subnets
C 172.17.0.3 is directly connected, Loopback0
192.168.100.0/30 is subnetted, 4 subnets
O 192.168.100.12 [110/128] via 192.168.100.10, 00:00:38, Serial1/2
C 192.168.100.8 is directly connected, Serial1/2
C 192.168.100.4 is directly connected, Serial1/1
O 192.168.100.0 [110/128] via 192.168.100.5, 00:00:38, Serial1/1
O*E2 0.0.0.0/0 [110/1] via 192.168.100.5, 00:00:38, Serial1/1
[110/1] via 192.168.100.10, 00:00:38, Serial1/2
R3#
Now R2 is to generate a default route as well as router R1. Again we use the parameter "always" to get a default route under any condition.
R2#conf t
R2(config)#router ospf 100
R2(config-router)#default-information originate always
R2(config-router)#end
R2#
Now we get some interesting effects. Lets look at R3 first. One default route is gone, because now R2 is reachable with lower OSPF cost than R1.
R3#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 192.168.100.5 to network 0.0.0.0
172.17.0.0/32 is subnetted, 1 subnets
C 172.17.0.3 is directly connected, Loopback0
192.168.100.0/30 is subnetted, 4 subnets
O 192.168.100.12 [110/128] via 192.168.100.10, 00:00:01, Serial1/2
C 192.168.100.8 is directly connected, Serial1/2
C 192.168.100.4 is directly connected, Serial1/1
O 192.168.100.0 [110/128] via 192.168.100.5, 00:00:01, Serial1/1
O*E2 0.0.0.0/0 [110/1] via 192.168.100.5, 00:00:01, Serial1/1
R3#
The OSPF database on R3 still shows two "Type-5 AS External Link States", but just the one from R2 makes it into the routing table.
R3#sh ip os database
OSPF Router with ID (172.17.0.3) (Process ID 100)
Router Link States (Area 0)
Link ID ADV Router Age Seq# Checksum Link count
172.17.0.1 172.17.0.1 270 0x80000007 0x007939 4
172.17.0.2 172.17.0.2 275 0x80000007 0x00348E 4
172.17.0.3 172.17.0.3 279 0x80000005 0x003082 4
172.17.0.4 172.17.0.4 309 0x80000007 0x00029E 4
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
0.0.0.0 172.17.0.1 270 0x80000003 0x0093FA 100
0.0.0.0 172.17.0.2 362 0x80000001 0x0091FD 100
R3#
And now for routing table of R2. After announcing a default route, R2 looses it's own default route.This could be a potentially dangerous situation, as R3 sends packets to R2, but R2 is not able to forward the pakets any more. R2 will drop the pakets and send an "icmp unreachable" to R3.
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 not set
172.17.0.0/32 is subnetted, 1 subnets
C 172.17.0.2 is directly connected, Loopback0
192.168.100.0/30 is subnetted, 4 subnets
O 192.168.100.12 [110/128] via 192.168.100.1, 00:00:05, Serial1/0
O 192.168.100.8 [110/128] via 192.168.100.6, 00:00:05, Serial1/1
C 192.168.100.4 is directly connected, Serial1/1
C 192.168.100.0 is directly connected, Serial1/0
R2#
|