前文我们了解了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. 与现代传感器的接口:轮询ADC驱动程序

    与现代传感器的接口:轮询ADC驱动程序 Interfacing with modern sensors: Polled ADC drivers 我们研究了在现代嵌入式应用程序中,开发人员应该如何创建一 ...

  2. 教你三种jQuery框架实现元素显示及隐藏动画方式

    摘要:在jQuery框架中对元素对象进行显示和隐藏有三种方式,分别是"默认方式显示和隐藏"."滑动方式显示和隐藏"."淡入淡出显示和隐藏". ...

  3. Task06:综合练习

    练习一: 各部门工资最高的员工(难度:中等) 创建Employee 表,包含所有员工信息,每个员工有其对应的 Id, salary 和 department Id. +----+-------+--- ...

  4. 解Bug之路-ZooKeeper集群拒绝服务

    解Bug之路-ZooKeeper集群拒绝服务 前言 ZooKeeper作为dubbo的注册中心,可谓是重中之重,线上ZK的任何风吹草动都会牵动心弦.最近笔者就碰到线上ZK Leader宕机后,选主无法 ...

  5. 题解 P6622 [省选联考 2020 A/B 卷] 信号传递

    洛谷 P6622 [省选联考 2020 A/B 卷] 信号传递 题解 某次模拟赛的T2,考场上懒得想正解 (其实是不会QAQ), 打了个暴力就骗了\(30pts\) 就火速溜了,参考了一下某位强者的题 ...

  6. Winform中只运行运行一个实例的方法

    在Program类的main方法按如下代码编写即可 1 static void Main() 2 { 3 if (Process.GetProcessesByName(Process.GetCurre ...

  7. 音视频点播服务基础系列(Fmpeg常用命令)

    前言 公司业务中有一些场景需要用到服务端音视频剪辑技术,最开始为了快速上线使用的是某公有云的商用解决方案,但由于费用太高所以我们团队经过一个星期的冲刺,给出了一个FFmpeg+Serverless的解 ...

  8. Netty 框架学习 —— 编解码器框架

    编解码器 每个网络应用程序都必须定义如何解析在两个节点之间来回传输的原始字节,以及如何将其和目标应用程序的数据格式做相互转换.这种转换逻辑由编解码器处理,编解码器由编码器和解码器组成,它们每种都可以将 ...

  9. Java安全之反序列化回显与内存马

    Java安全之反序列化回显与内存马 0x00 前言 按照我个人的理解来说其实只要能拿到Request 和 Response对象即可进行回显的构造,当然这也是众多方式的一种.也是目前用的较多的方式.比如 ...

  10. string转char*/char[]

    转char* 主要有三种方法可以将str转换为char*类型,分别是:data(); c_str(); copy(); 1.data() data()仅返回字符串内容,而不含有结束符'\0' std: ...