前文我们了解了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

  配置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

  配置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

  配置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

  在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;如下图

  提示:广播型网络MA和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

  在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
<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
<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
<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 ,此时优先级一样,会比较router id,router id谁大谁就是DR,次大者就为BDR,剩下没有被选举成DR或BDR的就沦为DRother;R4的router id为4.4.4.4 是4个路由器中最大的,所以R4当选DR,R3的router id为3.3.3.3 ,第二大,所以当选BDR;

HCNA Routing&Switching之动态路由协议OSPF DR和BDR的更多相关文章

  1. HCNA Routing&Switching之动态路由协议OSPF基础(一)

    前文我们了解了基于路径矢量算法的动态路由协议RIP防环以及度量值的修改相关话题,回顾请参考https://www.cnblogs.com/qiuhom-1874/p/15012895.html:今天我 ...

  2. HCNA Routing&Switching之动态路由协议OSPF建立邻居的条件

    前文我们了解了OSPF的router id.数据包结构.类型.不同类型的数据包作用以及OSPF状态机制,回顾请参考https://www.cnblogs.com/qiuhom-1874/p/15027 ...

  3. HCNA Routing&Switching之动态路由协议OSPF基础(二)

    前文我们主要了解了OSPF的区域.区域分类.路由器类型.OSPF的核心工作流程,回顾请参考:https://www.cnblogs.com/qiuhom-1874/p/15025533.html:今天 ...

  4. HCNA Routing&Switching之动态路由协议RIP

    前文我们了解了动态路由的基本概念,以及动态路由和静态路由的区别,优缺点,动态路由的分类,回顾请参考https://www.cnblogs.com/qiuhom-1874/p/14995317.html ...

  5. HCNP Routing&Switching之动态路由协议IS-IS基础

    前文我们了解了OSPF的特殊区域相关话题,回顾请参考https://www.cnblogs.com/qiuhom-1874/p/15236330.html:今天我们来聊一聊另一动态路由协议IS-IS相 ...

  6. HCNA Routing&Switching之动态路由基本概念

    前文我们了解了静态路由的相关话题,回顾请参考https://www.cnblogs.com/qiuhom-1874/p/14965433.html:今天我们来聊一聊动态路由相关概念: 首先我们要清楚什 ...

  7. HCNA Routing&Switching之OSPF度量值和基础配置命令总结

    前文我们了解了OSPF的网络类型,OSPF中的DR和BDR的选举规则.作用等相关话题,回顾请参考https://www.cnblogs.com/qiuhom-1874/p/15054938.html: ...

  8. HCNA Routing&Switching之OSPF缺省路由发布

    前文我们了解了OSPF的度量值,以及基础配置命令的总结,回顾请参考https://www.cnblogs.com/qiuhom-1874/p/15069632.html:今天我们来聊一聊在ospf里动 ...

  9. 1.4-动态路由协议OSPF⑥

    OSPF Network Type/网络类型     (Run Mode/运行模式) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 物理 ...

随机推荐

  1. YOLOv3和YOLOv4长篇核心综述(下)

    YOLOv3和YOLOv4长篇核心综述(下) 4.3.3 Neck创新 在目标检测领域,为了更好的提取融合特征,通常在Backbone和输出层,会插入一些层,这个部分称为Neck.相当于目标检测网络的 ...

  2. CSS 常见问题笔记

    CSS 常见问题 布局 一.盒模型宽度计算 问题:div1 的 offsetWidth 是多少? <style> #div1 { width: 100px; padding: 10px; ...

  3. java8 函数式编程接口

    java8 函数式接口java.util.function.* @param T 入参类型 @param R 出参类型 1. Function <T,R> 例: Function<I ...

  4. 权限管理(基本权限、附加权限、ACL权限)

    基本权限 •访问方式(权限) 读取:允许查看内容-read   r 写入:允许修改内容-write    w 可执行:允许运行和切换-execute  x 对于文本文件 r: cat   head  ...

  5. 【NX二次开发】镜像对象

    使用uf5946获取镜像矩阵注意:uf5946镜像这个函数,只能用#define UF_plane_type=46这种类型的数据作为镜像面,不能用#define UF_datum_plane_type ...

  6. DFS————从普及到IOI(暴力骗分小能手)

    DFS 啦啦啦,再来水一波 先说思想吧! 背景: 深度优先搜索算法(英语:Depth-First-Search,简称DFS)是一种用于遍历或搜索树或图的算法. ----来自度娘 一.思想 DFS算法思 ...

  7. Python分析44130条用户观影数据,挖掘用户与电影之间的隐藏信息!

    01.前言 很多电影也上映,看电影前很多人都喜欢去 『豆瓣』 看影评,所以我爬取44130条 『豆瓣』 的用户观影数据,分析用户之间的关系,电影之间的联系,以及用户和电影之间的隐藏关系. 02.爬取观 ...

  8. Windows下安装kubectl及Node和Pod操作常用命令

    kubernetes通过kube-apiserver作为整个集群管理的入口.Apiserver是整个集群的主管理节点,用户通过Apiserver配置和组织集群,同时集群中各个节点同etcd存储的交互也 ...

  9. mycat高可用-安全管理-监控 看这一篇就够了

    ​ 在之前的操作中,我们已经实现了mysql机器的高可用,可以动态切换master,那么如果mycat崩溃了呢?我们应该如何处理呢?所以此时就需要搭建mycat的高可用集群了. ​ 在mycat的权威 ...

  10. Springboot:Springboot+mysql5.7搭建服务,超过8小时连接mysql失败

    报错信息 2017-03-12 03:00:02.539 ERROR 9311 --- [nio-9000-exec-4] o.a.c.c.C.[.[.[/].[dispatcherServlet] ...