R1配置
r1(config)#int f0/0
r1(config-if)#ip ad 192.168.0.1 255.255.255.0 r1(config-if)#no sh r1(config-if)#exi
R2配置
r2(config)#int f0/0
r2(config-if)#ip ad 192.168.0.2 255.255.255.0 r2(config-if)#no sh r2(config-if)#exi
R3配置
r3(config)#int f0/0
r3(config-if)#ip ad 192.168.0.3 255.255.255.0 r3(config-if)#no sh
在R1上配置OSPF路由
r1(config)#router os 100 r1(config-router)#net 192.168.0.1 0.0.0.0 a 0 r1(config-router)#end
r1#debug ip os adj
OSPF adjacency events debugging is on *Jul 23 13:14:43.103: OSPF: end of Wait on interface FastEthernet0/0 *Jul 23 13:14:43.103: OSPF: DR/BDR election on FastEthernet0/0 *Jul 23 13:14:43.103: OSPF: Elect BDR 192.168.0.1 *Jul 23 13:14:43.103: OSPF: Elect DR 192.168.0.1 *Jul 23 13:14:43.103: OSPF: Elect BDR 0.0.0.0 *Jul 23 13:14:43.103: OSPF: Elect DR 192.168.0.1 *Jul 23 13:14:43.103: DR: 192.168.0.1 (Id) BDR: none *Jul 23 13:14:43.607: OSPF: No full nbrs to build Net Lsa for interface FastEthernet0/0 r1#u all All possible debugging has been turned off 因为3台路由器只有R1配置了OSPF,所以DR为它自己。
开启R2 OSPF路由 比R1上开启debug消息
r2(config)#router os 100
r2(config-router)#net 192.168.0.2 0.0.0.0 a 0
r1#deb ip os ev
OSPF events debugging is on r1# *Jul 23 13:22:33.107: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 192.168.0.1 r1# *Jul 23 13:22:43.107: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 192.168.0.1 r1# *Jul 23 13:22:53.107: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 192.168.0.1 r1# *Jul 23 13:22:59.039: OSPF: Rcv hello from 192.168.0.2 area 0 from FastEthernet0/0 192.168.0.2 *Jul 23 13:22:59.039: OSPF: Send immediate hello to nbr 192.168.0.2, src address 192.168.0.2, on FastEthernet0/0 *Jul 23 13:22:59.039: OSPF: Send hello to 192.168.0.2 area 0 on FastEthernet0/0 from 192.168.0.1 *Jul 23 13:22:59.043: OSPF: End of hello processing r1# *Jul 23 13:23:03.107: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 192.168.0.1 *Jul 23 13:23:03.163: OSPF: Rcv hello from 192.168.0.2 area 0 from FastEthernet0/0 192.168.0.2 *Jul 23 13:23:03.163: OSPF: 2 Way Communication to 192.168.0.2 on FastEthernet0/0, state 2WAY 收到hello,开始2way阶段 *Jul 23 13:23:03.163: OSPF: Neighbor change Event on interface FastEthernet0/0 *Jul 23 13:23:03.163: OSPF: DR/BDR election on FastEthernet0/0 *Jul 23 13:23:03.167: OSPF: Elect BDR 192.168.0.2 *Jul 23 13:23:03.167: OSPF: Elect DR 192.168.0.1 *Jul 23 13:23:03.167: DR: 192.168.0.1 (Id) BDR: 192.168.0.2 (Id) *Jul 23 13:23:03.167: OSPF: Send DBD to 192.168.0.2 on FastEthernet0/0 seq 0x9FB opt 0x52 flag 0x7 len 32 *Jul 23 13:23:03.167: OSPF: Neighbor change Event on interface FastEthernet0/0 *Jul 23 13:23:03.171: OSPF: DR/BDR election on FastEthernet0/0 *Jul 23 13:23:03.171: OSPF: Elect BDR 192.168.0.2 *Jul 23 13:23:03.171: OSPF: Elect DR 192.168.0.1 *Jul 23 13:23:03.171: DR: 192 r1#.168.0.1 (Id) BDR: 192.168.0.2 (Id) *Jul 23 13:23:03.171: OSPF: Neighbor change Event on interface FastEthernet0/0 *Jul 23 13:23:03.171: OSPF: DR/BDR election on FastEthernet0/0 *Jul 23 13:23:03.171: OSPF: Elect BDR 192.168.0.2 *Jul 23 13:23:03.175: OSPF: Elect DR 192.168.0.1 *Jul 23 13:23:03.175: DR: 192.168.0.1 (Id) BDR: 192.168.0.2 (Id) *Jul 23 13:23:03.175: OSPF: End of hello processing *Jul 23 13:23:03.175: OSPF: Rcv DBD from 192.168.0.2 on FastEthernet0/0 seq 0x1182 opt 0x52 flag 0x7 len 32 mtu 1500 state EXSTART EXSTART阶段 *Jul 23 13:23:03.175: OSPF: NBR Negotiation Done. We are the SLAVE *Jul 23 13:23:03.175: OSPF: Send DBD to 192.168.0.2 on FastEthernet0/0 seq 0x1182 opt 0x52 flag 0x2 len 52 *Jul 23 13:23:03.255: OSPF: Rcv DBD from 192.168.0.2 on FastEthernet0/0 seq 0x1183 opt 0x52 flag 0x3 len 52 mtu 1500 state EXCHANGE EXCHANGE阶段 *Jul 23 13:23:03.255: OSPF: Send DBD to 192.168.0.2 on FastEthernet0/0 seq 0x1183 opt 0x52 flag 0x0 len 32 *Jul 23 13:23:03.271: OSPF: Rcv DBD r1# from 192.168.0.2 on FastEthernet0/0 seq 0x1184 opt 0x52 flag 0x1 len 32 mtu 1500 state EXCHANGE *Jul 23 13:23:03.271: OSPF: Exchange Done with 192.168.0.2 on FastEthernet0/0 *Jul 23 13:23:03.271: OSPF: Send LS REQ to 192.168.0.2 length 12 LSA count 1 *Jul 23 13:23:03.275: OSPF: Send DBD to 192.168.0.2 on FastEthernet0/0 seq 0x1184 opt 0x52 flag 0x0 len 32 *Jul 23 13:23:03.303: OSPF: Rcv LS REQ from 192.168.0.2 on FastEthernet0/0 length 36 LSA count 1 *Jul 23 13:23:03.303: OSPF: Send UPD to 192.168.0.2 on FastEthernet0/0 length 40 LSA count 1 *Jul 23 13:23:03.319: OSPF: Rcv LS UPD from 192.168.0.2 on FastEthernet0/0 length 64 LSA count 1 *Jul 23 13:23:03.319: OSPF: Synchronized with 192.168.0.2 on FastEthernet0/0, state FULL *Jul 23 13:23:03.319: %OSPF-5-ADJCHG: Process 100, Nbr 192.168.0.2 on FastEthernet0/0 from LOADING to FULL, Loading Done r1# *Jul 23 13:23:05.459: OSPF: Rcv LS UPD from 192.168.0.2 on FastEthernet0/0 length 64 LSA count 1 r1# *Jul 23 13:23:08.955: OSPF: Rcv hello from 192.168.0.2 area 0 from FastEthernet0/0 192.168.0.2 *Jul 23 13:23:08.955: OSPF: End of hello processing r1# *Jul 23 13:23:13.107: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 192.168.0.1 r1# *Jul 23 13:23:18.971: OSPF: Rcv hello from 192.168.0.2 area 0 from FastEthernet0/0 192.168.0.2 *Jul 23 13:23:18.971: OSPF: End of hello processing r1# *Jul 23 13:23:23.107: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 192.168.0.1 r1# *Jul 23 13:23:28.971: OSPF: Rcv hello from 192.168.0.2 area 0 from FastEthernet0/0 192.168.0.2 *Jul 23 13:23:28.971: OSPF: End of hello processing r1# *Jul 23 13:23:33.107: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 192.168.0.1 r1# *Jul 23 13:23:38.987: OSPF: Rcv hello from 192.168.0.2 area 0 from FastEthernet0/0 192.168.0.2 *Jul 23 13:23:38.987: OSPF: End of hello processing r1# *Jul 23 13:23:43.107: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 192.168.0.1 r1# *Jul 23 13:23:48.971: OSPF: Rcv hello from 192.168.0.2 area 0 from FastEthernet0/0 192.168.0.2 *Jul 23 13:23:48.971: OSPF: End of hello processing r1# *Jul 23 13:23:53.107: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 192.168.0.1 r1# *Jul 23 13:23:58.971: OSPF: Rcv hello from 192.168.0.2 area 0 from FastEthernet0/0 192.168.0.2 *Jul 23 13:23:58.971: OSPF: End of hello processing r1# *Jul 23 13:24:03.107: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 192.168.0.1 r1# *Jul 23 13:24:08.971: OSPF: Rcv hello from 192.168.0.2 area 0 from FastEthernet0/0 192.168.0.2 *Jul 23 13:24:08.971: OSPF: End of hello processing r1# *Jul 23 13:24:13.107: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 192.168.0.1 r1# *Jul 23 13:24:18.971: OSPF: Rcv hello from 192.168.0.2 area 0 from FastEthernet0/0 192.168.0.2 *Jul 23 13:24:18.971: OSPF: End of hello processing r1# *Jul 23 13:24:23.107: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 192.168.0.1 r1# *Jul 23 13:24:28.987: OSPF: Rcv hello from 192.168.0.2 area 0 from FastEthernet0/0 192.168.0.2 *Jul 23 13:24:28.987: OSPF: End of hello processing r1#u all All possible debugging has been turned off r1# *Jul 23 13:24:33.107: OSPF: Send hello to 224.0.0.5 area 0 on FastEthernet0/0 from 192.168.0.1
R1上重新启动OSPF进程
r1#clear ip os pr Reset ALL OSPF processes? [no]: y r1# *Jul 23 13:26:03.859: %OSPF-5-ADJCHG: Process 100, Nbr 192.168.0.2 on FastEthernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detached *Jul 23 13:26:04.103: %OSPF-5-ADJCHG: Process 100, Nbr 192.168.0.2 on FastEthernet0/0 from LOADING to FULL, Loading Done r1#sh ip os nei
Neighbor ID Pri State Dead Time Address Interface
192.168.0.2 1 FULL/DR 00:00:33 192.168.0.2 FastEthernet0/0 重启后R2成为了DR
R3配置OSPF路由
r3(config)#router os 100
r3(config-router)#net 192.168.0.3 0.0.0.0 a 0
在R1上SHOW一下OSPF邻居信息
r1#sh ip os nei
Neighbor ID Pri State Dead Time Address Interface
本文出自 51CTO.COM技术博客
192.168.0.2 1 FULL/DR 00:00:39 192.168.0.2 FastEthernet0/0 192.168.0.3 0 FULL/DROTHER 00:00:39 192.168.0.3 FastEthernet0/0 |