LSW1配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys lsw1
[lsw1]vlan batch 10 20 30
[lsw1]int g0/0/1
[lsw1-GigabitEthernet0/0/1]port link-type access
[lsw1-GigabitEthernet0/0/1]port default vlan 10
[lsw1-GigabitEthernet0/0/1]int g0/0/3
[lsw1-GigabitEthernet0/0/3]port link-type access
[lsw1-GigabitEthernet0/0/3]port default vlan 10
[lsw1-GigabitEthernet0/0/3]int g0/0/5
[lsw1-GigabitEthernet0/0/5]port link-type access
[lsw1-GigabitEthernet0/0/5]port default vlan 20
[lsw1-GigabitEthernet0/0/5]int g0/0/6
[lsw1-GigabitEthernet0/0/6]port link-type access
[lsw1-GigabitEthernet0/0/6]port default vlan 20
[lsw1-GigabitEthernet0/0/6]
[lsw1-GigabitEthernet0/0/6]int g0/0/2
[lsw1-GigabitEthernet0/0/2]port link-type trunk
[lsw1-GigabitEthernet0/0/2]port trunk allow-pass vlan all
[lsw1-GigabitEthernet0/0/2]int g0/0/4
[lsw1-GigabitEthernet0/0/4]port link-type trunk
[lsw1-GigabitEthernet0/0/4]port trunk allow-pass vlan all #
stp region-configurationregion-name lyinstance 1 vlan 10instance 2 vlan 20active region-configuration
#
LSW2配置
sysname lsw2
#
undo info-center enable
#
vlan batch 10 20 30
#
stp instance 1 root primary
stp instance 2 root secondary
#
stp region-configurationregion-name lyinstance 1 vlan 10instance 2 vlan 20active region-configuration
#
bfd
#
interface Vlanif1
#
interface Vlanif10ip address 192.168.1.254 255.255.255.0vrrp vrid 1 virtual-ip 192.168.1.252vrrp vrid 1 priority 120vrrp vrid 1 preempt-mode timer delay 20
#
interface Vlanif20ip address 192.168.2.253 255.255.255.0vrrp vrid 2 virtual-ip 192.168.2.252
#
interface Vlanif30ip address 192.168.3.2 255.255.255.0
#
interface Eth-Trunk1port link-type trunkport trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/1port link-type trunkport trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2port link-type trunkport trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3eth-trunk 1
#
interface GigabitEthernet0/0/4eth-trunk 1
#
bfd 1 bind peer-ip 192.168.3.1discriminator local 1discriminator remote 2commit
#
LSW3配置
sysname lsw3
#
undo info-center enable
#
vlan batch 10 20 30
#
stp region-configurationregion-name lyinstance 1 vlan 10instance 2 vlan 20active region-configuration
#
interface GigabitEthernet0/0/1port link-type trunkport trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2port link-type trunkport trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3port link-type trunkport trunk allow-pass vlan 2 to 4094
#
LSW4配置
sysname lsw4
#
undo info-center enable
#
vlan batch 10 20 30
#
stp instance 1 root secondary
stp instance 2 root primary
#
stp region-configurationregion-name lyinstance 1 vlan 10instance 2 vlan 20active region-configuration
#
interface Vlanif10ip address 192.168.1.253 255.255.255.0vrrp vrid 1 virtual-ip 192.168.1.252
#
interface Vlanif20ip address 192.168.2.254 255.255.255.0vrrp vrid 2 virtual-ip 192.168.2.252vrrp vrid 2 priority 120vrrp vrid 2 preempt-mode timer delay 20
#
interface Vlanif30ip address 192.168.3.3 255.255.255.0
#
interface MEth0/0/1
#
interface Eth-Trunk1port link-type trunkport trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/1port link-type trunkport trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2port link-type trunkport trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3eth-trunk 1
#
interface GigabitEthernet0/0/4eth-trunk 1
#
AR1配置
sysname AR2
#
vlan batch 10 20 30
#
bfd
#
interface Vlanif30ip address 192.168.3.1 255.255.255.0
#
interface Ethernet0/0/0port link-type trunkport trunk allow-pass vlan 2 to 4094
#
bfd 1 bind peer-ip 192.168.3.2discriminator local 2discriminator remote 1commit
#
ip route-static 192.168.1.0 255.255.255.0 192.168.3.2
ip route-static 192.168.1.0 255.255.255.0 192.168.3.3
ip route-static 192.168.2.0 255.255.255.0 192.168.3.2
ip route-static 192.168.2.0 255.255.255.0 192.168.3.3
效果