OSPF DR解析

標籤:思科 OSPF 路由 交換    [推送到技術圈]

實驗過程:
第一步  R1R2R3的預配置

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收到R1Hello確認包之後,R1R2之間進入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
// 
可以看到R2F0/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#

第六步  配置R3OSPF
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#

第八步  R1R2R3上重置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,路由器ID192.168.0.3,網絡類型爲廣播,Cost1
  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,即R2RID
  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#

第九步  修改R3OSPF優先級爲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)
// 
現在選舉的結果出來:DR192.168.0.2  BDR192.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時,或這臺路由器成爲DRBDR時,這臺具有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分組含有確切的LSALSA是鏈路狀態型路由選擇協議的核心。 LSULSACK分組確認

8. Full
路由器進入全毗鄰狀態。每臺路由器都保存一張毗鄰路由列表,它成爲毗鄰數據庫。毗鄰數據庫不同於轉發數據庫,轉發數據庫是對鏈路狀態數據庫進行一種算法後所產生的列表
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章