Monday, August 13, 2012

OSPF Stub and Total Stub Area


Router 1 has a view of all networks , without redistribution the others won't learn all networks

R1#show 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
     1.0.0.0/32 is subnetted, 1 subnets
C       1.1.1.1 is directly connected, Loopback0
     2.0.0.0/32 is subnetted, 1 subnets
O IA    2.2.2.2 [110/65] via 172.12.123.2, 00:31:01, Serial0/0
     3.0.0.0/32 is subnetted, 1 subnets
O IA    3.3.3.3 [110/65] via 172.12.123.3, 00:31:01, Serial0/0
R    5.0.0.0/8 [120/1] via 15.0.0.5, 00:00:27, FastEthernet0/0
R    6.0.0.0/8 [120/1] via 15.0.0.5, 00:00:27, FastEthernet0/0
     172.12.0.0/24 is subnetted, 1 subnets
C       172.12.123.0 is directly connected, Serial0/0
     172.34.0.0/24 is subnetted, 1 subnets
O IA    172.34.34.0 [110/65] via 172.12.123.3, 00:31:01, Serial0/0
R    7.0.0.0/8 [120/1] via 15.0.0.5, 00:00:27, FastEthernet0/0
C    15.0.0.0/8 is directly connected, FastEthernet0/0




R5#show 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

C    5.0.0.0/8 is directly connected, Loopback0
C    6.0.0.0/8 is directly connected, Loopback1
C    7.0.0.0/8 is directly connected, Loopback2
C    15.0.0.0/8 is directly connected, FastEthernet0/0




R5#show 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

C    5.0.0.0/8 is directly connected, Loopback0
C    6.0.0.0/8 is directly connected, Loopback1
C    7.0.0.0/8 is directly connected, Loopback2
C    15.0.0.0/8 is directly connected, FastEthernet0/0

Redistributing OSPF routes into RIP is fairly easy, only a seed metric is needed because RIP has a max hop count of 16. Connected routes will need to be redistributed as well because connectivity won't be possible for all routes.  

R1(config)#router rip
R1(config-router)#redistribute ospf 1 metric 2
R1(config-router)#redistribute connected metric 2

I now have one way redistribute. I can see the OSPF routes on R5 coming in as RIP. Below I tried to ping one of the newly added routes but I was unsuccessful because the OSPF networks do not know how to reach the RIP routes.

R5#show ip route rip 
     1.0.0.0/32 is subnetted, 1 subnets
R       1.1.1.1 [120/1] via 15.0.0.1, 00:00:23, FastEthernet0/0
     2.0.0.0/32 is subnetted, 1 subnets
R       2.2.2.2 [120/2] via 15.0.0.1, 00:00:23, FastEthernet0/0
     3.0.0.0/32 is subnetted, 1 subnets
R       3.3.3.3 [120/2] via 15.0.0.1, 00:00:23, FastEthernet0/0
     172.12.0.0/24 is subnetted, 1 subnets
R       172.12.123.0 [120/1] via 15.0.0.1, 00:00:23, FastEthernet0/0
     172.34.0.0/24 is subnetted, 1 subnets
R       172.34.34.0 [120/2] via 15.0.0.1, 00:00:23, FastEthernet0/0

Failed ping without two-way redistribution 

R5#ping 172.34.34.4

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.34.34.4, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

Here I redistributed RIP into OSPF with the subnet commands. This is important because we want the subnets to be in the routes and not just the classful boundaries. 

R1(config)#router ospf 1
R1(config-router)#redistribute rip subnets 
R1(config-router)#redistribute connected subnets


I can see here that R4 now can see the RIP routes in it's routing table. The code OE2 are the rip routes, it stands for OSPF learned external type 2 route. The default is type 2 (metric from last router), type 1 is another type (metric from destination router)

R4#show ip route ospf 
     1.0.0.0/32 is subnetted, 1 subnets
O IA    1.1.1.1 [110/66] via 172.34.34.3, 00:43:39, FastEthernet0/0
     2.0.0.0/32 is subnetted, 1 subnets
O IA    2.2.2.2 [110/66] via 172.34.34.3, 00:43:39, FastEthernet0/0
     3.0.0.0/32 is subnetted, 1 subnets
O IA    3.3.3.3 [110/2] via 172.34.34.3, 00:43:40, FastEthernet0/0
O E2 5.0.0.0/8 [110/20] via 172.34.34.3, 00:00:58, FastEthernet0/0
O E2 6.0.0.0/8 [110/20] via 172.34.34.3, 00:00:58, FastEthernet0/0
     172.12.0.0/24 is subnetted, 1 subnets
O IA    172.12.123.0 [110/65] via 172.34.34.3, 00:43:40, FastEthernet0/0
O E2 7.0.0.0/8 [110/20] via 172.34.34.3, 00:00:58, FastEthernet0/0
O E2 15.0.0.0/8 [110/20] via 172.34.34.3, 00:00:58, FastEthernet0/0

Now the pings are successful across the network.

R5#ping 172.34.34.4

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.34.34.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/14/40 ms


Creating a stub in OSPF is needed when I want to reduce the size of the routing table. Looking up R4 routing table I can see that the exit interface for all routes ifs fastethernet 0/0. Unlike RIP and EIGRP, OSPF stub in configured per area not interface.

R3(config)#router ospf 1
R3(config-router)#area 34 stub 

R4(config)#router ospf 1
R4(config-router)#area 34 stub

Inter-area routes are still here but the external routes have been stubbed

R4#show ip route ospf 
     1.0.0.0/32 is subnetted, 1 subnets
O IA    1.1.1.1 [110/66] via 172.34.34.3, 03:18:10, FastEthernet0/0
     2.0.0.0/32 is subnetted, 1 subnets
O IA    2.2.2.2 [110/66] via 172.34.34.3, 03:18:10, FastEthernet0/0
     3.0.0.0/32 is subnetted, 1 subnets
O IA    3.3.3.3 [110/2] via 172.34.34.3, 03:18:10, FastEthernet0/0
     172.12.0.0/24 is subnetted, 1 subnets
O IA    172.12.123.0 [110/65] via 172.34.34.3, 03:18:10, FastEthernet0/0
O*IA 0.0.0.0/0 [110/2] via 172.34.34.3, 03:18:10, FastEthernet0/0

A total stub area will summarized inter-area routes as well

R3(config)#router ospf 1
R3(config-router)# area 34 stub  no-summary


Now I have a Total Stub Area with only one OSPF route

R4#show ip route ospf 
O*IA 0.0.0.0/0 [110/2] via 172.34.34.3, 00:01:14, FastEthernet0/0