玩转华为ENSP模拟器系列 | 配置OSPF的DR选择示例

Posted COCOgsta

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了玩转华为ENSP模拟器系列 | 配置OSPF的DR选择示例相关的知识,希望对你有一定的参考价值。

素材来源:华为路由器配置指南

一边学习一边整理试验笔记,并与大家分享,侵权即删,谢谢支持!

附上汇总贴:玩转华为ENSP模拟器系列 | 合集_COCOgsta的博客-CSDN博客_ensp实验大全


目标

介绍在广播网络中,配置接口上的DR优先级进行DR选择的过程。

组网需求

在图1中,DeviceA接口的优先级为100,它是网络上的最高优先级,所以DeviceA被选为DR;DeviceC是优先级第二高的,被选为BDR;DeviceB的优先级为0,这意味着它将无法成为DR或BDR;DeviceD没有配置优先级,取缺省值1。

配置思路

  • 在各路由器上配置OSPF基本功能,实现互连。
  • 在各路由器上配置Router ID。
  • 在缺省优先级情况下,查看各路由器DR或者BDR状态。
  • 配置接口上的DR优先级,查看DR或者BDR状态。

操作步骤

  1. 配置各接口的IP地址(略)
  2. 配置OSPF基本功能

配置DeviceA

DeviceA:
router id 1.1.1.1
ospf 1
 area 0.0.0.0
  network 192.168.1.0 0.0.0.255

配置DeviceB

DeviceB:
router id 2.2.2.2
ospf 1
 area 0.0.0.0
  network 192.168.1.0 0.0.0.255

配置DeviceC

DeviceC:
router id 3.3.3.3
ospf 1
 area 0.0.0.0
  network 192.168.1.0 0.0.0.255

配置DeviceD

DeviceD:
router id 4.4.4.4
ospf 1
 area 0.0.0.0
  network 192.168.1.0 0.0.0.255

查看DR或者BDR的状态。

[~DeviceA]dis ospf peer 
(M) Indicates MADJ neighbor
          OSPF Process 1 with Router ID 1.1.1.1
                Neighbors
 Area 0.0.0.0 interface 192.168.1.1 (Eth1/0/0)'s neighbors
 Router ID: 2.2.2.2              Address: 192.168.1.2      
   State: 2-Way          Mode:Nbr is Slave      Priority: 1
   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 00h00m00s
   Neighbor Up Time : 0000-00-00 00:00:00
   Authentication Sequence: [ 0 ]
 Area 0.0.0.0 interface 192.168.1.1 (Eth1/0/0)'s neighbors
 Router ID: 3.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  40  sec
   Retrans timer interval: 5
   Neighbor is up for 00h02m22s
   Neighbor Up Time : 2019-12-11 11:52:34
   Authentication Sequence: [ 0 ]
 Area 0.0.0.0 interface 192.168.1.1 (Eth1/0/0)'s neighbors
 Router ID: 4.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  38  sec
   Retrans timer interval: 5
   Neighbor is up for 00h02m22s
   Neighbor Up Time : 2019-12-11 11:52:34
   Authentication Sequence: [ 0 ]
          OSPF Process 65534 with Router ID 128.1.138.138
                Neighbors
 Area 0.0.0.0 interface 128.1.138.138 (DCN-Serial1/0/0:0)'s neighbors
 Router ID: 128.1.138.141        Address: 128.1.138.141    
   State: Full           Mode:Nbr is Master     Priority: 1
   DR: None              BDR: None              MTU: 0
   Dead timer due in  33  sec
   Retrans timer interval: 5
   Neighbor is up for 00h04m29s
   Neighbor Up Time : 2019-12-11 11:50:28
   Authentication Sequence: [ 0 ]
 Area 0.0.0.0 interface 128.1.138.138 (DCN-Serial1/0/0:1)'s neighbors
 Router ID: 128.1.138.139        Address: 128.1.138.139    
   State: Full           Mode:Nbr is Master     Priority: 1
   DR: None              BDR: None              MTU: 0
   Dead timer due in  37  sec
   Retrans timer interval: 5
   Neighbor is up for 00h04m27s
   Neighbor Up Time : 2019-12-11 11:50:31
   Authentication Sequence: [ 0 ]
 Area 0.0.0.0 interface 128.1.138.138 (DCN-Serial1/0/0:2)'s neighbors
 Router ID: 128.1.138.137        Address: 128.1.138.137    
   State: Full           Mode:Nbr is Slave      Priority: 1
   DR: None              BDR: None              MTU: 0
   Dead timer due in  35  sec
   Retrans timer interval: 5
   Neighbor is up for 00h04m28s
   Neighbor Up Time : 2019-12-11 11:50:29
   Authentication Sequence: [ 0 ]
[~DeviceA]

查看DeviceA的邻居信息,可以看到DR优先级(缺省为1)以及邻居状态,此时DeviceD为DR,DeviceC为BDR。

  1. 配置接口上的DR优先级

配置DeviceA。

DeviceA:
interface Ethernet1/0/0
 ospf dr-priority 100

配置DeviceB。

DeviceB:
interface Ethernet1/0/0
 ospf dr-priority 0

配置DeviceC。

DeviceC:
interface Ethernet1/0/0
 ospf dr-priority 2

查看DR或者BDR的状态。

[~DeviceD-ospf-1]display ospf peer 
(M) Indicates MADJ neighbor
          OSPF Process 1 with Router ID 4.4.4.4
                Neighbors
 Area 0.0.0.0 interface 192.168.1.4 (Eth1/0/0)'s neighbors
 Router ID: 1.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  37  sec
   Retrans timer interval: 5
   Neighbor is up for 00h06m24s
   Neighbor Up Time : 2019-12-11 11:52:34
   Authentication Sequence: [ 0 ]
 Area 0.0.0.0 interface 192.168.1.4 (Eth1/0/0)'s neighbors
 Router ID: 2.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  32  sec
   Retrans timer interval: 5
   Neighbor is up for 00h06m24s
   Neighbor Up Time : 2019-12-11 11:52:34
   Authentication Sequence: [ 0 ]
 Area 0.0.0.0 interface 192.168.1.4 (Eth1/0/0)'s neighbors
 Router ID: 3.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  38  sec
   Retrans timer interval: 5
   Neighbor is up for 00h06m24s
   Neighbor Up Time : 2019-12-11 11:52:34
   Authentication Sequence: [ 0 ]
          OSPF Process 65534 with Router ID 128.1.138.137
                Neighbors
 Area 0.0.0.0 interface 128.1.138.137 (DCN-Serial1/0/0:0)'s neighbors
 Router ID: 128.1.138.141        Address: 128.1.138.141    
   State: Full           Mode:Nbr is Master     Priority: 1
   DR: None              BDR: None              MTU: 0
   Dead timer due in  37  sec
   Retrans timer interval: 5
   Neighbor is up for 00h08m12s
   Neighbor Up Time : 2019-12-11 11:50:48
   Authentication Sequence: [ 0 ]
 Area 0.0.0.0 interface 128.1.138.137 (DCN-Serial1/0/0:1)'s neighbors
 Router ID: 128.1.138.139        Address: 128.1.138.139    
   State: Full           Mode:Nbr is Master     Priority: 1
   DR: None              BDR: None              MTU: 0
   Dead timer due in  38  sec
   Retrans timer interval: 5
   Neighbor is up for 00h08m13s
   Neighbor Up Time : 2019-12-11 11:50:48
   Authentication Sequence: [ 0 ]
 Area 0.0.0.0 interface 128.1.138.137 (DCN-Serial1/0/0:2)'s neighbors
 Router ID: 128.1.138.138        Address: 128.1.138.138    
   State: Full           Mode:Nbr is Master     Priority: 1
   DR: None              BDR: None              MTU: 0
   Dead timer due in  39  sec
   Retrans timer interval: 5
   Neighbor is up for 00h08m30s
   Neighbor Up Time : 2019-12-11 11:50:29
   Authentication Sequence: [ 0 ]
[~DeviceD-ospf-1] 
[~DeviceD-ospf-1]
  1. 重启OSPF进程

在各路由器的用户视图下,同时执行命令reset ospf 1 process,以重启OSPF进程。

  1. 验证配置结果

查看OSPF邻居状态。

<DeviceD>dis ospf peer
(M) Indicates MADJ neighbor
          OSPF Process 1 with Router ID 4.4.4.4
                Neighbors
 Area 0.0.0.0 interface 192.168.1.4 (Eth1/0/0)'s neighbors
 Router ID: 1.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  30  sec
   Retrans timer interval: 5
   Neighbor is up for 00h01m27s
   Neighbor Up Time : 2019-12-11 14:04:57
   Authentication Sequence: [ 0 ]
 Area 0.0.0.0 interface 192.168.1.4 (Eth1/0/0)'s neighbors
 Router ID: 2.2.2.2              Address: 192.168.1.2      
   State: 2-Way          Mode:Nbr is Slave      Priority: 0
   DR: 192.168.1.1       BDR: 192.168.1.3       MTU: 0
   Dead timer due in  32  sec
   Retrans timer interval: 0
   Neighbor is up for 00h00m00s
   Neighbor Up Time : 0000-00-00 00:00:00
   Authentication Sequence: [ 0 ]
 Area 0.0.0.0 interface 192.168.1.4 (Eth1/0/0)'s neighbors
 Router ID: 3.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  33  sec
   Retrans timer interval: 5
   Neighbor is up for 00h01m27s
   Neighbor Up Time : 2019-12-11 14:04:57
   Authentication Sequence: [ 0 ]
          OSPF Process 65534 with Router ID 128.1.138.137
                Neighbors
 Area 0.0.0.0 interface 128.1.138.137 (DCN-Serial1/0/0:0)'s neighbors
 Router ID: 128.1.138.141        Address: 128.1.138.141    
   State: Full           Mode:Nbr is Master     Priority: 1
   DR: None              BDR: None              MTU: 0
   Dead timer due in  32  sec
   Retrans timer interval: 5
   Neighbor is up for 02h15m38s
   Neighbor Up Time : 2019-12-11 11:50:48
   Authentication Sequence: [ 0 ]
 Area 0.0.0.0 interface 128.1.138.137 (DCN-Serial1/0/0:1)'s neighbors
 Router ID: 128.1.138.139        Address: 128.1.138.139    
   State: Full           Mode:Nbr is Master     Priority: 1
   DR: None              BDR: None              MTU: 0
   Dead timer due in  35  sec
   Retrans timer interval: 5
   Neighbor is up for 02h15m39s
   Neighbor Up Time : 2019-12-11 11:50:48
   Authentication Sequence: [ 0 ]
 Area 0.0.0.0 interface 128.1.138.137 (DCN-Serial1/0/0:2)'s neighbors
 Router ID: 128.1.138.138        Address: 128.1.138.138    
   State: Full           Mode:Nbr is Master     Priority: 1
   DR: None              BDR: None              MTU: 0
   Dead timer due in  36  sec
   Retrans timer interval: 5
   Neighbor is up for 02h15m56s
   Neighbor Up Time : 2019-12-11 11:50:29
   Authentication Sequence: [ 0 ]
<DeviceD>

查看OSPF接口的状态。

<DeviceA>dis ospf interface
(M) Indicates MADJ interface
          OSPF Process 1 with Router ID 1.1.1.1
                  Interfaces
 Area: 0.0.0.0          (MPLS TE not enabled)
 Interface                    IP Address      Type         State    Cost    Pri  
 Eth1/0/0                     192.168.1.1     Broadcast    DR       1       100  
          OSPF Process 65534 with Router ID 128.1.138.138
                  Interfaces
 Area: 0.0.0.0          (MPLS TE not enabled)
 Interface                    IP Address      Type         State    Cost    Pri  
 Loop2147483647               128.1.138.138   P2P          P-2-P    0       1    
 Eth1/0/0.4094                128.1.138.138   P2P          P-2-P    100     1    
 Eth1/0/1.4094                128.1.138.138   P2P          P-2-P    100     1    
 Eth1/0/2.4094                128.1.138.138   P2P          P-2-P    100     1    
 Eth1/0/3.4094                128.1.138.138   P2P          P-2-P    100     1    
 Eth1/0/4.4094                128.1.138.138   P2P          P-2-P    100     1    
 Eth1/0/5.4094                128.1.138.138   P2P          P-2-P    100     1    
 Eth1/0/6.4094                128.1.138.138   P2P          P-2-P    100     1    
 Eth1/0/7.4094                128.1.138.138   P2P          P-2-P    100     1    
 Eth1/0/8.4094                128.1.138.138   P2P          P-2-P    100     1    
 Eth1/0/9.4094                128.1.138.138   P2P          P-2-P    100     1    
 DCN-Serial1/0/0:0            128.1.138.138   P2P          P-2-P    100     1    
 DCN-Serial1/0/0:1            128.1.138.138   P2P          P-2-P    100     1    
 DCN-Serial1/0/0:2            128.1.138.138   P2P          P-2-P    100     1    
<DeviceA> 
<DeviceB>display ospf interface
(M) Indicates MADJ interface
          OSPF Process 1 with Router ID 2.2.2.2
                  Interfaces
 Area: 0.0.0.0          (MPLS TE not enabled)
 Interface                    IP Address      Type         State    Cost    Pri  
 Eth1/0/0                     192.168.1.2     Broadcast    DROther  1       0    
          OSPF Process 65534 with Router ID 128.1.138.141
                  Interfaces
 Area: 0.0.0.0          (MPLS TE not enabled)
 Interface                    IP Address      Type         State    Cost    Pri  
 Loop2147483647               128.1.138.141   P2P          P-2-P    0       1    
 Eth1/0/0.4094                128.1.138.141   P2P          P-2-P    100     1    
 Eth1/0/1.4094                128.1.138.141   P2P          P-2-P    100     1    
 Eth1/0/2.4094                128.1.138.141   P2P          P-2-P    100     1    
 Eth1/0/3.4094                128.1.138.141   P2P          P-2-P    100     1    
 Eth1/0/4.4094                128.1.138.141   P2P          P-2-P    100     1    
 Eth1/0/5.4094                128.1.138.141   P2P          P-2-P    100     1    
 Eth1/0/6.4094                128.1.138.141   P2P          P-2-P    100     1    
 Eth1/0/7.4094                128.1.138.141   P2P          P-2-P    100     1    
 Eth1/0/8.4094                128.1.138.141   P2P          P-2-P    100     1    
 Eth1/0/9.4094                128.1.138.141   P2P          P-2-P    100     1    
 DCN-Serial1/0/0:0            128.1.138.141   P2P          P-2-P    100     1    
 DCN-Serial1/0/0:1            128.1.138.141   P2P          P-2-P    100     1    
 DCN-Serial1/0/0:2            128.1.138.141   P2P          P-2-P    100     1    
<DeviceB>  
<DeviceB>
<DeviceB>

如果邻居的状态是Full,这说明它和邻居之间形成了邻接关系;如果停留在2-Way的状态,则说明两者都不是DR或BDR,两者之间不需要交换LSA。

如果OSPF接口的状态是DROther,则说明它既不是DR,也不是BDR。

 

以上是关于玩转华为ENSP模拟器系列 | 配置OSPF的DR选择示例的主要内容,如果未能解决你的问题,请参考以下文章

玩转华为ENSP模拟器系列 | 配置OSPF的NSSA区域

玩转华为ENSP模拟器系列 | 配置LDP与OSPF联动示例

玩转华为ENSP模拟器系列 | 配置BFD for OSPF特性示例

玩转华为ENSP模拟器系列 | 配置OSPF ABR路由聚合示例

玩转华为ENSP模拟器系列 | 配置OSPF多进程下Target LDP邻居建立

玩转华为ENSP模拟器系列 | 配置OSPF的Stub区域示例