VRRP与BFD联动

实验目的:

如图所示,该拓扑配置了vrrp主备备份,SW1为master,SW2为backup,当SW1或SW1到SW2间链路出现故障时,VRRP报文协商需要一定的协商周期。为了实现链路故障时快速切换,在链路中部署了BFD链路检测机制,实现当主用接口或者链路出现Down时,备用设备迅速切换为Master,承担网络流量,以减少故障对业务传输的影响。

一、交换机配置各接口ip地址,以及二层转发

SW1:

sys
sysname SW1
vlan batch 100 400
inter vlan 100
ip add 10.1.1.1 24
quit
inter vlan 400
ip add 172.16.1.2  24 

inter g0/0/1 
port link-type trunk
port trunk allow vlan  400 
quit
inter g0/0/2
port link-type trunk
port trunk allow vlan  100 
quit

SW2:

sys
sysname SW2
vlan batch 200 100
inter vlan 200
ip add 172.16.2.2 24
quit
inter vlan 100
ip add 10.1.1.2 24

inter g0/0/1 
port link-type trunk
port trunk allow vlan  200 
quit
inter g0/0/2
port link-type trunk
port trunk allow vlan  100 
quit

SW3:

sys
sysname SW3
vlan 100
quit
inter g0/0/1
port link-type trunk
port trunk allow vlan  100 
quit
inter g0/0/2 
port link-type trunk
port trunk allow vlan  100 
quit
inter g0/0/24 
port link-type access
port default vlan 100
quit

二、路由器接口ip配置以及VLAN封装

R1:

sys
sysname R1
interface g0/0/0.400   
ip address 172.16.1.1  24  
dot1q termination vid 400    // 封装该子接口相连的VLAN,实现路由器与VLAN通信
arp broadcast enable       // 开启arp广播
quit
interface g0/0/0.200   
ip address 172.16.2.1  24  
dot1q termination vid 200    
arp broadcast enable     
quit

三、配置ospf协议,实现网络通信

SW1:

ospf 1
area 0
network 10.1.1.0 0.0.0.255       // 发布直连网络段
network  172.16.1.0  0.0.0.255
quit
quit

SW2:

ospf 1
area 0
network 10.1.1.0 0.0.0.255
network  172.16.2.0  0.0.0.255
quit
quit

R1:

ospf 1
area 0
network 172.16.1.0  0.0.0.255
network 172.16.2.0  0.0.0.255
return

四、配置VRRP主备备份

SW1:

inter VLAN 100
vrrp vrid 1 virtual-ip 10.1.1.111
vrrp vrid 1 priority 120   
vrrp vrid 1 preempt-mode timer delay 20   
quit

SW2:

inter VLAN 100
vrrp vrid 1 virtual-ip 10.1.1.111
quit

五、配置bfd会话

SW1:

bfd 
quit
bfd 1 bind peer-ip 10.1.1.2 interface vlan 100  //配置静态BFD会话,监测备份组之间的链路
discriminator local 1       //配置bfd会话的本地标识,SW1本地标识符需与SW2远端标识符一致
discriminator remote 2  //配置bfd会话的远端标识,SW1远端标识需与SW2本地标识符一致
min-rx-interval 100      //  配置bfd报文的接收间隔时间
min-tx-interval 100    //配置bfd报文的发送间隔时间
commit                       //提交bfd配置
quit

SW2:

bfd 
quit
bfd 2 bind peer-ip 10.1.1.1 interface vlan 100
discriminator local 2 
discriminator remote 1
min-rx-interval 100
min-tx-interval 100
commit 
quit

六、配置VRRP与BFD联动功能

在SW2上配置VRRP与BFD联动,当BFD会话状态Down时,SW2的优先级增加40
SW2:

inter vlan 100
vrrp vrid 1 track bfd-session 2 increased 40
quit

七、查看当前vrrp、bfd会话状态

SW1:

SW2:

八、在SW1的接口GE0/0/2上执行shutdown命令,模拟链路故障,查看vrrp与bfd会话状态

SW1:

interface g0/0/2
shutdown
quit

SW1故障时的VRRP状态:

备用设备SW2由backup切换为master:

联动的BFD会话状态为DOWN:

九、模拟链路恢复

在SW1接口GE0/0/2上执行undo shutdown命令,模拟故障恢复,等待20秒后,查看vrrp状态时,可以看到,SW1状态恢复为master,SW2状态恢复为backup,联动的bfd会话状态恢复为up。至此,实验效果测试结束。

关于VRRP的配置可参考 华为VRRP的综合配置

你可能感兴趣的:(VRRP与BFD联动)