Showing posts with label OSPF. Show all posts
Showing posts with label OSPF. Show all posts

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






Oct 6, 2015

OSPF - Router ID

R1(config)#router os 1
R1(config-router)#router-id 1.1.1.1
R1#sh ip protocols
Routing Protocol is "ospf 1"
  Outgoing update filter list for all interfaces is not set
  Incoming update filter list for all interfaces is not set
  Router ID 1.1.1.1 <== [HERE!!]

This is router ID cannot be changed, once some interface has run OSPF.
R1(config-router)#
*Mar  1 00:43:06.031: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on Serial1/0 from LOADING to FULL, Load

R1(config-router)#router-id 2.2.2.2
Reload or use "clear ip ospf process" command, for this to take effect <== [Here]
R1(config-router)#


AUTO-COST REFERENCE BANDWIDTH ON OSPF

In the cost of ospf  = 10^8 / bandwidth

At here 10^8 is equal to auto-cost reference bandwidth.

[Topology]

R1 [f0/0]   —- [f0/0] R2

R1(config-router)#no ?
auto-cost    Calculate OSPF interface cost according to bandwidth

R1(config-router)#auto-cost reference-bandwidth ?
<1-4294967> The reference bandwidth in terms of Mbits per second

R1(config-router)#auto-cost reference-bandwidth 100 <= [Here means 10^8]

Now, let us see how it works. As we had known that the default bandwidth of fast ethernet is 100 Mbps. Therefor, the cost of fast ethernet is 10^8/ 10^8 == 1

R1(config-if)#ip ospf 12 area 0
R1(config-if)#exit
R1(config)#do sh ip ospf int fa0/0
FastEthernet0/0 is up, line protocol is up
Internet Address 12.1.1.1/24, Area 0, Attached via Interface Enable
Process ID 12, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 1 

R1(config-if)#bandwidth ?
<1-10000000> Bandwidth in kilobits

R1(config-if)#bandwidth 10000
R1(config-if)#do sh ip ospf int fa0/0
FastEthernet0/0 is up, line protocol is up
Internet Address 12.1.1.1/24, Area 0, Attached via Interface Enable
Process ID 12, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 10  <=> [10^8/10000,000]