1.组网需求

·     Switch A、Switch B、Switch C、Switch D在同一网段,运行OSPF协议后Switch D为DR,Switch C为BDR;

·     改变交换机接口的DR优先级使Switch A成为DR,Switch C成为BDR。

   

2.配置步骤

  1)分别在Switch A、Switch B、Switch C和Switch D上配置各接口的IP和OSPF基本功能

  2)运行OSPF后Switch D为DR,可在Switch A上通过display ospf peer verbose命令查看其邻居信息。  

[SwitchA] display ospf peer verbose
          OSPF Process 1 with Router ID 1.1.1.1
                  Neighbors 

 Area 0.0.0.0 interface 192.168.1.1(Vlan-interface1)'s neighbors
 Router ID: 2.2.2.2          Address: 192.168.1.2      GR State: 
ormal
   State: 2-Way  Mode: None  Priority: 1
   DR: 192.168.1.4  BDR: 192.168.1.3  MTU: 0

  可以看到Switch D为DR,Switch C为BDR。

  3)配置接口的DR优先级  

[SwitchA] interface vlan-interface 1
[SwitchA-Vlan-interface1] ospf dr-priority 100

[SwitchB] interface vlan-interface 1
[SwitchB-Vlan-interface1] ospf dr-priority 0

[SwitchC] interface vlan-interface 1
[SwitchC-Vlan-interface1] ospf dr-priority 2  
<SwitchD> display ospf peer verbose
          OSPF Process 1 with Router ID 4.4.4.4
                  Neighbors
 Area 0.0.0.0 interface 192.168.1.4(Vlan-interface1)'s neighbors
 Router ID: 1.1.1.1      Address: 192.168.1.1      GR State: Normal
   State: Full  Mode:Nbr is  slave  Priority: 100
   DR: 192.168.1.4  BDR: 192.168.1.3  MTU: 0

  可以看到,网络中DR/BDR并没有改变。

  注:网络中DR/BDR已经存在的情况下,接口上的路由器优先级的配置并不会立即生效。

  4)同时重启Switch A、Switch B、Switch C和Switch D上的OSPF进程  

  reset ospf 1 process

  Reset OSPF process? [Y/N]:y  

<SwitchD> display ospf peer verbose
          OSPF Process 1 with Router ID 4.4.4.4
                  Neighbors
 Area 0.0.0.0 interface 192.168.1.4(Vlan-interface1)'s neighbors
 Router ID: 1.1.1.1          Address: 192.168.1.1      GR State: ormal
   State: Full  Mode: Nbr is slave  Priority: 100
   DR: 192.168.1.1  BDR: 192.168.1.3  MTU: 0

  *注:经测试,实验环境下执行 reset ospf 1 process重新收敛会导致丢4个包。

  可以看到Switch A成为DR,Switch C为BDR。  

·     如果邻居的状态是Full,这说明它和邻居之间形成了邻接关系;

·     如果邻居的状态是2-Way,则说明它们都不是DR或BDR,两者之间不需要交换LSA。  

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

<SwitchA> display ospf interface
          OSPF Process 1 with Router ID 1.1.1.1
                  Interfaces
 Area: 0.0.0.0
 IP Address      Type      State   Cost  Pri   DR             BDR
 192.168.1.1     Broadcast DR      1     100   192.168.1.1    192.168.1.3

SwitchB> display ospf interface
          OSPF Process 1 with Router ID 2.2.2.2
                  Interfaces 

 Area: 0.0.0.0
 IP Address      Type      State    Cost  Pri   DR            BDR
 192.168.1.2     Broadcast DROther  1     0     192.168.1.1   192.168.1.3

 

posted on 2021-12-09 11:09  星痕1216  阅读(941)  评论(0编辑  收藏  举报