Oct 11, 2015

OSPF - Definition





R1(config)#router os 1
R1(config-router)#router-id 1.1.1.1
R1(config-router)#network 192.168.1.1 0.0.0.0 area ?
  <0-4294967295>  OSPF area ID as a decimal value
  A.B.C.D         OSPF area ID in IP address format


a decimal value == Ax256^3 + Bx256^2 + Cx256^1 + D

For example
800 == 3x256 + 32 == 800



R1(config)#router os 1
R1(config-router)#router-id 1.1.1.1
R1(config-router)#network 1.1.1.1 0.0.0.0 a 0
R1(config-router)#net 192.168.1.1 0.0.0.0 a 0
R1(config-router)#do sh run | b r o
router ospf 1
 router-id 1.1.1.1
 log-adjacency-changes
 network 1.1.1.1 0.0.0.0 area 0
 network 192.168.1.1 0.0.0.0 area 0



R2(config-if)#router os 2
R2(config-router)#router-id 2.2.2.2
R2(config-router)#net 192.168.1.2 0.0.0.0 a 0
R2(config-router)#net 2.2.2.2 0.0.0.0 a 0
R2(config-router)#do sh ip os nei

Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1           1   FULL/DR         00:00:31    192.168.1.1     FastEthernet0/0
R2(config-router)#
*Mar  1 00:20:33.063: %OSPF-5-ADJCHG: Process 2, Nbr 1.1.1.1 on FastEthernet0/0 from LOADING to FULL, Loading Done



We found that the time to build neighbor between R4 and R5 is faster than R1 and R2
R5(config-router)#
*Mar  1 00:26:47.987: %OSPF-5-ADJCHG: Process 5, Nbr 4.4.4.4 on Serial1/0 from LOADING to FULL, Loading Done
R5(config-router)#
R5(config-router)#do sh ip os nei

Neighbor ID     Pri   State           Dead Time   Address         Interface
4.4.4.4           0   FULL/  -        00:00:32    45.1.1.4        Serial1/0

The reason is that between R4 and R5 does not need to select DR(Design Router).



Now let us some about Hello packet and DBD packet 







As you can see MTU in the DBD can be changed by manually. 
What about R4 and R5 have the different MTU.
Notice, this MTU is layer-3 MTU (ip MTU ), but layer-2 MTU (MTU


R5(config)#int s1/0
R5(config-if)#mt
R5(config-if)#mtu 1496 <--- layer-2="" mtu="" p="">
R5(config-if)#shut
R5(config-if)#no shut

R4(config-router)#int s1/0
R4(config-if)#mtu
R4(config-if)#mtu 1500 <--- div="" layer-3="" mtu="">
R4(config-if)#shut
R4(config-if)#no shut


R5(config-if)#
*Mar  1 01:02:09.479: %OSPF-5-ADJCHG: Process 5, Nbr 4.4.4.4 on Serial1/0 from INIT to DOWN, Neighbor Down: Interface down or detached
R5(config-if)#do sh ip os nei

Neighbor ID     Pri   State           Dead Time   Address         Interface
4.4.4.4           0   EXSTART/  -     00:00:35    45.1.1.4        Serial1/0


R5(config)#int s1/0
R5(config-if)#ip mtu 1490 <--- layer-3="" mtu="" p="">
R5(config-if)#shut
R5(config-if)#no shut

R4(config)#int s1/0
R4(config-if)#ip mtu 1490 <--- layer-3="" mtu="" p="">
R4(config-if)#shut
R4(config-if)#no shut


R5(config-if)#
*Mar  1 01:10:35.615: %OSPF-5-ADJCHG: Process 5, Nbr 4.4.4.4 on Serial1/0 from LOADING to FULL, Loading Done
R5(config-if)#
R5(config-if)#do sh ip os nei

Neighbor ID     Pri   State           Dead Time   Address         Interface
4.4.4.4           0   FULL/  -        00:00:35    45.1.1.4        Serial1/0


This experiment can explain that OSPF only care layer-3 MTU.  


For some reason, such as VPN, we need to set different layer-3 MTU / layer-2 MTU. 
What can we do on OSPF. The answer is to use

R5(config-if)#ip ospf mtu-ignore ?
 

Notice this command must be set on the interface which has less layer-3 MTU. 


R4(config-if)#do sh run int s1/0
interface Serial1/0
 ip address 45.1.1.4 255.255.255.0
 ip mtu 1480

R5(config-if)#do sh run int s1/0
interface Serial1/0
 ip address 45.1.1.5 255.255.255.0
 ip mtu 1490


R4(config-if)#ip ospf mtu-ignore <-- b="" nbsp=""> the interface which has less layer-3 MTU. 


R4#sh ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
5.5.5.5           0   FULL/  -        00:00:32    45.1.1.5        Serial1/0