HCNA Routing&Switching之動態路由協議OSPF DR和BDR


  前文我們了解了OSPF建立鄰居關系的條件,回顧請參考https://www.cnblogs.com/qiuhom-1874/p/15032907.html;今天我們來聊一聊OSPF中的DR和BDR;

  在說DR和BDR之前我們先來了解下OSPF的網絡類型;

  首先OSPF的網絡類型是基於接口來划分,其次OSPF的網絡類型是通過接口的二層封裝報文的方式進行了划分,默認情況下OSPF把接口二層是以太網封裝的網絡稱為廣播類型,把接口二層是PPP或者HDLC封裝的網絡稱為點到點類型;

  在生活中,廣播就是一個人說話,在同一個房間里的其他人都可以聽到;在網絡里,廣播和這個類似;一個網絡設備在一個廣播域發送一條廣播報文,在同一個廣播域的所有設備都能收到該設備的廣播;這樣一來我們要想和其中的一台設備通訊怎么通訊呢?在二層為以太網封裝的廣播類型網絡里,它是通過二層以太網封裝目標MAC和源MAC;其原因是ip地址是變化的,如果單純的使用ip地址不能夠准確的標識某一台設備(因為ip地址是變化的),而MAC地址是設備的硬件地址,這個地址是設備出廠時就固定了,況且不會發生變化;所以確定一台設備的唯一性,我們可以通過MAC地址;有了通信雙方的mac地址再結合三層的ip地址,我們就可以准確的將對應數據包發送給對方;

  對於點到點類型的網絡,其二層就不需要封裝MAC地址,一條鏈路上就只有兩個端點,在A端點發送數據B端點就一定能收到;

  提示:廣播類型的接口是以太網類型接口(就是我們常常看到的網口),而點到點類型的接口是串口;

  在點對點類型的網絡中,基於接口封裝的不同又可以分非廣播多路訪問和點到多點,如下圖

  提示:默認情況下,OSPF認為幀中繼(FR)、異步傳輸(ATM)的網絡類型為NBMA;在幀中繼網絡里非廣播多路訪問和以太網中的廣播類型,兩者有一個相同的特點,就是都可以接多個設備;不同點是以太網二層封裝需要封裝mac地址,支持廣播發送,而幀中繼網絡二層不需要封裝mac地址,其原因是它不支持廣播;不支持廣播就意味着在ospf里不支持組播;不支持組播也就是說幀中繼網絡里,ospf只能通過單播的方式建立鄰居;

  實驗:如下圖兩個拓撲,R1和R2為以太網類型接口,R3和R4為串口接口,在兩個實驗環境中配置ospf,抓包看看兩者發送到hello包有什么不同

  配置R1

sys
sys R1
int g0/0/0
ip add 12.0.0.1 24
ospf 1 router-id 1.1.1.1
area 0
net 12.0.0.1 0.0.0.0
dis ip int b
View Code

  配置R2

sys
sys R2
int g0/0/0
ip add 12.0.0.2 24
ospf 1 router-id 2.2.2.2
area 0
net 12.0.0.2 0.0.0.0
dis ip int b
View Code

  配置R3

sys
sys R3
int s4/0/0
ip add 34.0.0.3 24
ospf 1 router-id 3.3.3.3
area 0
net 34.0.0.3 0.0.0.0
dis ip int b
View Code

  配置R4

sys
sys R4
int s4/0/0
ip add 34.0.0.4 24
ospf 1 router-id 4.4.4.4
area 0
net 34.0.0.4 0.0.0.0
dis ip int b
View Code

  在R1或R2上抓包

  在R3或R4上抓包

  提示:默認情況串口鏈路的二層封裝為ppp類型,這里抓包就選擇ppp鏈路類型即可;

  提示:從上面的抓包情況可以看到,在以太網封類型的網絡環境下抓包,其二層封裝了目標mac和源mac,而在點到點類型的網絡環境下抓包,其二層就不是使用以太網協議而是用ppp協議,並且數據包里面也沒有封裝mac地址;

  驗證:查看對應ospf網絡類型

  在R1或R2上驗證相關接口的網絡類型

  在R3或R4上驗證相關接口的網絡類型

  更改R3的s4/0/0的鏈路封裝為FR,看看對應的接口類型是什么

  提示:可以看到修改了R3的s4/0/0接口的封裝為FR以后,對應ospf就down掉了;並且對應接口的類型就變為了NBMA(非廣播多路訪問);

  OSPF DR和BDR

  DR和BDR的作用

  在上述的網絡類型中,在多路訪問網絡類型中跑OSPF,每個路由器都會和其他路由器建立鄰居,一個路由器發送一條鏈路更新,其他路由器都會跟着確認,這樣一來,每個路由器都要經過兩兩的交互和確認,在一定程度上會帶來路由器的性能的開銷(hello包,DD,LSR,LSU,LSACK這些包過多,增加路由器的處理壓力,從而導致路由器的性能降低);為了降低數據包的交換,在OSPF中會選舉DR和BDR;如下圖

  提示:廣播型網絡BMA和NBMA網絡中,為了減少鄰接關系的數量,從而減少數據包交換,次數,最終節省帶寬,降低對路由器處理能力的壓力,選舉DR和BDR。

  相關術語概述

  DR:Designed Router,指定路由器,類似班長、總經理;

  BDR:Backup DR,備用DR,類似副班長、副總經理;

  DRouthers:類似普通學生、普通員工;

  三者的關系:DR、BDR、DRothers之間都保持鄰接關系(Full),DRothers之間保持鄰居關系(Two-Way);

  通信地址:224.0.0.6向DR和BDR發送鏈路狀態更新,224.0.0.5向所有OSPF路由器發送;

  DR選舉規則

  1、首先比較Hello報文中攜帶的優先級,優先級范圍是0-255,默認情況下都是1;優先級最高的被選舉為DR,優先級次高的被選舉為BDR;優先級為0的不參與選舉;

  2、如果優先級相同的情況下,比較router id大小,router id越大越優先;

  3、選舉不具有搶占性,除非當DR和BDR都失效或重啟OSPF進程;

  提示:DRothers的LSU向DR或BDR通過224.0.0.6發送,然后DR收到DRothers發送到LSU以后,會將對應的LSU通過224.0.0.5向其他路由器發送,其他路由器收到DR發送LSU以后,BDR向224.0.0.5直接確認,而DBothers則通過224.0.0.6向DR確認;總結一句話就是從DR或BDR發出的數據包都是發往224.0.0.5,DR和BDR都會監聽224.0.0.6這個地址;DRothers發出的數據會通過224.0.0.6向DR或BDR發送;

  實驗:如下圖,全網運行ospf,看看對應的數據包會這么發送,對應路由器之間是什么關系

  配置R1

sys
sys R1
int g0/0/0
ip add 1.0.0.1 24
ospf 1 router-id 1.1.1.1
a 0
net 1.0.0.0 0.0.0.255
dis ip int b
dis ospf peer brief
View Code

  在R1上查看g0/0/0的接口信息,看看誰是DR和BDR

  提示:可以看到只配置了R1上的OSPF以后,對應DR就是它自己,因為此時沒有其他設備和它競選DR,所以只有它是DR;對於BDR來說,它不知道,因為目前就只有它自己在ospf里面,沒有看到其他設備;

  配置R2

sys
sys R2
int g0/0/0
ip add 1.0.0.2 24
ospf 1 router-id 2.2.2.2
a 0
net 1.0.0.0 0.0.0.255
dis ip int b
dis ospf peer brief
View Code
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R2
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 1.0.0.2 24
[R2-GigabitEthernet0/0/0]ospf 1 rout
Jul 24 2021 12:08:39-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R2-GigabitEthernet0/0/0]ospf 1 router-id 2.2.2.2
[R2-ospf-1]a 0
[R2-ospf-1-area-0.0.0.0]net 1.0.0.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 2
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 2
The number of interface that is DOWN in Protocol is 2

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              1.0.0.2/24           up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s)     
[R2-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:08:44-08:00 R2 %%01OSPF/4/NBR_CHANGE_E(l)[1]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.1, NeighborEvent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init) 
[R2-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:08:44-08:00 R2 %%01OSPF/4/NBR_CHANGE_E(l)[2]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.1, NeighborEvent=2WayReceived, NeighborPreviousState=Init, NeighborCurrentState=2Way) 
[R2-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:08:44-08:00 R2 %%01OSPF/4/NBR_CHANGE_E(l)[3]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.1, NeighborEvent=AdjOk?, NeighborPreviousState=2Way, NeighborCurrentState=ExStart) 
[R2-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:08:44-08:00 R2 %%01OSPF/4/NBR_CHANGE_E(l)[4]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.1, NeighborEvent=NegotiationDone, NeighborPreviousState=ExStart, NeighborCurrentState=Exchange) 
[R2-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:08:44-08:00 R2 %%01OSPF/4/NBR_CHANGE_E(l)[5]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.1, NeighborEvent=ExchangeDone, NeighborPreviousState=Exchange, NeighborCurrentState=Loading) 
[R2-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:08:44-08:00 R2 %%01OSPF/4/NBR_CHANGE_E(l)[6]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.1, NeighborEvent=LoadingDone, NeighborPreviousState=Loading, NeighborCurrentState=Full) 
[R2-ospf-1-area-0.0.0.0]dis ospf peer brief

         OSPF Process 1 with Router ID 2.2.2.2
                  Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.0          GigabitEthernet0/0/0             1.1.1.1          Full        
 ----------------------------------------------------------------------------
[R2-ospf-1-area-0.0.0.0]

  提示:可以看到當R2配置好ospf以后,它會和R1先建立其鄰接關系;

  再次在R1上查看g0/0/0的接口信息,看看此時誰是DR和BDR

  提示:此時可以看到DR是R1的接口ip地址,BDR是R2的接口地址;

  配置R3

sys
sys R3
int g0/0/0
ip add 1.0.0.3 24
ospf 1 router-id 3.3.3.3
a 0
net 1.0.0.0 0.0.0.255
dis ip int b
dis ospf peer brief
View Code
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R3
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 1.0.0.3 24
Jul 24 2021 12:14:41-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R3-GigabitEthernet0/0/0]ospf 1 router-id 3.3.3.3
[R3-ospf-1]a 0
[R3-ospf-1-area-0.0.0.0]net 1.0.0.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 2
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 2
The number of interface that is DOWN in Protocol is 2

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              1.0.0.3/24           up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s)     
[R3-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:14:45-08:00 R3 %%01OSPF/4/NBR_CHANGE_E(l)[1]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.1, NeighborEvent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init) 
[R3-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:14:45-08:00 R3 %%01OSPF/4/NBR_CHANGE_E(l)[2]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.1, NeighborEvent=2WayReceived, NeighborPreviousState=Init, NeighborCurrentState=2Way) 
[R3-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:14:46-08:00 R3 %%01OSPF/4/NBR_CHANGE_E(l)[3]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=2.0.0.1, NeighborEvent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init) 
[R3-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:14:46-08:00 R3 %%01OSPF/4/NBR_CHANGE_E(l)[4]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=2.0.0.1, NeighborEvent=2WayReceived, NeighborPreviousState=Init, NeighborCurrentState=2Way) 
[R3-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:14:46-08:00 R3 %%01OSPF/4/NBR_CHANGE_E(l)[5]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.1, NeighborEvent=AdjOk?, NeighborPreviousState=2Way, NeighborCurrentState=ExStart) 
[R3-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:14:46-08:00 R3 %%01OSPF/4/NBR_CHANGE_E(l)[6]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=2.0.0.1, NeighborEvent=AdjOk?, NeighborPreviousState=2Way, NeighborCurrentState=ExStart) 
[R3-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:14:46-08:00 R3 %%01OSPF/4/NBR_CHANGE_E(l)[7]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.1, NeighborEvent=NegotiationDone, NeighborPreviousState=ExStart, NeighborCurrentState=Exchange) 
[R3-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:14:46-08:00 R3 %%01OSPF/4/NBR_CHANGE_E(l)[8]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=2.0.0.1, NeighborEvent=NegotiationDone, NeighborPreviousState=ExStart, NeighborCurrentState=Exchange) 
[R3-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:14:46-08:00 R3 %%01OSPF/4/NBR_CHANGE_E(l)[9]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.1, NeighborEvent=ExchangeDone, NeighborPreviousState=Exchange, NeighborCurrentState=Loading) 
[R3-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:14:46-08:00 R3 %%01OSPF/4/NBR_CHANGE_E(l)[10]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.1, NeighborEvent=LoadingDone, NeighborPreviousState=Loading, NeighborCurrentState=Full) 
[R3-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:14:46-08:00 R3 %%01OSPF/4/NBR_CHANGE_E(l)[11]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=2.0.0.1, NeighborEvent=ExchangeDone, NeighborPreviousState=Exchange, NeighborCurrentState=Loading) 
[R3-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:14:46-08:00 R3 %%01OSPF/4/NBR_CHANGE_E(l)[12]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=2.0.0.1, NeighborEvent=LoadingDone, NeighborPreviousState=Loading, NeighborCurrentState=Full) 
[R3-ospf-1-area-0.0.0.0]dis ospf peer brief

         OSPF Process 1 with Router ID 3.3.3.3
                  Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.0          GigabitEthernet0/0/0             1.1.1.1          Full        
 0.0.0.0          GigabitEthernet0/0/0             2.2.2.2          Full        
 ----------------------------------------------------------------------------
[R3-ospf-1-area-0.0.0.0]

  提示:可以看到當R3配置好以后,對應R3和R1和R2都建立起鄰接關系;

  查看R3g0/0/0接口信息,看看DR和BDR變化沒有?

  提示:之所以DR和BDR沒有發生變化,其原因是ospf已經選好了DR和BDR,而DR和BDR的選舉是非搶占性,一旦選好,就不變了,除非重啟ospf進程(所有路由器)來觸發DR和BDR的重新選舉;

  配置R4

sys
sys R4
int g0/0/0
ip add 1.0.0.4 24
ospf 1 router-id 4.4.4.4
a 0
net 1.0.0.0 0.0.0.255
dis ip int b
dis ospf peer brief
View Code
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R4
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 1.0.0.4 24
Jul 24 2021 12:20:57-08:00 R4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R4-GigabitEthernet0/0/0]ospf 1 router-id 4.4.4.4
[R4-ospf-1]a 0
[R4-ospf-1-area-0.0.0.0]net 1.0.0.0 0.0.0.255
[R4-ospf-1-area-0.0.0.0]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 2
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 2
The number of interface that is DOWN in Protocol is 2

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              1.0.0.4/24           up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s)     
[R4-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:21:02-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[1]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=2.0.0.1, NeighborEvent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init) 
[R4-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:21:02-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[2]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=2.0.0.1, NeighborEvent=2WayReceived, NeighborPreviousState=Init, NeighborCurrentState=2Way) 
[R4-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:21:02-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[3]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=2.0.0.1, NeighborEvent=AdjOk?, NeighborPreviousState=2Way, NeighborCurrentState=ExStart) 
[R4-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:21:02-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[4]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=2.0.0.1, NeighborEvent=NegotiationDone, NeighborPreviousState=ExStart, NeighborCurrentState=Exchange) 
[R4-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:21:02-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[5]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=2.0.0.1, NeighborEvent=ExchangeDone, NeighborPreviousState=Exchange, NeighborCurrentState=Loading) 
[R4-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:21:02-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[6]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=2.0.0.1, NeighborEvent=LoadingDone, NeighborPreviousState=Loading, NeighborCurrentState=Full) 
[R4-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:21:04-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[7]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.1, NeighborEvent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init) 
[R4-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:21:04-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[8]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.1, NeighborEvent=2WayReceived, NeighborPreviousState=Init, NeighborCurrentState=2Way) 
[R4-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:21:04-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[9]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.1, NeighborEvent=AdjOk?, NeighborPreviousState=2Way, NeighborCurrentState=ExStart) 
[R4-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:21:05-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[10]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.1, NeighborEvent=NegotiationDone, NeighborPreviousState=ExStart, NeighborCurrentState=Exchange) 
[R4-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:21:05-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[11]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.1, NeighborEvent=ExchangeDone, NeighborPreviousState=Exchange, NeighborCurrentState=Loading) 
[R4-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:21:05-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[12]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=1.0.0.1, NeighborEvent=LoadingDone, NeighborPreviousState=Loading, NeighborCurrentState=Full) 
[R4-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:21:06-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[13]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=3.0.0.1, NeighborEvent=HelloReceived, NeighborPreviousState=Down, NeighborCurrentState=Init) 
[R4-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:21:06-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[14]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=3.0.0.1, NeighborEvent=2WayReceived, NeighborPreviousState=Init, NeighborCurrentState=2Way) 
[R4-ospf-1-area-0.0.0.0]dis ospf peer brief
Jul 24 2021 12:21:06-08:00 R4 %%01OSPF/4/NBR_CHANGE_E(l)[15]:Neighbor changes event: neighbor status changed. (ProcessId=256, NeighborAddress=3.0.0.1, NeighborEvent=AdjOk?, NeighborPreviousState=2Way, NeighborCurrentState=2Way) 
[R4-ospf-1-area-0.0.0.0]dis ospf peer brief

         OSPF Process 1 with Router ID 4.4.4.4
                  Peer Statistic Information
 ----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.0          GigabitEthernet0/0/0             1.1.1.1          Full        
 0.0.0.0          GigabitEthernet0/0/0             2.2.2.2          Full        
 0.0.0.0          GigabitEthernet0/0/0             3.3.3.3          2-Way       
 ----------------------------------------------------------------------------
[R4-ospf-1-area-0.0.0.0]

  提示:可以看到當R4配置好以后,對應R4和R1(DR),R2(BDR)是鄰接關系;而和R3(DRothers)建立的鄰居關系;

  驗證:在R1上發布更新,抓包看看對應的數據包會怎么發送和確認?

  提示:可以看到當R1(DR)發送LSU時,它會直接向224.0.0.5發送;其中R2(BDR)向224.0.0.5確認;R3(DRothers)和R4(DRothers)向224.0.0.6確認;

  驗證:在R2上發送LSU,看看對應數據包會這么發送和確認的呢?

  提示:可以看到當R2(BDR)發送LSU時,它和R1發送LSU一樣直接向224.0.0.5發送LSU,對應R1(DR)直接向224.0.0.5確認;R3、R4(DRother)向224.0.0.6確認;

  驗證:當R3發送LSU,看看對應數據包會這么發送和確認呢?

  提示:可以看到當R3(DRother)發送LSU時,它首先會把LSU通過224.0.0.6向R1(DR)發送,當R1(DR)收到R3發送的LSU,它會通過224.0.0.5向其他路由器發送LSU(不會再發送給R3);R2(BDR)收到LSU向224.0.0.5確認,R4(DRother)向224.0.0.6確認;

  驗證:當R4 發送LSU時,看看對應數據包會怎么發送和確認呢?

  提示:可以看到R4(DRother)發送LSU和R3(DRother)發送LSU一樣;首先它會把LSU發送給R1(DR),然后由R1(DR)再向其他路由器發送LSU;BDR(R2)直接向224.0.0.5確認;DRother(R3)向224.0.0.6確認;

  驗證:全網重啟ospf進程,看看對應的DR和BDR是否會重新選舉?

  提示:可以看到4個路由器分別重新啟動了ospf以后,重置ospf 進程以后,R4當選為DR,R3當選為BDR;因為重啟ospf進程對應的鄰居和鄰接關系又重新建立,此時4個路由器首先會比較對應的hello包里的優先級,默認情況下優先級都是1 ,此時優先級一樣,會比較對應接口的ip地址誰大誰就是DR,次大者就為BDR,剩下沒有被選舉成DR或BDR的就淪為DRother;R4的router id 為4.4.4.4,是4個路由器中最大的,所以R4當選DR,R3的router id為3.3.3.3 ,第二大,所以當選BDR;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM