Only the S5720-EI, S5720-HI, S5730-HI, S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S6720-EI, S6720-HI, S6720S-EI, S6730-H, S6730S-H, S6730-S, and S6730S-S support this function.
The host uses SwitchA as the default gateway to connect to the Internet. When SwitchA becomes faulty, SwitchB functions as the gateway. This implements gateway backup.
After SwitchA recovers, it becomes the gateway within 20s.
The configuration roadmap is as follows:
VLAN termination sub-interfaces can be created on a non-VCMP client.
# Assign an IP address to each interface. SwitchA is used as an example. The configurations of SwitchB and SwitchC are similar to the configuration of SwitchA, and are not mentioned here. For details, see the configuration files.
<HUAWEI> system-view [HUAWEI] sysname SwitchA [SwitchA] interface gigabitethernet 0/0/2 [SwitchA-GigabitEthernet0/0/2] undo portswitch [SwitchA-GigabitEthernet0/0/2] quit [SwitchA] interface gigabitethernet 0/0/2.1 [SwitchA-GigabitEthernet0/0/2.1] ip address 10.1.1.1 24 [SwitchA-GigabitEthernet0/0/2.1] quit [SwitchA] interface gigabitethernet 0/0/2.2 [SwitchA-GigabitEthernet0/0/2.2] ip address 10.1.2.1 24 [SwitchA-GigabitEthernet0/0/2.2] quit [SwitchA] interface gigabitethernet 0/0/1 [SwitchA-GigabitEthernet0/0/1] undo portswitch [SwitchA-GigabitEthernet0/0/1] ip address 192.168.2.1 24 [SwitchA-GigabitEthernet0/0/1] quit
# Configure OSPF between SwitchA, SwitchB, and SwitchC. SwitchA is used as an example. The configurations of SwitchB and SwitchC are similar to the configuration of SwitchA, and are not mentioned here. For details, see the configuration files.
[SwitchA] ospf 1 [SwitchA-ospf-1] area 0 [SwitchA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255 [SwitchA-ospf-1-area-0.0.0.0] network 10.1.2.0 0.0.0.255 [SwitchA-ospf-1-area-0.0.0.0] network 192.168.2.0 0.0.0.255 [SwitchA-ospf-1-area-0.0.0.0] quit [SwitchA-ospf-1] quit
# Configure LSW2.
<HUAWEI> system-view [HUAWEI] sysname LSW2 [LSW2] vlan 10 [LSW2-vlan10] quit [LSW2] interface gigabitethernet 0/0/1 [LSW2-GigabitEthernet0/0/1] port link-type trunk [LSW2-GigabitEthernet0/0/1] port trunk allow-pass vlan 10 [LSW2-GigabitEthernet0/0/1] quit [LSW2] interface gigabitethernet 0/0/2 [LSW2-GigabitEthernet0/0/2] port link-type access [LSW2-GigabitEthernet0/0/2] port default vlan 10 [LSW2-GigabitEthernet0/0/2] quit
# Configure LSW3.
<HUAWEI> system-view [HUAWEI] sysname LSW3 [LSW3] vlan 20 [LSW3-vlan20] quit [LSW3] interface gigabitethernet 0/0/1 [LSW3-GigabitEthernet0/0/1] port link-type trunk [LSW3-GigabitEthernet0/0/1] port trunk allow-pass vlan 20 [LSW3-GigabitEthernet0/0/1] quit [LSW3] interface gigabitethernet 0/0/2 [LSW3-GigabitEthernet0/0/2] port link-type access [LSW3-GigabitEthernet0/0/2] port default vlan 20 [LSW3-GigabitEthernet0/0/2] quit
# Configure LSW1.
<HUAWEI> system-view [HUAWEI] sysname LSW1 [LSW1] vlan 100 [LSW1-vlan100] quit [LSW1] interface gigabitethernet 0/0/1 [LSW1-GigabitEthernet0/0/1] port link-type hybrid [LSW1-GigabitEthernet0/0/1] qinq vlan-translation enable [LSW1-GigabitEthernet0/0/1] port vlan-stacking vlan 10 stack-vlan 100 [LSW1-GigabitEthernet0/0/1] quit [LSW1] interface gigabitethernet 0/0/2 [LSW1-GigabitEthernet0/0/2] port link-type trunk [LSW1-GigabitEthernet0/0/2] port trunk allow-pass vlan 100 [LSW1-GigabitEthernet0/0/2] quit [LSW1] interface gigabitethernet 0/0/3 [LSW1-GigabitEthernet0/0/3] port link-type trunk [LSW1-GigabitEthernet0/0/3] port trunk allow-pass vlan 100 [LSW1-GigabitEthernet0/0/3] quit [LSW1] interface gigabitethernet 0/0/4 [LSW1-GigabitEthernet0/0/4] port link-type hybrid [LSW1-GigabitEthernet0/0/4] qinq vlan-translation enable [LSW1-GigabitEthernet0/0/4] port vlan-stacking vlan 20 stack-vlan 100 [LSW1-GigabitEthernet0/0/4] quit
# On SwitchA, configure VRRP group 1 on GE0/0/2.1 and VRRP group 2 on GE0/0/2.2. Then, set the priority of SwitchA in the two VRRP groups to 120 and the preemption delay to 20s.
[SwitchA] interface gigabitethernet 0/0/2.1 [SwitchA-GigabitEthernet0/0/2.1] qinq termination pe-vid 100 ce-vid 10 [SwitchA-GigabitEthernet0/0/2.1] vrrp vrid 1 virtual-ip 10.1.1.111 [SwitchA-GigabitEthernet0/0/2.1] vrrp vrid 1 priority 120 [SwitchA-GigabitEthernet0/0/2.1] vrrp vrid 1 preempt-mode timer delay 20 [SwitchA-GigabitEthernet0/0/2.1] quit [SwitchA] interface gigabitethernet 0/0/2.2 [SwitchA-GigabitEthernet0/0/2.2] qinq termination pe-vid 100 ce-vid 20 [SwitchA-GigabitEthernet0/0/2.2] vrrp vrid 2 virtual-ip 10.1.2.111 [SwitchA-GigabitEthernet0/0/2.2] vrrp vrid 2 priority 120 [SwitchA-GigabitEthernet0/0/2.2] vrrp vrid 2 preempt-mode timer delay 20 [SwitchA-GigabitEthernet0/0/2.2] quit
# On SwitchB, configure VRRP group 1 on GE0/0/2.1 and VRRP group 2 on GE0/0/2.2, and configure SwitchB to use the default priority in the two VRRP groups.
[SwitchB] interface gigabitethernet 0/0/2.1 [SwitchB-GigabitEthernet0/0/2.1] qinq termination pe-vid 100 ce-vid 10 [SwitchB-GigabitEthernet0/0/2.1] vrrp vrid 1 virtual-ip 10.1.1.111 [SwitchB-GigabitEthernet0/0/2.1] quit [SwitchB] interface gigabitethernet 0/0/2.2 [SwitchB-GigabitEthernet0/0/2.2] qinq termination pe-vid 100 ce-vid 20 [SwitchB-GigabitEthernet0/0/2.2] vrrp vrid 2 virtual-ip 10.1.2.111 [SwitchB-GigabitEthernet0/0/2.2] quit
# After the configuration is complete, run the display vrrp command on SwitchA and SwitchB. You can see that SwitchA is in Master state and SwitchB is in Backup state in the two VRRP groups.
[SwitchA] display vrrp
GigabitEthernet0/0/2.1 | Virtual Router 1
State : Master
Virtual IP : 10.1.1.111
Master IP : 10.1.1.1
PriorityRun : 120
PriorityConfig : 120
MasterPriority : 120
Preempt : YES Delay Time : 20 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0101
Check TTL : YES
Config type : normal-vrrp
Backup-forward : disabled
Create time : 2012-05-29 21:25:47
Last change time : 2012-05-29 21:27:10
GigabitEthernet0/0/2.2 | Virtual Router 2
State : Master
Virtual IP : 10.1.2.111
Master IP : 10.1.2.1
PriorityRun : 120
PriorityConfig : 120
MasterPriority : 120
Preempt : YES Delay Time : 20 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0102
Check TTL : YES
Config type : normal-vrrp
Backup-forward : disabled
Create time : 2012-05-29 21:25:47
Last change time : 2012-05-29 21:27:10
[SwitchB] display vrrp
GigabitEthernet0/0/2.1 | Virtual Router 1
State : Backup
Virtual IP : 10.1.1.111
Master IP : 10.1.1.1
PriorityRun : 100
PriorityConfig : 100
MasterPriority : 120
Preempt : YES Delay Time : 0 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0101
Check TTL : YES
Config type : normal-vrrp
Backup-forward : disabled
Create time : 2012-05-29 21:25:47
Last change time : 2012-05-29 21:27:10
GigabitEthernet0/0/2.2 | Virtual Router 2
State : Backup
Virtual IP : 10.1.2.111
Master IP : 10.1.2.1
PriorityRun : 100
PriorityConfig : 100
MasterPriority : 120
Preempt : YES Delay Time : 0 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0102
Check TTL : YES
Config type : normal-vrrp
Backup-forward : disabled
Create time : 2012-05-29 21:25:47
Last change time : 2012-05-29 21:27:10
# Run the display ip routing-table command on SwitchA and SwitchB. The command output shows that a direct route to the virtual IP address exists in the routing table of SwitchA and an OSPF route to the virtual IP address exists in the routing table of SwitchB.
[SwitchA] display ip routing-table Route Flags: R - relay, D - download to fib, T - to vpn-instance ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 11 Routes : 13 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.1.1.0/24 Direct 0 0 D 10.1.1.1 GigabitEthernet0/0/2.1 10.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/2.1 10.1.1.111/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/2.1 10.1.2.0/24 Direct 0 0 D 10.1.2.1 GigabitEthernet0/0/2.2 10.1.2.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/2.2 10.1.2.111/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/2.2 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 192.168.1.0/24 OSPF 10 2 D 192.168.2.2 GigabitEthernet0/0/1 OSPF 10 2 D 10.1.1.2 GigabitEthernet0/0/2.1 OSPF 10 2 D 10.1.2.2 GigabitEthernet0/0/2.2 192.168.2.0/24 Direct 0 0 D 192.168.2.1 GigabitEthernet0/0/1 192.168.2.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1
[SwitchB] display ip routing-table Route Flags: R - relay, D - download to fib, T - to vpn-instance ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 11 Routes : 15 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.1.1.0/24 Direct 0 0 D 10.1.1.2 GigabitEthernet0/0/2.1 10.1.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/2.1 10.1.1.111/32 OSPF 10 2 D 10.1.1.1 GigabitEthernet0/0/2.1 OSPF 10 2 D 10.1.2.1 GigabitEthernet0/0/2.2 10.1.2.0/24 Direct 0 0 D 10.1.2.2 GigabitEthernet0/0/2.2 10.1.2.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/2.2 10.1.2.111/32 OSPF 10 2 D 10.1.1.1 GigabitEthernet0/0/2.1 OSPF 10 2 D 10.1.2.1 GigabitEthernet0/0/2.2 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0 192.168.1.0/24 Direct 0 0 D 192.168.1.1 GigabitEthernet0/0/1 192.168.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1 192.168.2.0/24 OSPF 10 2 D 192.168.1.2 GigabitEthernet0/0/1 OSPF 10 2 D 10.1.1.1 GigabitEthernet0/0/2.1 OSPF 10 2 D 10.1.2.1 GigabitEthernet0/0/2.2
# Run the shutdown command on GE0/0/2.1 of SwitchA to simulate a link fault.
[SwitchA] interface gigabitethernet 0/0/2.1 [SwitchA-GigabitEthernet0/0/2.1] shutdown [SwitchA-GigabitEthernet0/0/2.1] quit
# Run the display vrrp command on SwitchA and SwitchB. You can see that SwitchA is in Initialize state and SwitchB is in Master state in VRRP group 1.
[SwitchA] display vrrp
GigabitEthernet0/0/2.1 | Virtual Router 1
State : Initialize
Virtual IP : 10.1.1.111
Master IP : 0.0.0.0
PriorityRun : 120
PriorityConfig : 120
MasterPriority : 0
Preempt : YES Delay Time : 20 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0101
Check TTL : YES
Config type : normal-vrrp
Backup-forward : disabled
Create time : 2012-05-29 21:27:47
Last change time : 2012-05-29 21:29:10
GigabitEthernet0/0/2.2 | Virtual Router 2
State : Master
Virtual IP : 10.1.2.111
Master IP : 10.1.2.1
PriorityRun : 120
PriorityConfig : 120
MasterPriority : 120
Preempt : YES Delay Time : 20 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0102
Check TTL : YES
Config type : normal-vrrp
Backup-forward : disabled
Create time : 2012-05-29 21:25:47
Last change time : 2012-05-29 21:27:10
[SwitchB] display vrrp
GigabitEthernet0/0/2.1 | Virtual Router 1
State : Master
Virtual IP : 10.1.1.111
Master IP : 10.1.1.2
PriorityRun : 100
PriorityConfig : 100
MasterPriority : 100
Preempt : YES Delay Time : 0 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0101
Check TTL : YES
Config type : normal-vrrp
Backup-forward : disabled
Create time : 2012-05-29 21:27:47
Last change time : 2012-05-29 21:29:10
GigabitEthernet0/0/2.2 | Virtual Router 2
State : Backup
Virtual IP : 10.1.2.111
Master IP : 10.1.2.1
PriorityRun : 100
PriorityConfig : 100
MasterPriority : 120
Preempt : YES Delay Time : 0 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0102
Check TTL : YES
Config type : normal-vrrp
Backup-forward : disabled
Create time : 2012-05-29 21:25:47
Last change time : 2012-05-29 21:27:10
# Run the undo shutdown command on GE0/0/2.1 of SwitchA.
[SwitchA] interface gigabitethernet 0/0/2.1 [SwitchA-GigabitEthernet0/0/2.1] undo shutdown [SwitchA-GigabitEthernet0/0/2.1] quit
# After 20s, run the display vrrp command on SwitchA and SwitchB. You can see that SwitchA is in Master state and SwitchB is in Backup state in VRRP group 1.
[SwitchA] display vrrp
GigabitEthernet0/0/2.1 | Virtual Router 1
State : Master
Virtual IP : 10.1.1.111
Master IP : 10.1.1.1
PriorityRun : 120
PriorityConfig : 120
MasterPriority : 120
Preempt : YES Delay Time : 20 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0101
Check TTL : YES
Config type : normal-vrrp
Backup-forward : disabled
Create time : 2012-05-29 21:29:47
Last change time : 2012-05-29 21:31:10
GigabitEthernet0/0/2.2 | Virtual Router 2
State : Master
Virtual IP : 10.1.2.111
Master IP : 10.1.2.1
PriorityRun : 120
PriorityConfig : 120
MasterPriority : 120
Preempt : YES Delay Time : 20 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0102
Check TTL : YES
Config type : normal-vrrp
Backup-forward : disabled
Create time : 2012-05-29 21:25:47
Last change time : 2012-05-29 21:27:10
[SwitchB] display vrrp
GigabitEthernet0/0/2.1 | Virtual Router 1
State : Backup
Virtual IP : 10.1.1.111
Master IP : 10.1.1.1
PriorityRun : 100
PriorityConfig : 100
MasterPriority : 120
Preempt : YES Delay Time : 0 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0101
Check TTL : YES
Config type : normal-vrrp
Backup-forward : disabled
Create time : 2012-05-29 21:29:47
Last change time : 2012-05-29 21:31:10
GigabitEthernet0/0/2.2 | Virtual Router 2
State : Backup
Virtual IP : 10.1.2.111
Master IP : 10.1.2.1
PriorityRun : 100
PriorityConfig : 100
MasterPriority : 120
Preempt : YES Delay Time : 0 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0102
Check TTL : YES
Config type : normal-vrrp
Backup-forward : disabled
Create time : 2012-05-29 21:25:47
Last change time : 2012-05-29 21:27:10
SwitchA configuration file
#
sysname SwitchA
#
interface GigabitEthernet0/0/1
undo portswitch
ip address 192.168.2.1 255.255.255.0
#
interface GigabitEthernet0/0/2
undo portswitch
#
interface GigabitEthernet0/0/2.1
qinq termination pe-vid 100 ce-vid 10
ip address 10.1.1.1 255.255.255.0
vrrp vrid 1 virtual-ip 10.1.1.111
vrrp vrid 1 priority 120
vrrp vrid 1 preempt-mode timer delay 20
#
interface GigabitEthernet0/0/2.2
qinq termination pe-vid 100 ce-vid 20
ip address 10.1.2.1 255.255.255.0
vrrp vrid 2 virtual-ip 10.1.2.111
vrrp vrid 2 priority 120
vrrp vrid 2 preempt-mode timer delay 20
#
ospf 1
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 10.1.2.0 0.0.0.255
network 192.168.2.0 0.0.0.255
#
return
SwitchB configuration file
#
sysname SwitchB
#
interface GigabitEthernet0/0/1
undo portswitch
ip address 192.168.1.1 255.255.255.0
#
interface GigabitEthernet0/0/2
undo portswitch
#
interface GigabitEthernet0/0/2.1
qinq termination pe-vid 100 ce-vid 10
ip address 10.1.1.2 255.255.255.0
vrrp vrid 1 virtual-ip 10.1.1.111
#
interface GigabitEthernet0/0/2.2
qinq termination pe-vid 100 ce-vid 20
ip address 10.1.2.2 255.255.255.0
vrrp vrid 2 virtual-ip 10.1.2.111
#
ospf 1
area 0.0.0.0
network 10.1.1.0 0.0.0.255
network 10.1.2.0 0.0.0.255
network 192.168.1.0 0.0.0.255
#
return
SwitchC configuration file
#
sysname SwitchC
#
interface GigabitEthernet0/0/1
undo portswitch
ip address 192.168.2.2 255.255.255.0
#
interface GigabitEthernet0/0/2
undo portswitch
ip address 192.168.1.2 255.255.255.0
#
ospf 1
area 0.0.0.0
network 192.168.1.0 0.0.0.255
network 192.168.2.0 0.0.0.255
#
return
LSW1 configuration file
# sysname LSW1 # vlan batch 100 # interface GigabitEthernet0/0/1 port link-type hybrid qinq vlan-translation enable port vlan-stacking vlan 10 stack-vlan 100 # interface GigabitEthernet0/0/2 port link-type trunk port trunk allow-pass vlan 100 # interface GigabitEthernet0/0/3 port link-type trunk port trunk allow-pass vlan 100 # interface GigabitEthernet0/0/4 port link-type hybrid qinq vlan-translation enable port vlan-stacking vlan 20 stack-vlan 100 # return
LSW2 configuration file
# sysname LSW2 # vlan batch 10 # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 10 # interface GigabitEthernet0/0/2 port link-type access port default vlan 10 # return
LSW3 configuration file
# sysname LSW3 # vlan batch 20 # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 20 # interface GigabitEthernet0/0/2 port link-type access port default vlan 20 # return