R1#debug ip ospf adj
*Sep 23 19:35:38.739: OSPF:
1.1.1
.1 address 192.168.10.1 . FastEthernet0/0 is dead, state DOWN
*Sep 23 19:35:38.739: OSPF: Neighbor change Event . interface FastEthernet0/0
*Sep 23 19:35:38.739: OSPF: DR/BDR election . FastEthernet0/0
*Sep 23 19:35:38.739: OSPF: Elect BDR
0.0.0
.0
*Sep 23 19:35:38.739: OSPF: Elect DR 192.168.235.1
*Sep 23 19:35:38.739: OSPF: Elect BDR
0.0.0
.0
*Sep 23 19:35:38.743: OSPF: Elect DR 192.168.235.1
*Sep 23 19:35:38.743: DR: 192.168.235.1 (Id) BDR: none
*Sep 23 19:35:38.743: OSPF: 192.168.235.1 address 192.168.10.2 . FastEthernet0/0 is dead, state DOWN
*Sep 23 19:35:38.743: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.235.1 . FastEthernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detached
*Sep 23 19:35:38.747: OSPF: DR/BDR election . FastEthernet0/0
*Sep 23 19:35:38.747: OSPF: Elect BDR
0.0.0
.0
*Sep 23 19:35:38.747: OSPF: Elect DR
0.0.0
.0
*Sep 23 19:35:38.747: DR: none BDR: none
*Sep 23 19:35:38.747: OSPF: Remember old DR 192.168.235.1 (id)
*Sep 23 19:35:38.819: OSPF: i_up : interface is down
*Sep 23 19:35:39.243: OSPF: Build router LSA for area 0, router ID
1.1.1
.1, seq 0x80000001
*Sep 23 19:35:47.459: OSPF: 2 Way Communication to 192.168.235.1 . FastEthernet0/0, state 2WAY
*Sep 23 19:35:47.459: OSPF: Backup seen Event before WAIT timer . FastEthernet0/0
*Sep 23 19:35:47.459: OSPF: DR/BDR election . FastEthernet0/0
*Sep 23 19:35:47.459: OSPF: Elect BDR
1.1.1
.1
*Sep 23 19:35:47.463: OSPF: Elect DR 192.168.235.1
*Sep 23 19:35:47.463: OSPF: Elect BDR
1.1.1
.1
*Sep 23 19:35:47.463: OSPF: Elect DR 192.168.235.1
*Sep 23 19:35:47.463: DR: 192.168.235.1 (Id) BDR:
1.1.1
.1 (Id)
*Sep 23 19:35:47.535: OSPF: Rcv DBD from 192.168.235.1 . FastEthernet0/0 seq 0x1921 opt 0x52 flag 0x7 len 32 mtu 1500 state EXSTART
*Sep 23 19:35:47.535: OSPF: NBR Negotiation Done. We are the SLAVE
*Sep 23 19:35:47.583: OSPF: Rcv DBD from 192.168.235.1 . FastEthernet0/0 seq 0x1922 opt 0x52 flag 0x3 len 52 mtu 1500 state EXCHANGE
*Sep 23 19:35:47.583: OSPF: Send DBD to 192.168.235.1 . FastEthernet0/0 seq 0x1922 opt 0x52 flag 0x0 len 32
*Sep 23 19:35:47.587: OSPF: sent LS REQ packet to 192.168.10.2, length 12
*Sep 23 19:35:47.607: OSPF: Exchange Done with 192.168.235.1 . FastEthernet0/0
*Sep 23 19:35:47.611: OSPF: Synchronized with 192.168.235.1 . FastEthernet0/0, state FULL
*Sep 23 19:35:47.611: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.235.1 . FastEthernet0/0 from LOADING to FULL, Loading Done
向DR返回LS Acknowlege報文,LSDB達到同步。Full狀態
*Sep 23 19:35:47.967: OSPF: Build router LSA for area 0, router ID
1.1.1
.1, seq 0x80000002
*Sep 23 19:35:53.347: OSPF: Build router LSA for area 0, router ID
1.1.1
.1, seq 0x80000005
*Sep 23 19:35:57.419: OSPF: Neighbor change Event . interface FastEthernet0/0
*Sep 23 19:35:57.419: OSPF: DR/BDR election . FastEthernet0/0
*Sep 23 19:35:57.419: OSPF: Elect BDR
1.1.1
.1
*Sep 23 19:35:57.419: OSPF: Elect DR 192.168.235.1
*Sep 23 19:35:57.419: DR: 192.168.235.1 (Id) BDR:
1.1.1
.1 (Id)
若是是在DR上重啓OSPF進程的話,也大體相同,只是原來DR的位置會被BDR頂替上。
其實從進程開始重啓後,立刻已經開始了一輪DR競選。狀態爲Down
在hello包裏未發現本身的router-id,因此狀態變爲 INIT
重啓ospf進程後,當路由器啓動進程後,首先發送hello報文,構建一個空包BDR和DR的競選(BDR和DR的地址都是全0),並構建一個wait timer,在這時間內若是沒有收到域內DR/BDR的通告,就會發出通告說本身要參加競選啦。這裏的結果是收到了DR的通告(router-id:192.168.235.1是老的DR),而並沒BDR。
下一步,當與鄰居發生鄰接關係後(state :2WAY),發起本身的競選通告!前面指出,DR有了,BDR還沒人當呢,因此hello報文裏BDR部分就把本身的R-ID填上了。最後競選成功,當了BDR。
接下來進入EXSTART狀態。經過互相發送DBD報文,協商參數,決定了本身是從路由器身份。