Monday 22 February 2010

Configure OSPF Routing

In this post I will configure the network below to use OSPF routing.



OSPF uses areas to define it's structure, i'll be configuring a single area in this post so I will use area 0. OSPF runs under a process on each router, this does not have to be the same but i'll keep thing simple and use process 10 on each router.

Currently all routers can only see directly connected routers. Here is the routing table on R0.


R0

R0#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

195.211.64.0/30 is subnetted, 1 subnets
C 195.211.64.0 is directly connected, Serial1/1
C 192.168.1.0/24 is directly connected, Serial1/0
S* 0.0.0.0/0 is directly connected, Serial1/1


I enable OSPF and configure it to advertise the 192.168.1.0 network.


R0#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R0(config)#router ospf 10
R0(config-router)#network 192.168.1.1 0.0.0.0 area 0
R0(config-router)#end


By specifying the interface with a wilcard of 0.0.0.0 I am telling OSPF to only advertise out of that single interface.

I configure OSPF on R1, R2 and R3 for the networks they are connected to. After configuration I check routing tables.

R0

R0#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

192.168.4.0/32 is subnetted, 1 subnets
O 192.168.4.1 [110/85] via 192.168.1.2, 00:00:56, Serial1/0
195.211.64.0/30 is subnetted, 1 subnets
C 195.211.64.0 is directly connected, Serial1/1
C 192.168.1.0/24 is directly connected, Serial1/0
O 192.168.2.0/24 [110/74] via 192.168.1.2, 00:00:56, Serial1/0
O 192.168.3.0/24 [110/84] via 192.168.1.2, 00:00:56, Serial1/0
S* 0.0.0.0/0 is directly connected, Serial1/1


So on each router I have advertised each interface into the OSPF area. Now I would like to advertise the default route and check it on R3.


R0

I first configure a static route pointing towards the interface I want traffic to go and then I advertise that into OSPF.

R0(config)#ip route 0.0.0.0 0.0.0.0 serial 1/1
R0(config)#router ospf 10
R0(config-router)#default-information originate
R0(config-router)#end


Now I check the routing tables across the routers finishing with R3.


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 192.168.3.1 to network 0.0.0.0

C 192.168.4.0/24 is directly connected, Loopback0
O 192.168.1.0/24 [110/84] via 192.168.3.1, 00:05:49, Ethernet0/0
O 192.168.2.0/24 [110/20] via 192.168.3.1, 00:05:49, Ethernet0/0
C 192.168.3.0/24 is directly connected, Ethernet0/0
O*E2 0.0.0.0/0 [110/1] via 192.168.3.1, 00:05:49, Ethernet0/0


Below are some show commands which are useful when troubleshooting OSPF.


R3#sh ip ospf
Routing Process "ospf 10" with ID 192.168.4.1
Start time: 00:38:51.280, Time elapsed: 00:33:41.280
Supports only single TOS(TOS0) routes
Supports opaque LSA
Supports Link-local Signaling (LLS)
Supports area transit capability
Router is not originating router-LSAs with maximum metric
Initial SPF schedule delay 5000 msecs
Minimum hold time between two consecutive SPFs 10000 msecs
Maximum wait time between two consecutive SPFs 10000 msecs
Incremental-SPF disabled
Minimum LSA interval 5 secs
Minimum LSA arrival 1000 msecs
LSA group pacing timer 240 secs
Interface flood pacing timer 33 msecs
Retransmission pacing timer 66 msecs
Number of external LSA 1. Checksum Sum 0x008F40
Number of opaque AS LSA 0. Checksum Sum 0x000000
Number of DCbitless external and opaque AS LSA 0
Number of DoNotAge external and opaque AS LSA 0
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Number of areas transit capable is 0
External flood list length 0
Area BACKBONE(0)
Number of interfaces in this area is 2 (1 loopback)
Area has no authentication
SPF algorithm last executed 00:09:44.096 ago
SPF algorithm executed 3 times
Area ranges are
Number of LSA 6. Checksum Sum 0x03A79E
Number of opaque link LSA 0. Checksum Sum 0x000000
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0



R3#sh ip ospf interface
Ethernet0/0 is up, line protocol is up
Internet Address 192.168.3.2/24, Area 0
Process ID 10, Router ID 192.168.4.1, Network Type BROADCAST, Cost: 10
Transmit Delay is 1 sec, State BDR, Priority 1
Designated Router (ID) 192.168.3.1, Interface address 192.168.3.1
Backup Designated router (ID) 192.168.4.1, Interface address 192.168.3.2
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:09
Supports Link-local Signaling (LLS)
Index 2/2, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 1, Adjacent neighbor count is 1
Adjacent with neighbor 192.168.3.1 (Designated Router)
Suppress hello for 0 neighbor(s)
Loopback0 is up, line protocol is up
Internet Address 192.168.4.1/24, Area 0
Process ID 10, Router ID 192.168.4.1, Network Type LOOPBACK, Cost: 1
Loopback interface is treated as a stub Host