华为 VRRP虚拟路由器冗余协议冗余备份 负载均衡(也是如此简单)
在2层交换上配置:
<Huawei>sy
进视图模式
[Huawei]un in en
取消消息
[Huawei]sysname sw1
改名字
[sw1]vlan 10
添加
vlan
[sw1-vlan10]vlan 20
[sw1-vlan20]inter e0/0/1
进接口
[sw1-Ethernet0/0/1]port link-type access
划分到
vlan10
里
[sw1-Ethernet0/0/1]port default vlan 10
[sw1-Ethernet0/0/1]inter e0/0/2
[sw1-Ethernet0/0/2]port link-type access
[sw1-Ethernet0/0/2]port default vlan 20
[sw1-Ethernet0/0/2]inter e0/0/3
[sw1-Ethernet0/0/3]port link-type trunk
中继口
[sw1-Ethernet0/0/3]port trunk allow-pass vlan all
[sw1-Ethernet0/0/3]inter e0/0/4
[sw1-Ethernet0/0/4]port link-type trunk
[sw1-Ethernet0/0/4]port trunk allow-pass vlan all
LSW1上的配置
<Huawei>sy
[Huawei]vlan 10
添加
vlan
[Huawei-vlan10]vlan 20
[Huawei-vlan20]inter vlan 10
[Huawei-Vlanif10]ip address 192.168.10.10 255.255.255.0
设置
ip
地址
[Huawei-Vlanif10]un shut
开启
[Huawei-Vlanif10]q
[Huawei]un in en
取消信息
[Huawei]inter vlan 10
[Huawei-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1
添加虚拟网关
[Huawei-Vlanif10]vrrp vrid 1 priority 150
优先级
150
[Huawei-Vlanif10]vrrp vrid 1 preempt-mode timer delay 0
抢占时间
[Huawei-Vlanif10]vrrp vrid 1 track interface g0/0/2
跟踪接口
[Huawei-Vlanif10]vrrp vrid 1 track interface g0/0/1
[Huawei-Vlanif10]inter vlan 20
配置
vlan20
的
ip
地址
[Huawei-Vlanif20]ip address 192.168.20.10 255.255.255.0
[Huawei-Vlanif20]un shut
开启
[Huawei-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1
添加虚拟网关
[Huawei-Vlanif20]vrrp vrid 2 priority 145
优先级
[Huawei-Vlanif20]vrrp vrid 2 preempt-mode timer delay 0
抢占时间
[Huawei-Vlanif20]q
[Huawei]inter vlan 1
配置
vlan1 ip
地址
[Huawei-Vlanif1]ip address 202.106.1.10 255.255.255.0
[Huawei-Vlanif1]un shut
开启
Info: Interface Vlanif1 is not shutdown.
[Huawei-Vlanif1]q
[Huawei]ip route-static 0.0.0.0 0.0.0.0 202.106.1.1
默认路由
[Huawei]inter g0/0/1
[Huawei-GigabitEthernet0/0/1]port link-type trunk
中继口
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan all
LSW2上配置
<Huawei>sy
视图模式
[Huawei]un in en
取消消息提示
[Huawei]sysname lsw2
改名字
[lsw2]vlan 10
添加
vlan
[lsw2-vlan10]vlan 20
[lsw2-vlan20]inter vlan 10
给
vlan10
加
ip
地址
[lsw2-Vlanif10]ip address 192.168.10.11 255.255.255.0
[lsw2-Vlanif10]un shut
[lsw2-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.1
虚拟网关
[lsw2-Vlanif10]vrrp vrid 1 priority 145
优先级
[lsw2-Vlanif10]vrrp vrid 1 preempt-mode timer delay 0
抢占时间
[lsw2-Vlanif10]inter vlan 20
[lsw2-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.1
[lsw2-Vlanif20]vrrp vrid 2 priority 150
[lsw2-Vlanif20]vrrp vrid 2 preempt-mode timer delay 0
[lsw2-Vlanif20]vrrp vrid 2 track interface g0/0/1
[lsw2-Vlanif20]vrrp vrid 2 track interface g0/0/2
[lsw2-Vlanif20]inter vlan 1
[lsw2-Vlanif1]ip address 202.106.10.10 255.255.255.0
[lsw2-Vlanif1]un shut
[lsw2-Vlanif1]q
[lsw2]ip route-static 0.0.0.0 0.0.0.0 202.106.10.1
默认路由
[lsw2]inter g0/0/1
[lsw2-GigabitEthernet0/0/1]port link-type trunk
中继口
[lsw2-GigabitEthernet0/0/1]port trunk allow-pass vlan all
R1上配置:
<Huawei>sy
[Huawei]un in en
[Huawei]inter g0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 202.106.1.1 255.255.255.0
[Huawei-GigabitEthernet0/0/0]un shut
[Huawei-GigabitEthernet0/0/0]inter g0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 202.106.10.1 255.255.255.0
[Huawei-GigabitEthernet0/0/1]un shut
[Huawei-GigabitEthernet0/0/1]q
[Huawei]ip route-static 192.168.10.0 255.255.255.0 202.106.1.10
[Huawei]ip route-static 192.168.10.0 255.255.255.0 202.106.10.10
[Huawei]ip route-static 192.168.20.0 255.255.255.0 202.106.1.10
[Huawei]ip route-static 192.168.20.0 255.255.255.0 202.106.10.10
测试:
把一个接口down 跟踪路由查看效果