配置VRRP6与BFD联动实现快速切换示例
组网需求
如图3-26所示,IPv6网络中,HostA通过Switch双归属到部署了VRRP6备份组的SwitchA和SwitchB,其中SwitchA为Master。
当SwitchA或SwitchA到SwitchB间链路出现故障时,VRRP6报文协商需要一定的协商周期。为了实现链路故障时快速切换,可以在链路中部署BFD链路检测机制,并配置VRRP6监视BFD会话,实现当主用接口或者链路出现Down时,备用设备迅速切换为Master,承担网络流量,以减少故障对业务传输的影响。
请确保该场景下互联接口的STP处于未使能状态。同时将互连接口退出VLAN1,避免形成环路。因为在使能STP的环形网络中,如果用交换机的VLANIF接口构建三层网络,会导致某个端口被阻塞,从而导致三层业务不能正常运行。
配置思路
采用VRRP6与BFD联动实现主备网关间的快速切换,配置思路如下:
- 配置各设备接口IP地址及路由协议,使网络层路由可达。
- 在SwitchA和SwitchB上配置VRRP6备份组,其中SwitchA的优先级为120,抢占延时为20秒,作为Master设备;SwitchB的优先级为缺省值,作为Backup设备,实现网关的主备备份。
- 在SwitchA和SwitchB上配置静态BFD会话,监测备份组之间的链路。
- 在SwitchB上配置VRRP6与BFD联动,实现链路故障时VRRP备份组快速切换。
操作步骤
- 配置设备间的网络互连
# 配置各接口所属VLAN,以SwitchA为例。SwitchB和SwitchC的配置与SwitchA类似,详见配置文件。
<HUAWEI> system-view [HUAWEI] sysname SwitchA [SwitchA] vlan batch 100 300 [SwitchA] interface gigabitethernet 0/0/1 [SwitchA-GigabitEthernet0/0/1] port link-type hybrid [SwitchA-GigabitEthernet0/0/1] port hybrid pvid vlan 300 [SwitchA-GigabitEthernet0/0/1] port hybrid untagged vlan 300 [SwitchA-GigabitEthernet0/0/1] quit [SwitchA] interface gigabitethernet 0/0/2 [SwitchA-GigabitEthernet0/0/2] port link-type hybrid [SwitchA-GigabitEthernet0/0/2] port hybrid pvid vlan 100 [SwitchA-GigabitEthernet0/0/2] port hybrid untagged vlan 100 [SwitchA-GigabitEthernet0/0/2] quit
# 配置设备各接口的IP地址,以SwitchA为例。SwitchB和SwitchC的配置与SwitchA类似,详见配置文件。
[SwitchA] ipv6 [SwitchA] interface vlanif 100 [SwitchA-Vlanif100] ipv6 enable [SwitchA-Vlanif100] ipv6 address FC00::1 64 [SwitchA-Vlanif100] ip address 10.1.1.1 24 [SwitchA-Vlanif100] quit [SwitchA] interface vlanif 300 [SwitchA-Vlanif300] ipv6 enable [SwitchA-Vlanif300] ipv6 address 2002::1 64 [SwitchA-Vlanif300] quit
# 配置Switch的二层转发功能。
<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] vlan 100 [Switch-vlan100] quit [Switch] interface gigabitethernet 0/0/1 [Switch-GigabitEthernet0/0/1] port link-type hybrid [Switch-GigabitEthernet0/0/1] port hybrid pvid vlan 100 [Switch-GigabitEthernet0/0/1] port hybrid untagged vlan 100 [Switch-GigabitEthernet0/0/1] quit [Switch] interface gigabitethernet 0/0/2 [Switch-GigabitEthernet0/0/2] port link-type hybrid [Switch-GigabitEthernet0/0/2] port hybrid pvid vlan 100 [Switch-GigabitEthernet0/0/2] port hybrid untagged vlan 100 [Switch-GigabitEthernet0/0/2] quit
# 配置SwitchA、SwitchB和SwitchC间采用OSPFv3协议进行互连。以SwitchA为例,SwitchB和SwitchC的配置与SwitchA类似,详见配置文件。
[SwitchA] ospfv3 [SwitchA-ospfv3-1] router-id 1.1.1.1 [SwitchA-ospfv3-1] quit [SwitchA] interface vlanif 100 [SwitchA-Vlanif100] ospfv3 1 area 0 [SwitchA-Vlanif100] quit [SwitchA] interface vlanif 300 [SwitchA-Vlanif300] ospfv3 1 area 0 [SwitchA-Vlanif300] quit
- 配置VRRP6备份组
# 在SwitchA上创建VRRP6备份组1,配置SwitchA在该备份组中的优先级为120,并配置抢占时间为20秒。
[SwitchA] interface vlanif 100 [SwitchA-Vlanif100] vrrp6 vrid 1 virtual-ip FE80::1 link-local [SwitchA-Vlanif100] vrrp6 vrid 1 virtual-ip FC00::100 [SwitchA-Vlanif100] vrrp6 vrid 1 priority 120 [SwitchA-Vlanif100] vrrp6 vrid 1 preempt-mode timer delay 20 [SwitchA-Vlanif100] quit
# 在SwitchB上创建VRRP6备份组1,其在该备份组中的优先级为缺省值100。
[SwitchB] interface vlanif 100 [SwitchB-Vlanif100] vrrp6 vrid 1 virtual-ip FE80::1 link-local [SwitchB-Vlanif100] vrrp6 vrid 1 virtual-ip FC00::100 [SwitchB-Vlanif100] quit
- 配置静态BFD会话
# 在SwitchA上配置BFD会话。
[SwitchA] bfd [SwitchA-bfd] quit [SwitchA] bfd atob bind peer-ip 10.1.1.2 interface vlanif 100 [SwitchA-bfd-session-atob] discriminator local 1 [SwitchA-bfd-session-atob] discriminator remote 2 [SwitchA-bfd-session-atob] min-rx-interval 100 [SwitchA-bfd-session-atob] min-tx-interval 100 [SwitchA-bfd-session-atob] commit [SwitchA-bfd-session-atob] quit
# 在SwitchB上配置BFD会话。
[SwitchB] bfd [SwitchB-bfd] quit [SwitchB] bfd btoa bind peer-ip 10.1.1.1 interface vlanif 100 [SwitchB-bfd-session-btoa] discriminator local 2 [SwitchB-bfd-session-btoa] discriminator remote 1 [SwitchB-bfd-session-btoa] min-rx-interval 100 [SwitchB-bfd-session-btoa] min-tx-interval 100 [SwitchB-bfd-session-btoa] commit [SwitchB-bfd-session-btoa] quit
# 配置完成后,在SwitchA或SwitchB上执行display bfd session命令,可以看到BFD会话的状态为Up。以SwitchA的显示为例。
[SwitchA] display bfd session all -------------------------------------------------------------------------------- Local Remote PeerIpAddr State Type InterfaceName -------------------------------------------------------------------------------- 1 2 10.1.1.2 Up S_IP_IF Vlanif100 -------------------------------------------------------------------------------- Total UP/DOWN Session Number : 1/0
- 配置VRRP6与BFD联动功能
# 在SwitchB上配置VRRP6与BFD联动,当BFD会话状态Down时,SwitchB的优先级增加40。
[SwitchB] interface vlanif 100 [SwitchB-Vlanif100] vrrp6 vrid 1 track bfd-session 2 increased 40 [SwitchB-Vlanif100] quit
- 验证配置结果
# 完成上述配置后,在SwitchA和SwitchB上分别执行display vrrp6命令,可以看出SwitchA为Master设备,SwitchB为Backup设备,联动的BFD会话状态为UP。
[SwitchA] display vrrp6 Vlanif100 | Virtual Router 1 State : Master Virtual IP : FE80::1 FC00::100 Master IP : FE80::200:AFF:FE88:158D PriorityRun : 120 PriorityConfig : 120 MasterPriority : 120 Preempt : YES Delay Time : 20 s TimerRun : 100 cs TimerConfig : 100 cs Virtual MAC : 0000-5e00-0201 Check hop limit : YES Config type : normal-vrrp Backup-forward : disabled Create time : 2012-01-12 20:15:46 Last change time : 2012-01-12 20:15:46
[SwitchB] display vrrp6 Vlanif100 | Virtual Router 1 State : Backup Virtual IP : FE80::1 FC00::100 Master IP : FE80::200:AFF:FE88:158D PriorityRun : 100 PriorityConfig : 100 MasterPriority : 120 Preempt : YES Delay Time : 0 s TimerRun : 100 cs TimerConfig : 100 cs Virtual MAC : 0000-5e00-0201 Check hop limit : YES Config type : normal-vrrp Backup-forward : disabled Track BFD : 2 Priority increased : 40 BFD-session state : UP Create time : 2012-01-12 20:15:46 Last change time : 2012-01-12 20:15:46
# 在SwitchA的接口GE0/0/2上执行shutdown命令,模拟链路故障。
[SwitchA] interface gigabitethernet 0/0/2 [SwitchA-GigabitEthernet0/0/2] shutdown [SwitchA-GigabitEthernet0/0/2] quit
# 在SwitchA和SwitchB上分别执行display vrrp6命令,可以看出SwitchA状态变为Initialize,SwitchB状态变为Master,联动的BFD会话状态为DOWN。
[SwitchA] display vrrp6 Vlanif100 | Virtual Router 1 State : Initialize Virtual IP : FE80::1 FC00::100 Master IP : :: PriorityRun : 120 PriorityConfig : 120 MasterPriority : 0 Preempt : YES Delay Time : 20 s TimerRun : 100 cs TimerConfig : 100 cs Virtual MAC : 0000-5e00-0201 Check hop limit : YES Config type : normal-vrrp Backup-forward : disabled Create time : 2012-01-12 20:15:46 Last change time : 2012-01-12 20:15:46
[SwitchB] display vrrp6 Vlanif100 | Virtual Router 1 State : Master Virtual IP : FE80::1 FC00::100 Master IP : FE80::121B:54FF:FE98:D3B0 PriorityRun : 140 PriorityConfig : 100 MasterPriority : 140 Preempt : YES Delay Time : 0 s TimerRun : 100 cs TimerConfig : 100 cs Virtual MAC : 0000-5e00-0201 Check hop limit : YES Config type : normal-vrrp Backup-forward : disabled Track BFD : 2 Priority increased : 40 BFD-session state : DOWN Create time : 2012-01-12 20:15:46 Last change time : 2012-01-12 20:15:46
# 在SwitchA的接口GE0/0/2上执行undo shutdown命令,模拟故障恢复。
[SwitchA] interface gigabitethernet 0/0/2 [SwitchA-GigabitEthernet0/0/2] undo shutdown [SwitchA-GigabitEthernet0/0/2] quit
# 等待20秒后,分别在SwitchA和SwitchB上执行display vrrp6命令,可以看出SwitchA状态恢复为Master,SwitchB状态恢复为Backup,联动的BFD会话状态恢复为UP。
[SwitchA] display vrrp6 Vlanif100 | Virtual Router 1 State : Master Virtual IP : FE80::1 FC00::100 Master IP : FE80::200:AFF:FE88:158D PriorityRun : 120 PriorityConfig : 120 MasterPriority : 120 Preempt : YES Delay Time : 20 s TimerRun : 100 cs TimerConfig : 100 cs Virtual MAC : 0000-5e00-0201 Check hop limit : YES Config type : normal-vrrp Backup-forward : disabled Create time : 2012-01-12 20:15:46 Last change time : 2012-01-12 20:15:46
[SwitchB] display vrrp6 Vlanif100 | Virtual Router 1 State : Backup Virtual IP : FE80::1 FC00::100 Master IP : FE80::200:AFF:FE88:158D PriorityRun : 100 PriorityConfig : 100 MasterPriority : 120 Preempt : YES Delay Time : 0 s TimerRun : 100 cs TimerConfig : 100 cs Virtual MAC : 0000-5e00-0201 Check hop limit : YES Config type : normal-vrrp Backup-forward : disabled Track BFD : 2 Priority increased : 40 BFD-session state : UP Create time : 2012-01-12 20:15:46 Last change time : 2012-01-12 20:15:46
配置文件
SwitchA的配置文件
# sysname SwitchA # ipv6 # vlan batch 100 300 # bfd # ospfv3 1 router-id 1.1.1.1 # interface Vlanif100 ipv6 enable ip address 10.1.1.1 255.255.255.0 ipv6 address FC00::1/64 ospfv3 1 area 0.0.0.0 vrrp6 vrid 1 virtual-ip FE80::1 link-local vrrp6 vrid 1 virtual-ip FC00::100 vrrp6 vrid 1 priority 120 vrrp6 vrid 1 preempt-mode timer delay 20 # interface Vlanif300 ipv6 enable ipv6 address 2002::1/64 ospfv3 1 area 0.0.0.0 # interface GigabitEthernet0/0/1 port link-type hybrid port hybrid pvid vlan 300 port hybrid untagged vlan 300 # interface GigabitEthernet0/0/2 port link-type hybrid port hybrid pvid vlan 100 port hybrid untagged vlan 100 # bfd atob bind peer-ip 10.1.1.2 interface Vlanif100 discriminator local 1 discriminator remote 2 min-tx-interval 100 min-rx-interval 100 commit # return
SwitchB的配置文件
# sysname SwitchB # ipv6 # vlan batch 100 200 # bfd # ospfv3 1 router-id 2.2.2.2 # interface Vlanif100 ipv6 enable ip address 10.1.1.2 255.255.255.0 ipv6 address FC00::2/64 ospfv3 1 area 0.0.0.0 vrrp6 vrid 1 virtual-ip FE80::1 link-local vrrp6 vrid 1 virtual-ip FC00::100 vrrp6 vrid 1 track bfd-session 2 increased 40 # interface Vlanif200 ipv6 enable ipv6 address 2001::1/64 ospfv3 1 area 0.0.0.0 # interface GigabitEthernet0/0/1 port link-type hybrid port hybrid pvid vlan 200 port hybrid untagged vlan 200 # interface GigabitEthernet0/0/2 port link-type hybrid port hybrid pvid vlan 100 port hybrid untagged vlan 100 # bfd btoa bind peer-ip 10.1.1.1 interface Vlanif100 discriminator local 2 discriminator remote 1 min-tx-interval 100 min-rx-interval 100 commit # return
SwitchC的配置文件
# sysname SwitchC # ipv6 # vlan batch 200 300 400 # ospfv3 1 router-id 3.3.3.3 # interface Vlanif200 ipv6 enable ipv6 address 2001::2/64 ospfv3 1 area 0.0.0.0 # interface Vlanif300 ipv6 enable ipv6 address 2002::2/64 ospfv3 1 area 0.0.0.0 # interface Vlanif400 ipv6 enable ipv6 address 2003::2/64 ospfv3 1 area 0.0.0.0 # interface GigabitEthernet0/0/1 port link-type hybrid port hybrid pvid vlan 300 port hybrid untagged vlan 300 # interface GigabitEthernet0/0/2 port link-type hybrid port hybrid pvid vlan 200 port hybrid untagged vlan 200 # interface GigabitEthernet0/0/3 port link-type hybrid port hybrid pvid vlan 400 port hybrid untagged vlan 400 # return
Switch的配置文件
# sysname Switch # vlan batch 100 # interface GigabitEthernet0/0/1 port link-type hybrid port hybrid pvid vlan 100 port hybrid untagged vlan 100 # interface GigabitEthernet0/0/2 port link-type hybrid port hybrid pvid vlan 100 port hybrid untagged vlan 100 # return