华为OSPF路由中DR选择配置示例
首页 > HuaWei > 路由配置   作者:浙江思唯网络  2016年2月22日 17:05 星期一  字号:   评论:0 条
时间:2016-2-22 17:05   评论:0 条 

华为OSPF路由中DR选择配置示例

 

1、组网需求

OSPF中DR选择组网示例图.png

               1 OSPFDR选择组网示例图

    如上图1所示,部署OSPF协议的网络中有五台交换机,其中Switch作为二层交换机连接其他运行OSPF协议的四台交换机。

    由于之前四台设备之间缺省选举的DR不符合网络需求,现在需要让SwitchA被选举为DR来和OSPF网络其他设备交互LSA信息,而SwitchC则作为SwitchA的备份。而SwitchB由于其他业务需要,只能让它通过DR来与OSPF网络其他设备交互LSA信息。

 

2、配置思路

2.1、在各交换机上配置OSPF的基本功能,查看四台交换机之间缺省的DR的选举情况。

2.2、配置SwitchA对应接口的DR优先级为100SwitchB对应接口的DR优先级为0SwitchC2.3、对应接口的DR优先级为2,使得SwitchA被选举为DRSwitchC被选举为BDRSwitchB永远无法成为DRBDR,而SwitchD采用缺省DR优先级,维持原状不变。

 

3、操作步骤

3.1、配置各接口所属的VLAN

# 配置SwitchASwitchSwitchBSwitchCSwitchD的配置与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地址

# 配置SwitchASwitchBSwitchCSwitchD的配置与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 ]

    从以上回显中可以看到在缺省情况下SwitchDDRSwitchCBDR。这是因为当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的选举情况并没有改变。这是因为如果DRBDR已经选择完毕,当一台新设备加入后,即使它的DR优先级值最大,也不会立即成为该网段中的DR,只有重启OSPF进程之后才会重新选举DRBDR

 

3.5、重启OSPF进程

# 在各交换机的用户视图下,同时执行命令reset ospf 1 process,以重启OSPF进程。同时重启OSPF进程是为了让四台交换机都参与DRBDR的选举过程。

# 重启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被选举为DRSwitchCBDR。而SwitchDSwitchB之间的邻居状态为2-Way,这说明两者既不是DR,也不是BDR,即它们之间不需要交换LSA信息。

 

5、配置文件

5.1Switch的配置文件

#

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.2SwitchA的配置文件

#

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.3SwitchB的配置文件

#

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.4SwitchC的配置文件

#

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.5SwitchD的配置文件

#

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

 您阅读这篇文章共花了: 
二维码加载中...
技术交流:欢迎在本文下方留言或加入QQ群:859273036 互相学习。     
本文地址:http://www.023wg.com/lypz/184.html
版权声明:若无注明,本文皆为“Swiers思唯网络博客”原创,转载请保留文章出处。

返回顶部    首页   
版权所有:Swiers思唯网络博客    浙江思唯网络