
华为OSPF路由中DR选择配置示例
1、组网需求
图1 OSPF中DR选择组网示例图
如上图1所示,部署OSPF协议的网络中有五台交换机,其中Switch作为二层交换机连接其他运行OSPF协议的四台交换机。
由于之前四台设备之间缺省选举的DR不符合网络需求,现在需要让SwitchA被选举为DR来和OSPF网络其他设备交互LSA信息,而SwitchC则作为SwitchA的备份。而SwitchB由于其他业务需要,只能让它通过DR来与OSPF网络其他设备交互LSA信息。
2、配置思路
2.1、在各交换机上配置OSPF的基本功能,查看四台交换机之间缺省的DR的选举情况。
2.2、配置SwitchA对应接口的DR优先级为100,SwitchB对应接口的DR优先级为0,SwitchC2.3、对应接口的DR优先级为2,使得SwitchA被选举为DR,SwitchC被选举为BDR,SwitchB永远无法成为DR或BDR,而SwitchD采用缺省DR优先级,维持原状不变。
3、操作步骤
3.1、配置各接口所属的VLAN
# 配置SwitchA。Switch、SwitchB、SwitchC和SwitchD的配置与SwitchA类似。
<HUAWEI> system-view
[HUAWEI] sysname SwitchA
[SwitchA] vlan batch 10
[SwitchA] interface gigabitethernet 1/0/1
[SwitchA-GigabitEthernet1/0/1] port
link-type trunk
[SwitchA-GigabitEthernet1/0/1] port trunk
allow-pass vlan 10
[SwitchA-GigabitEthernet1/0/1] quit
3.2、配置各VLANIF接口的IP地址
# 配置SwitchA。SwitchB、SwitchC和SwitchD的配置与SwitchA类似。
[SwitchA] interface vlanif 10
[SwitchA-Vlanif10] ip address 192.168.1.1
24
[SwitchA-Vlanif10] quit
3.3、配置OSPF基本功能
# 配置SwitchA。
[SwitchA] ospf 1 router-id 10.1.1.1
[SwitchA-ospf-1] area 0
[SwitchA-ospf-1-area-0.0.0.0] network
192.168.1.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] quit
[SwitchA-ospf-1] quit
# 配置SwitchB。
[SwitchB] ospf 1 router-id 10.2.2.2
[SwitchB-ospf-1] area 0
[SwitchB-ospf-1-area-0.0.0.0] network
192.168.1.0 0.0.0.255
[SwitchB-ospf-1-area-0.0.0.0] quit
[SwitchB-ospf-1] quit
# 配置SwitchC。
[SwitchC] ospf 1 router-id 10.3.3.3
[SwitchC-ospf-1] area 0
[SwitchC-ospf-1-area-0.0.0.0] network
192.168.1.0 0.0.0.255
[SwitchC-ospf-1-area-0.0.0.0] quit
[SwitchC-ospf-1] quit
# 配置SwitchD。
[SwitchD] ospf 1 router-id 10.4.4.4
[SwitchD-ospf-1] area 0
[SwitchD-ospf-1-area-0.0.0.0] network
192.168.1.0 0.0.0.255
[SwitchD-ospf-1-area-0.0.0.0] quit
[SwitchD-ospf-1] quit
[SwitchD] quit
# SwitchA上查看OSPF邻居的信息。
[SwitchA] display ospf peer
OSPF Process 1 with Router ID 10.1.1.1
Neighbors
Area
0.0.0.0 interface 192.168.1.1(Vlanif10)'s neighbors
Router ID: 10.2.2.2 Address: 192.168.1.2
State: 2-Way Mode:Nbr is
Master Priority: 1
DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0
Dead timer due in 32 sec
Retrans timer interval: 5
Neighbor is up for 00:04:21
Authentication Sequence: [ 0 ]
Router ID: 10.3.3.3 Address: 192.168.1.3
State: Full
Mode:Nbr is Master Priority: 1
DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0
Dead timer due in 37 sec
Retrans timer interval: 5
Neighbor is up for 00:04:06
Authentication Sequence: [ 0 ]
Router ID: 10.4.4.4 Address: 192.168.1.4
State: Full
Mode:Nbr is Master Priority: 1
DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0
Dead timer due in 37 sec
Retrans timer interval: 5
Neighbor is up for 00:03:53
Authentication Sequence: [ 0 ]
从以上回显中可以看到在缺省情况下SwitchD为DR,SwitchC为BDR。这是因为当DR优先级相同时,Router-ID高的被选举为DR。
3.4、配置交换机接口上的DR优先级
# 配置SwitchA。
[SwitchA] interface vlanif 10
[SwitchA-Vlanif10] ospf dr-priority 100
[SwitchA-Vlanif10] quit
[SwitchA] quit
# 配置SwitchB。
[SwitchB] interface vlanif 10
[SwitchB-Vlanif10] ospf dr-priority 0
[SwitchB-Vlanif10] quit
[SwitchB] quit
# 配置SwitchC。
[SwitchC] interface vlanif 10
[SwitchC-Vlanif10] ospf dr-priority 2
[SwitchC-Vlanif10] quit
[SwitchC] quit
# 在SwitchD上查看OSPF邻居的信息。
<SwitchD> display ospf peer
OSPF Process 1 with Router ID 10.4.4.4
Neighbors
Area
0.0.0.0 interface 192.168.1.4(Vlanif10)'s neighbors
Router ID: 10.1.1.1 Address: 192.168.1.1
State: Full Mode:Nbr is Slave
Priority: 100
DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0
Dead timer due in 31 sec
Retrans timer interval: 5
Neighbor is up for 00:11:17
Authentication Sequence: [ 0 ]
Router ID: 10.2.2.2 Address: 192.168.1.2
State: Full Mode:Nbr is Slave
Priority: 0
DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0
Dead timer due in 35 sec
Retrans timer interval: 5
Neighbor is up for 00:11:19
Authentication Sequence: [ 0 ]
Router ID: 10.3.3.3 Address: 192.168.1.3
State: Full Mode:Nbr is Slave
Priority: 2
DR: 192.168.1.4 BDR: 192.168.1.3 MTU: 0
Dead timer due in 33 sec
Retrans timer interval: 5
Neighbor is up for 00:11:15
Authentication Sequence: [ 0 ]
通过以上回显信息发现四台交换机之间DR的选举情况并没有改变。这是因为如果DR、BDR已经选择完毕,当一台新设备加入后,即使它的DR优先级值最大,也不会立即成为该网段中的DR,只有重启OSPF进程之后才会重新选举DR和BDR。
3.5、重启OSPF进程
# 在各交换机的用户视图下,同时执行命令reset
ospf 1 process,以重启OSPF进程。同时重启OSPF进程是为了让四台交换机都参与DR和BDR的选举过程。
# 重启SwitchA
<SwitchA> reset ospf 1 process
# 重启SwitchB
<SwitchB> reset ospf 1 process
# 重启SwitchC
<SwitchC> reset ospf 1 process
# 重启SwitchD
<SwitchD> reset ospf 1 process
4、验证配置结果
# 在SwitchD上查看OSPF邻居信息。
<SwitchD> display ospf peer
OSPF Process 1 with Router ID 10.4.4.4
Neighbors
Area
0.0.0.0 interface 192.168.1.4(Vlanif10)'s neighbors
Router ID: 10.1.1.1 Address: 192.168.1.1
State: Full Mode:Nbr is
Slave Priority: 100
DR: 192.168.1.1 BDR: 192.168.1.3 MTU: 0
Dead timer due in 35 sec
Retrans timer interval: 5
Neighbor is up for 00:07:19
Authentication Sequence: [ 0 ]
Router ID: 10.2.2.2 Address: 192.168.1.2
State: 2-Way Mode:Nbr is
Master Priority: 0
DR: 192.168.1.1 BDR: 192.168.1.3 MTU: 0
Dead timer due in 35 sec
Retrans timer interval: 5
Neighbor is up for 00:07:19
Authentication Sequence: [ 0 ]
Router ID: 10.3.3.3 Address: 192.168.1.3
State: Full
Mode:Nbr is Slave Priority: 2
DR: 192.168.1.1 BDR: 192.168.1.3 MTU: 0
Dead timer due in 37 sec
Retrans timer interval: 5
Neighbor is up for 00:07:17
Authentication Sequence: [ 0 ]
从以上回显中可以看到SwitchA被选举为DR,SwitchC为BDR。而SwitchD与SwitchB之间的邻居状态为2-Way,这说明两者既不是DR,也不是BDR,即它们之间不需要交换LSA信息。
5、配置文件
5.1、Switch的配置文件
#
sysname Switch
#
vlan batch 10
#
interface GigabitEthernet1/0/1
port
link-type trunk
port
trunk allow-pass vlan 10
#
interface GigabitEthernet1/0/2
port
link-type trunk
port
trunk allow-pass vlan 10
#
interface GigabitEthernet1/0/3
port
link-type trunk
port
trunk allow-pass vlan 10
#
interface GigabitEthernet1/0/4
port
link-type trunk
port
trunk allow-pass vlan 10
#
return
5.2、SwitchA的配置文件
#
sysname SwitchA
#
vlan batch 10
#
interface Vlanif10
ip
address 192.168.1.1 255.255.255.0
ospf
dr-priority 100
#
interface GigabitEthernet1/0/1
port
link-type trunk
port
trunk allow-pass vlan 10
#
ospf 1 router-id 10.1.1.1
area
0.0.0.0
network 192.168.1.0 0.0.0.255
#
return
5.3、SwitchB的配置文件
#
sysname SwitchB
#
vlan batch 10
#
interface Vlanif10
ip
address 192.168.1.2 255.255.255.0
ospf
dr-priority 0
#
interface GigabitEthernet1/0/1
port
link-type trunk
port
trunk allow-pass vlan 10
#
ospf 1 router-id 10.2.2.2
area
0.0.0.0
network 192.168.1.0 0.0.0.255
#
return
5.4、SwitchC的配置文件
#
sysname SwitchC
#
vlan batch 10
#
interface Vlanif10
ip
address 192.168.1.3 255.255.255.0
ospf
dr-priority 2
#
interface GigabitEthernet1/0/1
port
link-type trunk
port
trunk allow-pass vlan 10
#
ospf 1 router-id 10.3.3.3
area
0.0.0.0
network 192.168.1.0 0.0.0.255
#
return
5.5、SwitchD的配置文件
#
sysname SwitchD
#
vlan batch 10
#
interface Vlanif10
ip
address 192.168.1.4 255.255.255.0
#
interface GigabitEthernet1/0/1
port
link-type trunk
port
trunk allow-pass vlan 10
#
ospf 1 router-id 10.4.4.4
area
0.0.0.0
network 192.168.1.0 0.0.0.255
#
return



本文地址:http://www.023wg.com/lypz/184.html
版权声明:若无注明,本文皆为“Swiers思唯网络博客”原创,转载请保留文章出处。

