Understanding OSPF

Open Shortest Path First is using Djikstra’s shortest path first algorithm. It is a link-state routing protocol, another link-state routing protocol is Intermediate System to Intermediate System also known as IS-IS.

General facts about OSPF

1. Uses its own transport protocol number 89. Protocol number 89 indicates that this packet is destined for OSPF.

2. IPv4 Multicast address 224.0.0.5 for all SPF routers, 224.0.0.6 for DR routers only. IPv6 Multicast address FF02::5 for all SPF routers, FF02::6 for DR routers only. Multicast uses a TTL=1.

3. Will never form adjacency with secondary address.

4. Supports equal cost load balancing.

5. If there are more than one area within the OSPF network, all areas must be aggregated at area 0. It is not manadatory to start with area 0 if the OSPF network only has one area.

Facts about OSPF HELLO packet

1. It is used for router discovery.

2. It is also used for neighbourship keepalive.

3. It elects Designated Router (DR) and Backup Designated Router (BDR) in Non-broadcast multi-access (NBMA) and broadcast network.

4. It is used for bi-directional communication between two OSPF neighbours when the neighbour router saw its own router-id in the hello packet.

5. It contains parameters which routers must agree before neighbourship is formed.

6. Hello interval is 10 seconds for broadcast network, and 30 seconds for non-broadcast network.

7. Dead interval is 4 times the hello interval.

HELLO contents

1. Router id of the originating router.

2. Subnet mask of the originating router.

3. Area id of the originating router.

4. Authentication type of the originating router.

5. Hello interval and dead interval of the originating router.

6. Router priority.

7. Router id of the originating router’s neighbour.

8. DR and BDR.

9. Five flag bits signifying optionally abilities.

Condition to form OSPF adjacency

The following must match in order for two routers to form OSPF adjacency.

1. Address mask. (Except for point to point link)

2. Area ID.

3. Hello and dead interval.

4. Authentication.

5. MTU.

6. Options.

OSPF unlike EIGRP does not have the backup path. All OSPF routers have the overview of the entire network, however each OSPF router’s perception of shortest path is different hence routing table of each OSPF router is different.

Demonstration

The lab demonstration is based on Jeremy Cioara’s network topology – Basic OSPF configuration CBT nuggets Route 642-902.


r1#sh run | s router

router ospf 1
 router-id 1.1.1.1
 log-adjacency-changes
 passive-interface default
 no passive-interface FastEthernet0/0
 no passive-interface Loopback1
 network 1.1.1.1 0.0.0.0 area 0
 network 172.30.0.1 0.0.0.0 area 0
r1#
r1#

Passive interface command ensures the OSPF LSA and hello will not be sent to interface that does not connect any OSPF router.


r2#sh run | s router
router ospf 1
 log-adjacency-changes
 passive-interface default
 no passive-interface FastEthernet0/0
 no passive-interface Serial0/0
 no passive-interface Loopback2
 network 2.2.2.2 0.0.0.0 area 0
 network 172.30.0.2 0.0.0.0 area 0
 network 172.30.10.2 0.0.0.0 area 10
r2#

r3#sh run | s router
router ospf 1
 log-adjacency-changes
 passive-interface default
 no passive-interface FastEthernet0/0
 no passive-interface Serial0/0
 no passive-interface Loopback3
 network 3.3.3.3 0.0.0.0 area 0
 network 172.30.0.3 0.0.0.0 area 0
 network 172.30.20.3 0.0.0.0 area 20
r3#

r4#sh run | s router
router ospf 1
 router-id 4.4.4.4
 log-adjacency-changes
 passive-interface default
 no passive-interface Serial0/0
 no passive-interface Loopback4
 network 4.4.4.4 0.0.0.0 area 20
 network 172.30.20.4 0.0.0.0 area 20
r4#

r5#sh run | s router
router ospf 1
 log-adjacency-changes
 passive-interface default
 no passive-interface Serial0/0
 no passive-interface Loopback5
 network 5.5.5.5 0.0.0.0 area 10
 network 172.30.10.5 0.0.0.0 area 10
r5#

MTU mismatch between two routers

My buddy was dubious about the need to match MTU for OSPF routers to form convergence, hence this demonstration is to verify that MTU mismatch will cause routers to lost adjacency.


r5#clear ip ospf process
Reset ALL OSPF processes? [no]: yes
r5#
*Sep 21 00:09:16.145: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on Serial0/0 from FULL to DOWN, Neighbor Down: Interface down or detached
r5#sh ip int s0/0
Serial0/0 is up, line protocol is up
 Internet address is 172.30.10.5/24
 Broadcast address is 255.255.255.255
 Address determined by setup command
 MTU is 1000 bytes

The MTU was originally 1500bytes, I changed MTU of interface serial 0/0 of R5 to 1000 bytes.


r5#sh ip ospf neighbor

Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 0 INIT/ - 00:00:37 172.30.10.2 Serial0/0

r5#sh ip ospf neighbor

Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 0 INIT/ - 00:00:37 172.30.10.2 Serial0/0

The EXSTART actually stucked for very long.


Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 0 DOWN/ - - 172.30.10.2 Serial0/0
r5#
*Sep 21 00:14:26.189: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on Serial0/0 from EXSTART to DOWN, Neighbor Down: Too many retransmissions
r5#

The adjacency just would not be formed. However if I change the MTU size of s0/0 of R5 back to 1500 bytes which matches R2 the OSPF adjacency will definitely form.


r5(config)#int s0/0
r5(config-if)#mtu 1500
r5(config-if)#end
*Sep 21 00:16:11.217: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on Serial0/0 from LOADING to FULL, Loading Done
*Sep 21 00:16:12.119: %SYS-5-CONFIG_I: Configured from console by console
r5#

Just how fast the adjacency was formed between R2 and R5 once I changed the MTU size of interface s0/0.


r5#sh ip ospf neighbor

Neighbor ID Pri State Dead Time Address Interface
2.2.2.2 0 FULL/ - 00:00:30 172.30.10.2 Serial0/0
r5#

 

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s