实验过程:
第一步 R1、R2、R3的预配置 R1(config)#int f0/0 R1(config-if)#ip add 192.168.0.1 255.255.255.0 R1(config-if)#no sh R1(config-if)#exit
R2(config)#int f0/0
R2(config-if)#ip add 192.168.0.2 255.255.255.0 R2(config-if)#no sh R2(config-if)#exit
R3(config)#int f0/0
R3(config-if)#ip add 192.168.0.3 255.255.255.0 R3(config-if)#no sh R3(config-if)#exit
第二步 在R1上配置OSPF
R1(config)#router ospf 64 R1(config-router)#net 192.168.0.1 0.0.0 .0 area 0 R1(config-router)#end R1#debug ip ospf adj OSPF adjacency events debugging is on
R1#
*Jul 2 15:57:01.527: OSPF: Interface FastEthernet0/0 going Up *Jul 2 15:57:02.011: OSPF: We are not DR to build Net Lsa for interface FastEthernet0/0 *Jul 2 15:57:02.011: OSPF: Build router LSA for area 0, router ID 192.168.0.1, seq 0x80000001, process 64 R1# *Jul 2 15:57:41.531: OSPF: end of Wait on interface FastEthernet0/0 *Jul 2 15:57:41.531: OSPF: DR/BDR election on FastEthernet0/0 *Jul 2 15:57:41.531: OSPF: Elect BDR 192.168.0.1 *Jul 2 15:57:41.535: OSPF: Elect DR 192.168.0.1 *Jul 2 15:57:41.535: OSPF: Elect BDR 0.0.0 .0 *Jul 2 15:57:41.535: OSPF: Elect DR 192.168.0.1 *Jul 2 15:57:41.535: DR: 192.168.0.1 (Id) BDR: none *Jul 2 15:57:42.035: OSPF: No full nbrs to build Net Lsa for interface FastEthernet0/0 // 因为现在R2的接口没有开启OSPF,所以R1进行选举DR/BDR的结果是自己(192.168.0.1)成为DR
第三步 在R2上配置OSPF
R2#debug ip ospf events OSPF events debugging is on R2#conf t R2(config)#router ospf 64 R2(config-router)#net 192.168.0.2 0.0.0 .0 area 0 R2(config-router)#exit *Jul 2 15:58:37.891: OSPF: Interface FastEthernet0/0 going Up *Jul 2 15:58:37.895: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 192.168.0.2 // R2 的F0/0接口想224.0.0.5宣告在area 0区域中 R2(config)# *Jul 2 15:58:41.567: OSPF: Rcv hello from 192.168.0.1 area 0 from FastEthernet0/0 192.168.0.1 *Jul 2 15:58:41.571: OSPF: 2 Way Communication to 192.168.0.1 on FastEthernet0/0, state 2WAY // 当R2收到R1的Hello确认包之后,R1与R2之间进入2 Way状态 *Jul 2 15:58:41.571: OSPF: Backup seen Event before WAIT timer on FastEthernet0/0 *Jul 2 15:58:41.571: OSPF: DR/BDR election on FastEthernet0/0 *Jul 2 15:58:41.571: OSPF: Elect BDR 192.168.0.2 *Jul 2 15:58:41.571: OSPF: Elect DR 192.168.0.1 *Jul 2 15:58:41.575: OSPF: Elect BDR 192.168.0.2 *Jul 2 15:58:41.575: OSPF: Elect DR 192.168.0.1 *Jul 2 15:58:41.575: DR: 192.168.0.1 (Id) BDR: 192.168.0.2 (Id) *Jul 2 15:58:41.575: OSPF: Send DBD to 192.168.0.1 on FastEthernet0/0 seq 0xDF3 opt 0x52 flag 0x7 len 32 *Jul 2 15:58:41.579: OSPF: Send immediate hello to nbr 192.168.0.1, src address 192.168.0.1, on FastEthernet0/0 *Jul 2 15:58:41.579: OSPF: Send hello to 192.168.0.1 area 0 on FastEthernet0/0 from 192.168.0.2 *Jul 2 15:58:41.583: OSPF: End of hello processing *Jul 2 15:58:41.751: OSPF: Rcv DBD from 192.168.0.1 on FastEthernet0/0 seq 0x43B opt 0x52 flag 0x7 len 32 mtu 1500 state EXSTART // 进入Exstart状态 *Jul 2 15:58:41.751: OSPF: First DBD and we are not SLAVE *Jul 2 15:58:41.755: OSPF: Rcv DBD from 192.168.0.1 on FastEthernet0/0 seq 0xDF3 opt 0x52 flag 0x2 len 52 mtu 1500 state EXSTART *Jul 2 15:58:41.755: OSPF: NBR Negotiation Done. We are the MASTER *Jul 2 15:58:41.755: OSPF: Send DBD to 192.168.0.1 on FastEthernet0/0 seq 0xDF4 opt 0x52 flag 0x3 len 52 *Jul 2 15:58:41.863: OSPF: Rcv DBD from 192.168.0.1 on FastEthernet0/0 seq 0xDF4 opt 0x52 flag 0x0 len 32 mtu 1500 state EXCHANGE // 进入Exchange状态 *Jul 2 15:58:41.867: OSPF: Send DBD to 192.168.0.1 on FastEthernet0/0 seq 0xDF5 opt 0x52 flag 0x1 len 32 *Jul 2 15:58:41.867: OSPF: Send LS REQ to 192.168.0.1 length 12 LSA count 1 *Jul 2 15:58:41.923: OSPF: Rcv LS REQ from 192.168.0.1 on F R2(config)#astEthernet0/0 length 36 LSA count 1 *Jul 2 15:58:41.923: OSPF: Send UPD to 192.168.0.1 on FastEthernet0/0 length 40 LSA count 1 *Jul 2 15:58:41.975: OSPF: Rcv DBD from 192.168.0.1 on FastEthernet0/0 seq 0xDF5 opt 0x52 flag 0x0 len 32 mtu 1500 state EXCHANGE *Jul 2 15:58:41.975: OSPF: Exchange Done with 192.168.0.1 on FastEthernet0/0 *Jul 2 15:58:41.975: OSPF: Rcv LS UPD from 192.168.0.1 on FastEthernet0/0 length 64 LSA count 1 *Jul 2 15:58:41.979: OSPF: Synchronized with 192.168.0.1 on FastEthernet0/0, state FULL *Jul 2 15:58:41.979: %OSPF-5-ADJCHG: Process 64, Nbr 192.168.0.1 on FastEthernet0/0 from LOADING to FULL, Loading Done // 进入Loading Full状态 *Jul 2 15:58:42.199: OSPF: Rcv LS UPD from 192.168.0.1 on FastEthernet0/0 length 64 LSA count 1 *Jul 2 15:58:42.515: OSPF: Rcv LS UPD from 192.168.0.1 on FastEthernet0/0 length 60 LSA count 1 R2(config)# *Jul 2 15:58:47.895: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 192.168.0.2 R2(config)# *Jul 2 15:58:51.595: OSPF: Rcv hello from 192.168.0.1 area 0 from FastEthernet0/0 192.168.0.1 *Jul 2 15:58:51.595: OSPF: Neighbor change Event on interface FastEthernet0/0 *Jul 2 15:58:51.599: OSPF: DR/BDR election on FastEthernet0/0 *Jul 2 15:58:51.599: OSPF: Elect BDR 192.168.0.2 *Jul 2 15:58:51.599: OSPF: Elect DR 192.168.0.1 *Jul 2 15:58:51.599: DR: 192.168.0.1 (Id) BDR: 192.168.0.2 (Id) *Jul 2 15:58:51.603: OSPF: End of hello processing R2(config)# R2(config)#exit R2#u all All possible debugging has been turned off R2#
第四步 在R2上查看OSPF接口信息
R2#show ip ospf interface FastEthernet0/0 is up, line protocol is up Internet Address 192.168.0.2/24, Area 0 Process ID 64, Router ID 192.168.0.2, Network Type BROADCAST, Cost: 1 Transmit Delay is 1 sec, State BDR, Priority 1 // 可以看到R2的F0/0接口现在是BDR Designated Router (ID) 192.168.0.1, Interface address 192.168.0.1 Backup Designated router (ID) 192.168.0.2, Interface address 192.168.0.2 Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 oob-resync timeout 40 Hello due in 00:00:05 Supports Link-local Signaling (LLS) Cisco NSF helper support enabled IETF NSF helper support enabled Index 1/1, 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.0.1 (Designated Router) Suppress hello for 0 neighbor(s) R2#
第五步 在R1上重置OSPF进程
R1#clear ip ospf process Reset ALL OSPF processes? [no]: yes R1# *Jul 2 16:02:36.903: OSPF: Interface FastEthernet0/0 going Down *Jul 2 16:02:36.903: OSPF: 192.168.0.1 address 192.168.0.1 on FastEthernet0/0 is dead, state DOWN *Jul 2 16:02:36.903: OSPF: Neighbor change Event on interface FastEthernet0/0 *Jul 2 16:02:36.907: OSPF: DR/BDR election on FastEthernet0/0 *Jul 2 16:02:36.907: OSPF: Elect BDR 192.168.0.2 *Jul 2 16:02:36.907: OSPF: Elect DR 192.168.0.2 *Jul 2 16:02:36.907: OSPF: Elect BDR 192.168.0.2 *Jul 2 16:02:36.907: OSPF: Elect DR 192.168.0.2 *Jul 2 16:02:36.911: DR: 192.168.0.2 (Id) BDR: 192.168.0.2 (Id) *Jul 2 16:02:36.911: OSPF: Flush network LSA immediately *Jul 2 16:02:36.911: OSPF: Remember old DR 192.168.0.1 (id) *Jul 2 16:02:36.915: OSPF: 192.168.0.2 address 192.168.0.2 on FastEthernet0/0 is dead, state DOWN *Jul 2 16:02:36.915: %OSPF-5-ADJCHG: Process 64, Nbr 192.168.0.2 on FastEthernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detached *Jul 2 16:02:36.915: OSPF: Neighbor change Event on interface FastEthernet0/0 *Jul 2 16:02:36.919: OSPF: DR/BDR election on FastEthernet0/0 *Jul 2 16:02:36.919: OSPF: Elect BDR 0.0.0 .0 *Jul 2 16:02:36.919: OSPF: Elect DR 0.0.0.0 *Jul 2 16:02:36.919: DR: none BDR: none *Jul 2 16:02:36.919: OSPF: Remember old DR 192.168.0.2 (id) *Jul 2 16:02:37.083: OSPF: Interface FastEthernet0/0 going Up *Jul 2 16:02:37.099: OSPF: 2 Way Communication to 192.168.0.2 on FastEthernet0/0, state 2WAY *Jul 2 16:02:37.099: OSPF: Backup seen Event before WAIT timer on FastEthernet0/0 *Jul 2 16:02:37.099: OSPF: DR/BDR election on FastEthernet0/0 *Jul 2 16:02:37.103: OSPF: Elect BDR 192.168.0.1 *Jul 2 16:02:37.103: OSPF: Elect DR 192.168.0.2 *Jul 2 16:02:37.103: OSPF: Ele R1#ct BDR 192.168.0.1 *Jul 2 16:02:37.103: OSPF: Elect DR 192.168.0.2 *Jul 2 16:02:37.103: DR: 192.168.0.2 (Id) BDR: 192.168.0.1 (Id) *Jul 2 16:02:37.107: OSPF: Send DBD to 192.168.0.2 on FastEthernet0/0 seq 0x2407 opt 0x52 flag 0x7 len 32 *Jul 2 16:02:37.123: OSPF: Rcv DBD from 192.168.0.2 on FastEthernet0/0 seq 0x182F opt 0x52 flag 0x7 len 32 mtu 1500 state EXSTART *Jul 2 16:02:37.127: OSPF: NBR Negotiation Done. We are the SLAVE *Jul 2 16:02:37.127: OSPF: Send DBD to 192.168.0.2 on FastEthernet0/0 seq 0x182F opt 0x52 flag 0x0 len 32 *Jul 2 16:02:37.131: OSPF: Rcv DBD from 192.168.0.2 on FastEthernet0/0 seq 0x1830 opt 0x52 flag 0x3 len 52 mtu 1500 state EXCHANGE *Jul 2 16:02:37.135: OSPF: Send DBD to 192.168.0.2 on FastEthernet0/0 seq 0x1830 opt 0x52 flag 0x0 len 32 *Jul 2 16:02:37.207: OSPF: Rcv DBD from 192.168.0.2 on FastEthernet0/0 seq 0x1831 opt 0x52 flag 0x1 len 32 mtu 1500 state EXCHANGE *Jul 2 16:02:37.211: OSPF: Exchange Done with 192.168.0.2 on FastEthernet0/0 *Jul 2 16:02:37.211: OSPF: Send LS REQ to 192.168.0.2 leng R1#th 12 LSA count 1 *Jul 2 16:02:37.211: OSPF: Send DBD to 192.168.0.2 on FastEthernet0/0 seq 0x1831 opt 0x52 flag 0x0 len 32 *Jul 2 16:02:37.295: OSPF: Rcv LS UPD from 192.168.0.2 on FastEthernet0/0 length 64 LSA count 1 *Jul 2 16:02:37.295: OSPF: Synchronized with 192.168.0.2 on FastEthernet0/0, state FULL *Jul 2 16:02:37.295: %OSPF-5-ADJCHG: Process 64, Nbr 192.168.0.2 on FastEthernet0/0 from LOADING to FULL, Loading Done *Jul 2 16:02:37.411: OSPF: We are not DR to build Net Lsa for interface FastEthernet0/0 *Jul 2 16:02:37.415: OSPF: Build router LSA for area 0, router ID 192.168.0.1, seq 0x80000001, process 64 *Jul 2 16:02:37.643: OSPF: Rcv LS UPD from 192.168.0.2 on FastEthernet0/0 length 64 LSA count 1 *Jul 2 16:02:37.647: OSPF: Rcv LS UPD from 192.168.0.2 on FastEthernet0/0 length 60 LSA count 1 *Jul 2 16:02:37.879: OSPF: Neighbor change Event on interface FastEthernet0/0 *Jul 2 16:02:37.879: OSPF: DR/BDR election on FastEthernet0/0 *Jul 2 16:02:37.879: OS R1#PF: Elect BDR 192.168.0.1 *Jul 2 16:02:37.879: OSPF: Elect DR 192.168.0.2 *Jul 2 16:02:37.883: DR: 192.168.0.2 (Id) BDR: 192.168.0.1 (Id) // 现在看到192.168.0.2成为了DR R1#
第六步 配置R3的OSPF
R3#debug ip ospf adj OSPF adjacency events debugging is on R3#conf t R3(config)#router ospf 64 R3(config-router)#net 192.168.0.3 0.0.0 .0 area 0 R3(config-router)#exit *Jul 2 16:04:03.591: OSPF: Interface FastEthernet0/0 going Up *Jul 2 16:04:04.091: OSPF: Build router LSA for area 0, router ID 192.168.0.3, seq 0x80000001, process 64 R3(config)# *Jul 2 16:04:07.147: OSPF: 2 Way Communication to 192.168.0.1 on FastEthernet0/0, state 2WAY *Jul 2 16:04:07.151: OSPF: Backup seen Event before WAIT timer on FastEthernet0/0 *Jul 2 16:04:07.151: OSPF: DR/BDR election on FastEthernet0/0 *Jul 2 16:04:07.151: OSPF: Elect BDR 192.168.0.1 *Jul 2 16:04:07.151: OSPF: Elect DR 192.168.0.1 *Jul 2 16:04:07.151: DR: 192.168.0.1 (Id) BDR: 192.168.0.1 (Id) *Jul 2 16:04:07.155: OSPF: Send DBD to 192.168.0.1 on FastEthernet0/0 seq 0x1C7 opt 0x52 flag 0x7 len 32 *Jul 2 16:04:07.259: OSPF: Rcv DBD from 192.168.0.1 on FastEthernet0/0 seq 0x1597 opt 0x52 flag 0x7 len 32 mtu 1500 state EXSTART *Jul 2 16:04:07.263: OSPF: First DBD and we are not SLAVE *Jul 2 16:04:07.263: OSPF: Rcv DBD from 192.168.0.1 on FastEthernet0/0 seq 0x1C7 opt 0x52 flag 0x2 len 92 mtu 1500 state EXSTART *Jul 2 16:04:07.267: OSPF: NBR Negotiation Done. We are the MASTER *Jul 2 16:04:07.267: OSPF: Send DBD to 192.168.0.1 on FastEthernet0/0 seq 0 R3(config)#x1C8 opt 0x52 flag 0x3 len 52 *Jul 2 16:04:07.367: OSPF: Rcv DBD from 192.168.0.1 on FastEthernet0/0 seq 0x1C8 opt 0x52 flag 0x0 len 32 mtu 1500 state EXCHANGE *Jul 2 16:04:07.367: OSPF: Send DBD to 192.168.0.1 on FastEthernet0/0 seq 0x1C9 opt 0x52 flag 0x1 len 32 *Jul 2 16:04:07.367: OSPF: Send LS REQ to 192.168.0.1 length 36 LSA count 3 *Jul 2 16:04:07.439: OSPF: Rcv LS REQ from 192.168.0.1 on FastEthernet0/0 length 36 LSA count 1 *Jul 2 16:04:07.439: OSPF: Send UPD to 192.168.0.1 on FastEthernet0/0 length 40 LSA count 1 *Jul 2 16:04:07.439: OSPF: Rcv DBD from 192.168.0.1 on FastEthernet0/0 seq 0x1C9 opt 0x52 flag 0x0 len 32 mtu 1500 state EXCHANGE *Jul 2 16:04:07.443: OSPF: Exchange Done with 192.168.0.1 on FastEthernet0/0 *Jul 2 16:04:07.443: OSPF: Rcv LS UPD from 192.168.0.1 on FastEthernet0/0 length 132 LSA count 3 *Jul 2 16:04:07.447: OSPF: Synchronized with 192.168.0.1 on FastEthernet0/0, state FULL *Jul 2 16:04:07.447: %OSPF-5-ADJCHG: Process 64, Nbr 192 R3(config)#.168.0.1 on FastEthernet0/0 from LOADING to FULL, Loading Done *Jul 2 16:04:07.903: OSPF: 2 Way Communication to 192.168.0.2 on FastEthernet0/0, state 2WAY *Jul 2 16:04:07.903: OSPF: Neighbor change Event on interface FastEthernet0/0 *Jul 2 16:04:07.903: OSPF: DR/BDR election on FastEthernet0/0 *Jul 2 16:04:07.903: OSPF: Elect BDR 192.168.0.1 *Jul 2 16:04:07.907: OSPF: Elect DR 192.168.0.2 *Jul 2 16:04:07.907: DR: 192.168.0.2 (Id) BDR: 192.168.0.1 (Id) *Jul 2 16:04:07.907: OSPF: Send DBD to 192.168.0.2 on FastEthernet0/0 seq 0x17A6 opt 0x52 flag 0x7 len 32 *Jul 2 16:04:07.907: OSPF: Remember old DR 192.168.0.1 (id) *Jul 2 16:04:07.911: OSPF: Neighbor change Event on interface FastEthernet0/0 *Jul 2 16:04:07.911: OSPF: DR/BDR election on FastEthernet0/0 *Jul 2 16:04:07.911: OSPF: Elect BDR 192.168.0.1 *Jul 2 16:04:07.911: OSPF: Elect DR 192.168.0.2 *Jul 2 16:04:07.911: DR: 192.168.0.2 (Id) BDR: 192.168.0.1 (Id) *Jul 2 16:04:08.003: OSPF: R3(config)#Rcv DBD from 192.168.0.2 on FastEthernet0/0 seq 0xEB opt 0x52 flag 0x7 len 32 mtu 1500 state EXSTART *Jul 2 16:04:08.007: OSPF: First DBD and we are not SLAVE *Jul 2 16:04:08.007: OSPF: Rcv DBD from 192.168.0.2 on FastEthernet0/0 seq 0x17A6 opt 0x52 flag 0x2 len 92 mtu 1500 state EXSTART *Jul 2 16:04:08.007: OSPF: NBR Negotiation Done. We are the MASTER *Jul 2 16:04:08.011: OSPF: Send DBD to 192.168.0.2 on FastEthernet0/0 seq 0x17A7 opt 0x52 flag 0x3 len 112 *Jul 2 16:04:08.015: OSPF: Rcv DBD from 192.168.0.2 on FastEthernet0/0 seq 0x17A7 opt 0x52 flag 0x0 len 32 mtu 1500 state EXCHANGE *Jul 2 16:04:08.019: OSPF: Send DBD to 192.168.0.2 on FastEthernet0/0 seq 0x17A8 opt 0x52 flag 0x1 len 32 *Jul 2 16:04:08.055: OSPF: Rcv LS REQ from 192.168.0.2 on FastEthernet0/0 length 36 LSA count 1 *Jul 2 16:04:08.055: OSPF: Send UPD to 192.168.0.2 on FastEthernet0/0 length 40 LSA count 1 *Jul 2 16:04:08.055: OSPF: Rcv DBD from 192.168.0.2 on FastEthernet0/0 seq 0x17A8 opt 0x52 R3(config)# flag 0x0 len 32 mtu 1500 state EXCHANGE *Jul 2 16:04:08.059: OSPF: Exchange Done with 192.168.0.2 on FastEthernet0/0 *Jul 2 16:04:08.059: OSPF: Synchronized with 192.168.0.2 on FastEthernet0/0, state FULL *Jul 2 16:04:08.059: %OSPF-5-ADJCHG: Process 64, Nbr 192.168.0.2 on FastEthernet0/0 from LOADING to FULL, Loading Done *Jul 2 16:04:08.111: OSPF: Rcv LS UPD from 192.168.0.2 on FastEthernet0/0 length 64 LSA count 1 *Jul 2 16:04:08.551: OSPF: Rcv LS UPD from 192.168.0.2 on FastEthernet0/0 length 64 LSA count 1 R3(config)# *Jul 2 16:04:12.655: OSPF: Reset old DR on FastEthernet0/0 *Jul 2 16:04:12.659: OSPF: Build router LSA for area 0, router ID 192.168.0.3, seq 0x80000002, process 64 *Jul 2 16:04:12.763: OSPF: Rcv LS UPD from 192.168.0.2 on FastEthernet0/0 length 64 LSA count 1 R3(config)#end R3# R3#show ip ospf interface FastEthernet0/0 is up, line protocol is up Internet Address 192.168.0.3/24, Area 0 Process ID 64, Router ID 192.168.0.3, Network Type BROADCAST, Cost: 1 Transmit Delay is 1 sec, State DROTHER, Priority 1 // 现在可以看到R3的接口状态是DROTHER Designated Router (ID) 192.168.0.2, Interface address 192.168.0.2 Backup Designated router (ID) 192.168.0.1, Interface address 192.168.0.1 Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 oob-resync timeout 40 Hello due in 00:00:05 Supports Link-local Signaling (LLS) Cisco NSF helper support enabled IETF NSF helper support enabled Index 1/1, 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 2, Adjacent neighbor count is 2 Adjacent with neighbor 192.168.0.1 (Backup Designated Router) Adjacent with neighbor 192.168.0.2 (Designated Router) Suppress hello for 0 neighbor(s) R3#
第七步 在R1上查看OSPF邻居状态
R1#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.0.2 1 FULL/DR 00:00:36 192.168.0.2 FastEthernet0/0 192.168.0.3 1 FULL/DROTHER 00:00:32 192.168.0.3 FastEthernet0/0 R1# R1#show ip ospf neighbor detail Neighbor 192.168.0.2, interface address 192.168.0.2 In the area 0 via interface FastEthernet0/0 Neighbor priority is 1, State is FULL, 6 state changes DR is 192.168.0.2 BDR is 192.168.0.1 Options is 0x52 LLS Options is 0x1 (LR) Dead timer due in 00:00:33 Neighbor is up for 00:04:47 Index 1/1, retransmission queue length 0, number of retransmission 1 First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0) Last retransmission scan length is 1, maximum is 1 Last retransmission scan time is 0 msec, maximum is 0 msec Neighbor 192.168.0.3, interface address 192.168.0.3 In the area 0 via interface FastEthernet0/0 Neighbor priority is 1, State is FULL, 6 state changes DR is 192.168.0.2 BDR is 192.168.0.1 Options is 0x52 LLS Options is 0x1 (LR) Dead timer due in 00:00:39 Neighbor is up for 00:03:17 Index 2/2, retransmission queue length 0, number of retransmission 0 First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0) Last retransmission scan length is 0, maximum is 0 Last retransmission scan time is 0 msec, maximum is 0 msec R1#
第八步 在R1、R2、R3上重置OSPF进程
// 重置完OSPF进程后在R3上再次查看OSPF的邻居关系 R3#show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.0.1 1 FULL/DROTHER 00:00:38 192.168.0.1 FastEthernet0/0 192.168.0.2 1 FULL/BDR 00:00:37 192.168.0.2 FastEthernet0/0
R3#show ip ospf interface
FastEthernet0/0 is up, line protocol is up Internet Address 192.168.0.3/24, Area 0 Process ID 64, Router ID 192.168.0.3, Network Type BROADCAST, Cost: 1 // OSPF 进程号为1,路由器ID为192.168.0.3,网络类型为广播,Cost为1 Transmit Delay is 1 sec, State DR, Priority 1 // R3 的F0/0接口的优先级默认为1,现在R3已经成为DR Designated Router (ID) 192.168.0.3, Interface address 192.168.0.3 Backup Designated router (ID) 192.168.0.2, Interface address 192.168.0.2 // BDR 是192.168.0.2,即R2的RID Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 oob-resync timeout 40 Hello due in 00:00:05 Supports Link-local Signaling (LLS) Cisco NSF helper support enabled IETF NSF helper support enabled Index 1/1, 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 4 msec Neighbor Count is 2, Adjacent neighbor count is 2 Adjacent with neighbor 192.168.0.1 Adjacent with neighbor 192.168.0.2 (Backup Designated Router) Suppress hello for 0 neighbor(s) R3#
第九步 修改R3的OSPF优先级为0
R3(config)#int f0/0 R3(config-if)#ip ospf priority 0 // R3 的F0/0接口的优先级为0不参与DR/BDR的选举 R3(config-if)# *Jul 2 16:10:59.739: OSPF: Neighbor change Event on interface FastEthernet0/0 *Jul 2 16:10:59.739: OSPF: DR/BDR election on FastEthernet0/0 *Jul 2 16:10:59.739: OSPF: Elect BDR 192.168.0.2 *Jul 2 16:10:59.739: OSPF: Elect DR 192.168.0.2 *Jul 2 16:10:59.739: OSPF: Elect BDR 192.168.0.2 *Jul 2 16:10:59.743: OSPF: Elect DR 192.168.0.2 *Jul 2 16:10:59.743: DR: 192.168.0.2 (Id) BDR: 192.168.0.2 (Id) *Jul 2 16:10:59.743: OSPF: Reset adjacency with 192.168.0.1 on FastEthernet0/0, state 2WAY *Jul 2 16:10:59.747: OSPF: Set FastEthernet0/0 flush timer *Jul 2 16:10:59.747: OSPF: Remember old DR 192.168.0.3 (id) R3(config-if)# *Jul 2 16:11:00.243: OSPF: Include link to old DR on FastEthernet0/0 R3(config-if)# *Jul 2 16:11:01.595: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 192.168.0.3 *Jul 2 16:11:02.115: OSPF: Rcv LS UPD from 192.168.0.2 on FastEthernet0/0 length 64 LSA count 1 *Jul 2 16:11:02.119: OSPF: Rcv LS UPD from 192.168.0.2 on FastEthernet0/0 length 76 LSA count 1 *Jul 2 16:11:02.235: OSPF: Rcv LS UPD from 192.168.0.2 on FastEthernet0/0 length 76 LSA count 1 R3(config-if)# *Jul 2 16:11:03.571: OSPF: Rcv hello from 192.168.0.2 area 0 from FastEthernet0/0 192.168.0.2 *Jul 2 16:11:03.571: OSPF: Neighbor change Event on interface FastEthernet0/0 *Jul 2 16:11:03.575: OSPF: DR/BDR election on FastEthernet0/0 *Jul 2 16:11:03.575: OSPF: Elect BDR 192.168.0.1 *Jul 2 16:11:03.575: OSPF: Elect DR 192.168.0.2 *Jul 2 16:11:03.575: DR: 192.168.0.2 (Id) BDR: 192.168.0.1 (Id) *Jul 2 16:11:03.579: OSPF: Send DBD to 192.168.0.1 on FastEthernet0/0 seq 0x65F opt 0x52 flag 0x7 len 32 *Jul 2 16:11:03.579: OSPF: Neighbor change Event on interface FastEthernet0/0 *Jul 2 16:11:03.579: OSPF: DR/BDR election on FastEthernet0/0 R3(config-if)# *Jul 2 16:11:03.579: OSPF: Elect BDR 192.168.0.1 *Jul 2 16:11:03.583: OSPF: Elect DR 192.168.0.2 *Jul 2 16:11:03.583: DR: 192.168.0.2 (Id) BDR: 192.168.0.1 (Id) // 现在选举的结果出来:DR为192.168.0.2 BDR为192.168.0.1 *Jul 2 16:11:03.583: OSPF: End of hello processing *Jul 2 16:11:03.591: OSPF: Rcv DBD from 192.168.0.1 on FastEthernet0/0 seq 0x1A4A opt 0x52 flag 0x7 len 32 mtu 1500 state EXSTART *Jul 2 16:11:03.595: OSPF: First DBD and we are not SLAVE *Jul 2 16:11:03.803: OSPF: Rcv DBD from 192.168.0.1 on FastEthernet0/0 seq 0x65F opt 0x52 flag 0x2 len 132 mtu 1500 state EXSTART *Jul 2 16:11:03.807: OSPF: NBR Negotiation Done. We are the MASTER *Jul 2 16:11:03.807: OSPF: Send DBD to 192.168.0.1 on FastEthernet0/0 seq 0x660 opt 0x52 flag 0x3 len 132 *Jul 2 16:11:03.963: OSPF: Rcv DBD from 192.168.0.1 on FastEthernet0/0 seq 0x660 opt 0x52 flag 0x0 len 32 mtu 1500 state EXCHANGE *Jul 2 16:11:03.963: OSPF: Send DBD to 192.168.0.1 on FastEthernet0/0 seq 0x661 opt 0x52 flag 0x1 len 32 *Jul 2 16:11:03.967: OSP R3(config-if)#F: Rcv hello from 192.168.0.1 area 0 from FastEthernet0/0 192.168.0.1 *Jul 2 16:11:03.967: OSPF: Neighbor change Event on interface FastEthernet0/0 *Jul 2 16:11:03.971: OSPF: DR/BDR election on FastEthernet0/0 *Jul 2 16:11:03.971: OSPF: Elect BDR 192.168.0.1 *Jul 2 16:11:03.971: OSPF: Elect DR 192.168.0.2 *Jul 2 16:11:03.971: DR: 192.168.0.2 (Id) BDR: 192.168.0.1 (Id) *Jul 2 16:11:03.975: OSPF: Neighbor change Event on interface FastEthernet0/0 *Jul 2 16:11:03.975: OSPF: DR/BDR election on FastEthernet0/0 *Jul 2 16:11:03.975: OSPF: Elect BDR 192.168.0.1 *Jul 2 16:11:03.975: OSPF: Elect DR 192.168.0.2 *Jul 2 16:11:03.975: DR: 192.168.0.2 (Id) BDR: 192.168.0.1 (Id) *Jul 2 16:11:03.979: OSPF: End of hello processing *Jul 2 16:11:04.059: OSPF: Rcv LS REQ from 192.168.0.1 on FastEthernet0/0 length 36 LSA count 1 *Jul 2 16:11:04.059: OSPF: Send UPD to 192.168.0.1 on FastEthernet0/0 length 52 LSA count 1 *Jul 2 16:11:04.067: OSPF: Rcv DBD from R3(config-if)#end R3#192.168.0.1 on FastEthernet0/0 seq 0x661 opt 0x52 flag 0x0 len 32 mtu 1500 state EXCHANGE *Jul 2 16:11:04.067: OSPF: Exchange Done with 192.168.0.1 on FastEthernet0/0 *Jul 2 16:11:04.067: OSPF: Synchronized with 192.168.0.1 on FastEthernet0/0, state FULL *Jul 2 16:11:04.071: %OSPF-5-ADJCHG: Process 64, Nbr 192.168.0.1 on FastEthernet0/0 from LOADING to FULL, Loading Done *Jul 2 16:11:05.243: OSPF: Include link to old DR on FastEthernet0/0 R3#u all All possible debugging has been turned off R3# OSPF 的各种邻接状态: 1. Down 失效状态。此状态下OSPF进程还没有与任何邻居交换信息,OSPF在等待进入Init状态
2. Attempt
此状态仅适用于NBMA网络,当具有DR选取资格的路由器和邻居路由器相连接口变为Active时,或这台路由器成为DR或BDR时,这台具有DR选取资格的路由器会把邻居路由器状态转换到Attempt状态
3. Init
在接口收到第一个Hello分组后,路由器就进入到Init状态。这表明路由器知道有一个邻居在那边等待将相互之间的关系进入到下一步
4. Two-Wany
Hello 分组中含有发送者已知的OSPF邻居列表。当路由器看到它自己出现在一个邻居路由器的Hello分组中时,它就进入双向状态
5. Exstart
准启动状态。两个邻居路由器用Hello分组来协商在它们之间的主从关系,并用DBD分组来交换数据库信息
6. Exchange
邻居路由器使用DBD分组来相互发送它们的链路状态信息
7. Loading
路由器用链路状态请求LSR分组来请求更新完整信息。当路由器收到一个LSR后它会用LSU分组进行回应,LSU分组含有确切的LSA,LSA是链路状态型路由选择协议的核心。 LSU由LSACK分组确认
8. Full 本文出自 51CTO.COM技术博客
路由器进入全毗邻状态。每台路由器都保存一张毗邻路由列表,它成为毗邻数据库。毗邻数据库不同于转发数据库,转发数据库是对链路状态数据库进行一种算法后所产生的列表 |