LAB1:OSPF DR选举测试试验

使用场合:
在以太网络中,如果
OSPF
路由器很多,那么他们更新
LSA
的次数要达到n(n-1)/2次数,很明显,这样一个更新的次数浪费带宽,消耗路由器的开销,所以为了提高效率,我们要在整个
ethernet
网络中选择出一个
DR
,所有路由器向
DR
更新,提高效率。
BDR
作为
DR
备份的路由器。
试验需求:
测试
DR
选举,
DR
的选举规则如下:
Wait-time
优先级
Router-ID
基本配置:
R1
router ospf 1
router-id 1.1.1.1
log-adjacency-changes
network 123.1.1.1 0.0.0.0 area 0
R2
router ospf 1
router-id 2.2.2.2
log-adjacency-changes
network 123.1.1.2 0.0.0.0 area 0
R3
router ospf 1
router-id 3.3.3.3
log-adjacency-changes
network 123.1.1.3 0.0.0.0 area 0
查看
DR,
从下面信息中我们看到
DR
是
R3
R3#show ip os int e0/0
Ethernet0/0 is up, line protocol is up
Internet Address 123.1.1.3/24, Area 0
Process ID 1, Router ID 3.3.3.3, Network Type BROADCAST, Cost: 10
Transmit Delay is 1 sec, State DR, Priority 1
Designated Router (ID) 3.3.3.3, Interface address 123.1.1.3
Backup Designated router (ID) 2.2.2.2, Interface address 123.1.1.2
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:09
Supports Link-local Signaling (LLS)
Index 1/1, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 2
Last flood scan time is 0 msec, maximum is 4 msec
Neighbor Count is 2, Adjacent neighbor count is 2
Adjacent with neighbor 1.1.1.1
Adjacent with neighbor 2.2.2.2 (Backup Designated Router)
Suppress hello for 0 neighbor(s)
那么我们测试是否是选择
Router-ID
最大的作为
DR
?
接下来我们清除
R3 OSPF
邻居,让它重新收敛。发现
DR
变为
R2
R3
#
clear ip ospf process
R3#show ip os int e0/0
Ethernet0/0 is up, line protocol is up
Internet Address 123.1.1.3/24, Area 0
Process ID 1, Router ID 3.3.3.3, Network Type BROADCAST, Cost: 10
Transmit Delay is 1 sec, State BDR, Priority 1
Designated Router (ID) 2.2.2.2, Interface address 123.1.1.2
Backup Designated router (ID) 3.3.3.3, Interface address 123.1.1.3
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:06
Supports Link-local Signaling (LLS)
Index 1/1, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 0, maximum is 2
Last flood scan time is 4 msec, maximum is 4 msec
Neighbor Count is 2, Adjacent neighbor count is 2
Adjacent with neighbor 1.1.1.1
Adjacent with neighbor 2.2.2.2 (Designated Router)
Suppress hello for 0 neighbor(s)
那么是否是先启动
OSPF
的路由器作为
DR
?
结论:
并不是先启动
OSPF
进程的路由器就是
DR
,而是有一个时间间隔让路由器来等待其他路由器,在这个时间间隔内,路由器相互监听
Hello
包中的
DR
和
DBR
字段中的信息,并且服从优先级原则。这个时间间隔和
dead interval
时间是相同的
40S
。
但是在实际的网络中,即使是
40
秒内同时起进程的情况也少见;实际情况下是率先启用
ospf
进程的路由器就很有可能成为
DR
,第二个启动的就很有可能成为
BDR
,所以这个地方可能很多人误解为先启动
OSPF
进程的路由器作为
DR
总结:
如果
wait-time
时间内没有收到
HELLO
包,那么肯定是先配置的
OSPF
为
DR
,
DR
不抢占,所以不一定就是
router-id
大的是
DR
。
如果在
40S
时间内大家
OSPF
都起来了,那么一般就是
ROUTER-ID
大的是
DR
接下来,更改优先级,
R1
为
255
,
R2
为
100
,
R3
默认
1
R1
interface Ethernet0/0
ip address 123.1.1.1 255.255.255.0
ip ospf priority 255
R2
R2(config-router)#int e0/0
R2(config-if)#ip os priority 100
查看
R1
现在是否为
DR
R1#show ip os int e0/0
Ethernet0/0 is up, line protocol is up
Internet Address 123.1.1.1/24, Area 0
Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 10
Transmit Delay is 1 sec, State DR, Priority 255
Designated Router (ID) 1.1.1.1, Interface address 123.1.1.1
Backup Designated router (ID) 2.2.2.2, Interface address 123.1.1.2
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:02
Supports Link-local Signaling (LLS)
Index 1/1, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 2
Last flood scan time is 0 msec, maximum is 4 msec
Neighbor Count is 2, Adjacent neighbor count is 2
Adjacent with neighbor 2.2.2.2 (Backup Designated Router)
Adjacent with neighbor 3.3.3.3
Suppress hello for 0 neighbor(s)