OSPF中DR,BDR的选举_职场

实验目的:详细探究DR,BDR的选举过程。

先将R1,R2配置OSPF,过一段时间后再在R3上启用OSPF。


在R1上查看邻居表:

r1#
r1#show ip ospf ne
r1#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2            FULL/DR         00:00:36    192.168.12.2    Ethernet0/0
r1#


在R2上查看邻居表:

r2#
r2#show ip ospf ne
r2#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
1.1.1.1            FULL/BDR        00:00:31    192.168.12.1    Ethernet0/0
r2#

因为R2的router-id 2.2.2.2比R1的router-id 1.1.1.1大,在同一时间段内选举,故R2为DR,R1为BDR.


过一段时间后在R3上启用OSPF进程。

此时再查看邻居表:


R1的邻居表:
r1#
r1#
r1#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3            FULL/BDR        00:00:32    192.168.13.3    Ethernet0/1
2.2.2.2            FULL/DR         00:00:39    192.168.12.2    Ethernet0/0
r1#
r1#


R2的邻居表
r2#
r2#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3            FULL/BDR        00:00:36    192.168.23.3    Ethernet0/2
1.1.1.1            FULL/BDR        00:00:33    192.168.12.1    Ethernet0/0
r2#


R3的邻居表
r3#
r3#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2            FULL/DR         00:00:38    192.168.23.2    Ethernet0/2
1.1.1.1            FULL/DR         00:00:34    192.168.13.1    Ethernet0/1
r3#
r3#

 

在 192.168.13.0 (R1<------>R3)网段内,因为R1启用OSPF进程的时间早于R3,故在此网段内R1为DR,R3为BDR。
在 192.168.23.0 (R2<------>R3)网段内,因为R2启用OSPF进程的时间早于R3,故在此网段内R2为DR,R3为BDR。


Notice:

   路由器的优先级可以影响一个选取过程,但是它不能强制更换已经有效的DR或BDR路由器。也就是说,在已经选取了DR和BDR路由器后,如果一台具有更高优先级的路由器变为有效的,那么这台新的路由器将不会替换DR或BDR路由器的任何一台。


解决方法: 清理一下OSPF的进程,让OSPF重新选举

r1#
r1#clear ip ospf process
Reset ALL OSPF processes? [no]: y
r1#

r2#
r2#clear ip ospf process
Reset ALL OSPF processes? [no]: y
r2#

r3#
r3#clear ip ospf process
Reset ALL OSPF processes? [no]: y
r3#


此时,查看路由表:

r1#
r1#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3            FULL/DR         00:00:33    192.168.13.3    Ethernet0/1
2.2.2.2            FULL/DR         00:00:34    192.168.12.2    Ethernet0/0
r1#
————
r2#
r2#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
3.3.3.3            FULL/DR         00:00:37    192.168.23.3    Ethernet0/2
1.1.1.1            FULL/BDR        00:00:39    192.168.12.1    Ethernet0/0
r2#
————
r3#
r3#show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface
2.2.2.2            FULL/BDR        00:00:33    192.168.23.2    Ethernet0/2
1.1.1.1            FULL/BDR        00:00:34    192.168.13.1    Ethernet0/1
r3#