SW1:
<Huawei>u t m
<Huawei>sys
[Huawei]
[Huawei]sys SW1
[SW1]vlan bat 10 20 13
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW1]vlan 10
[SW1-vlan10]q
[SW1]int v 10
[SW1-Vlanif10]ip add 192.168.10.251 24 #配置SW1 vlan10 IP
[SW1-Vlanif10]int v 20
[SW1-Vlanif20]ip add 192.168.20.251 24 #配置SW1的Vlan 20 IP
[SW1-Vlanif20]vrrp vrid 20 virt 192.168.20.254 #在vlan 20虚接口配置vrrp
[SW1-Vlanif20]vrrp vrid 10 virt 192.168.10.254 #证明无法在vlan 20上配置不在vlan 20 所属网段的虚拟ip地址
Error: The virtual IP address is not within a subnet on this interface.
[SW1-Vlanif20]int v 10
[SW1-Vlanif10]vrrp vrid 10 virt 192.168.10.254 #在vlan 10虚接口配置vrrp
[SW1-Vlanif10]vrrp vrid 10 pri 130 #设为master路由
[SW1-Vlanif10]vrrp vrid 10 track int g0/0/2 redu 100 #做上行接口跟踪
[SW1-Vlanif10]q
[SW1]int g 0/0/1
[SW1-GigabitEthernet0/0/1]p l t
[SW1-GigabitEthernet0/0/1]p t a v 10 20
[SW1-GigabitEthernet0/0/1]q
[SW1]int vlan 10
[SW1-Vlanif10]ip route #证明无法在虚接口视图下配置静态路由
[SW1-Vlanif10]q
[SW1]ip route-static 192.168.3.0 24 192.168.13.3
[SW1]int v 13
[SW1-Vlanif13]ip add 192.168.13.1 24
[SW1-Vlanif13]q
[SW1]int g0/0/2
[SW1-GigabitEthernet0/0/2]p l a
[SW1-GigabitEthernet0/0/2]p d v 13
[SW1-GigabitEthernet0/0/2]q
[SW1]ip route-s 0.0.0.0 0 192.168.13.3 #拓扑图内还有2.0网段,省事情直接写默认路由
3.SW2配置:
SW2:
<Huawei>u t m
<Huawei>sys
[Huawei]sys SW@ #按错了
[SW@]sys SW2
[SW2]vlan bat 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW2]int v 10
[SW2-Vlanif10]ip add 192.168.10.252 24 #设置vlan 10的ip地址
[SW2-Vlanif10]vrrp vrid 10 vir 192.168.10.254 #配置vlan 10的vrrp 由于SW2非10.0网段的master路由,故不配置优先级了
[SW2-Vlanif10]int v 20
[SW2-Vlanif20]ip add 192.168.20.252 24 #设置vlan 20的ip
[SW2-Vlanif20]vrrp vrid 20 vir 192.168.20.254 #配置vlan 20的vrrp
[SW2-Vlanif20]vrrp vrid 20 pri 130
[SW2-Vlanif20]vrrp vrid 20 track int g0/0/2 redu 100 #配置上行接口跟踪
[SW2-Vlanif20]q
[SW2]int g0/0/2
[SW2-GigabitEthernet0/0/2]p l a
[SW2-GigabitEthernet0/0/2]p d v 20
[SW2-GigabitEthernet0/0/2]int g 0/0/1
[SW2-GigabitEthernet0/0/1]p l a
[SW2-GigabitEthernet0/0/1]p l t
[SW2-GigabitEthernet0/0/1]p t a v 20
[SW2-GigabitEthernet0/0/1]q
[SW2]ip route-s 192.168.3.0 24 192.168.23.3
[SW2]vlan bat 23
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW2]int g 0/0/2
[SW2-GigabitEthernet0/0/2]p d v 23
[SW2-GigabitEthernet0/0/2]q
[SW2]int v 23
[SW2-Vlanif23]ip add 192.168.23.1 24
[SW2-Vlanif23]q
[SW2]ip route-s 0.0.0.0 0 192.168.23.3
4. SW3配置:
SW3:
<Huawei>u t m
<Huawei>sys
[Huawei]sys SW3
[SW3]vlan bat 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW3]int g 0/0/1
[SW3-GigabitEthernet0/0/1]p l a
[SW3-GigabitEthernet0/0/1]p d v 10
[SW3-GigabitEthernet0/0/1]int g 0/0/2
[SW3-GigabitEthernet0/0/2]p l a
[SW3-GigabitEthernet0/0/2]p d v 20
[SW3-GigabitEthernet0/0/2]q
[SW3]port-g g g0/0/3 g0/0/4
[SW3-port-group]p l t
[SW3-GigabitEthernet0/0/3]p l t
[SW3-GigabitEthernet0/0/4]p l t
[SW3-port-group]p t a v 10 20
[SW3-GigabitEthernet0/0/3]p t a v 10 20
[SW3-GigabitEthernet0/0/4]p t a v 10 20
5.R1配置:
R1:
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]int g 0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 192.168.13.3 24
[Huawei-GigabitEthernet0/0/0]int g 0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 192.168.23.3 24
[Huawei-GigabitEthernet0/0/1]int g0/0/2
[Huawei-GigabitEthernet0/0/2]ip add 192.168.3.254 24
[Huawei-GigabitEthernet0/0/2]q
[Huawei]ip route-s 192.168.0.0 16 192.168.13.1
[Huawei]ip route-s 192.168.0.0 16 192.168.23.1 pre 70