VRRP在三层交换机上的虚拟网关设置与链路的负载均衡,浮动路由

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了VRRP在三层交换机上的虚拟网关设置与链路的负载均衡,浮动路由相关的知识,希望对你有一定的参考价值。

技术分享图片
技术分享图片
技术分享图片
技术分享图片
技术分享图片
一:创建VLAN10 20 30 40 100 200 并将PC机加入不同的vLan。
[sw1]vlan batch 10 20 30 40 100 200
[sw1]int g0/0/1
[sw1-GigabitEthernet0/0/1]port link-type access
[sw1-GigabitEthernet0/0/1]port default vlan 10
[sw1-GigabitEthernet0/0/1]int g0/0/2
[sw1-GigabitEthernet0/0/2]port link-type access
[sw1-GigabitEthernet0/0/2]port default vlan 20
[sw1-GigabitEthernet0/0/2]int g0/0/3
[sw1-GigabitEthernet0/0/3]port link-type access
[sw1-GigabitEthernet0/0/3]port default vlan 30
[sw1-GigabitEthernet0/0/3]int g0/0/4
[sw1-GigabitEthernet0/0/4]port link-type access
[sw1-GigabitEthernet0/0/4]port default vlan 40
[sw1-GigabitEthernet0/0/4]int g0/0/13
[sw1-GigabitEthernet0/0/13]port link-type trunk
[sw1-GigabitEthernet0/0/13]port trunk allow-pass vlan all
[sw1-GigabitEthernet0/0/13]int g0/0/12
[sw1-GigabitEthernet0/0/12]port link-type trunk
[sw1-GigabitEthernet0/0/12]port trunk allow-pass vlan all

二:设置SW2(vlan),设置虚拟IP并设置优先级
[sw2]vlan batch 10 20 30 40 100 200
[sw2]int g0/0/12
[sw2-GigabitEthernet0/0/12]port link-type trunk
[sw2-GigabitEthernet0/0/12]port trunk allow-pass vlan all
[sw2]int Vlanif 10
[sw2-Vlanif10]ip address 192.168.10.252 24
[sw2-Vlanif10]int Vlanif 20
[sw2-Vlanif20]ip address 192.168.20.252 24
[sw2-Vlanif20]int Vlanif 30
[sw2-Vlanif30]ip address 192.168.30.252 24
[sw2-Vlanif30]int Vlanif 40
[sw2-Vlanif40]ip address 192.168.40.252 24
[sw2]int g0/0/1
[sw2-GigabitEthernet0/0/1]port link-type access
[sw2-GigabitEthernet0/0/1]port default vlan 100
[sw2]int Vlanif 100
[sw2-Vlanif100]ip address 192.168.100.1 24
三:设置SW2路由表条目
[sw2]ip route-static 192.168.50.0 24 192.168.100.2
三:设置SW2虚拟IP并设置优先级(默认100选大于100的)
[sw2]int Vlanif 10
[sw2-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.254
[sw2-Vlanif10]int Vlanif 20
[sw2-Vlanif20]vrrp vrid 20 virtual-ip 192.168.20.254
[sw2]int Vlanif 30
[sw2-Vlanif30]vrrp vrid 30 virtual-ip 192.168.30.254
[sw2-Vlanif30]int Vlanif 40
[sw2-Vlanif40]vrrp vrid 40 virtual-ip 192.168.40.254
[sw2]int Vlanif 10
[sw2-Vlanif10]vrrp vrid 10 priority 200
[sw2-Vlanif10]int Vlanif 30
[sw2-Vlanif30]vrrp vrid 30 priority 200

[sw2]int Vlanif 10
[sw2-Vlanif10]vrrp vrid 10track interface g0/0/1 reduced 150
[sw2]int Vlanif 30
[sw2-Vlanif30]vrrp vrid 30 track interface g0/0/1 reduced 150
四:设置SW3(vlan),设置虚拟IP并设置优先级
[sw3]vlan batch 10 20 30 40 100 200
[sw3]int g0/0/13
[sw3-GigabitEthernet0/0/13]port link-type trunk
[sw3-GigabitEthernet0/0/13]port trunk allow-pass vlan all
[sw3]int Vlanif 10
[sw3-Vlanif10]ip address 192.168.10.253 24
[sw3-Vlanif10]int Vlanif 20
[sw3-Vlanif20]ip address 192.168.20.253 24
[sw3-Vlanif20]int Vlanif 30
[sw3-Vlanif30]ip address 192.168.30.253 24
[sw3-Vlanif30]int Vlanif 40
[sw3-Vlanif40]ip address 192.168.40.253 24
[sw3]int g0/0/1
[sw3-GigabitEthernet0/0/1]port link-type access
[sw3-GigabitEthernet0/0/1]port default vlan 200
[sw3]int Vlanif 200
[sw3-Vlanif200]ip address 192.168.200.1 24
五.SW3上设置路由表
[sw3]ip route-static 192.168.50.0 24 192.168.200.2

[sw3]int Vlanif 10
[sw3-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.254
[sw3-Vlanif10]int Vlanif 20
[sw3-Vlanif20]vrrp vrid 20 virtual-ip 192.168.20.254
[sw3]int Vlanif 30
[sw3-Vlanif30]vrrp vrid 30 virtual-ip 192.168.30.254
[sw3-Vlanif30]int Vlanif 40
[sw3-Vlanif40]vrrp vrid 40 virtual-ip 192.168.40.254
[sw3]int Vlanif 20
[sw3-Vlanif20]vrrp vrid 20 priority 200
[sw3-Vlanif20]int Vlanif 40
[sw3-Vlanif40]vrrp vrid 40 priority 200
[sw3]int Vlanif 20
[sw3-Vlanif20]vrrp vrid 20 track interface g0/0/1 reduced 150
[sw3]int Vlanif 40
[sw3-Vlanif40]vrrp vrid 40 track interface g0/0/1 reduced 150

设置路由器
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip address 192.168.100.2 24
[r1-GigabitEthernet0/0/0]int g0/0/1
[r1-GigabitEthernet0/0/1]ip address 192.168.200.2 24
[r1-GigabitEthernet0/0/1]int g2/0/0
[r1-GigabitEthernet2/0/0]ip address 192.168.50.1 24
[r1]ip route-static 192.168.10.0 24 192.168.100.1
[r1]ip route-static 192.168.30.0 24 192.168.100.1
[r1]ip route-static 192.168.20.0 24 192.168.200.1
[r1]ip route-static 192.168.40.0 24 192.168.200.1
[r1]ip route-static 192.168.10.0 24 192.168.200.1 preference 80
[r1]ip route-static 192.168.30.0 24 192.168.200.1 preference 80
[r1]ip route-static 192.168.20.0 24 192.168.100.1 preference 80
[r1]ip route-static 192.168.40.0 24 192.168.100.1 preference 80
验证
技术分享图片技术分享图片技术分享图片技术分享图片

以上是关于VRRP在三层交换机上的虚拟网关设置与链路的负载均衡,浮动路由的主要内容,如果未能解决你的问题,请参考以下文章

通过MSTP和VRRP实现网关备份,以及负载均衡

中小企业利用VRRP实现链路负载均衡

VRRP(路由交换之虚拟网关冗余技术)

在三层交换机上实现DHCP中继实验二

华为USG防火墙双机热备(业务口工作在三层上下行连接交换机)

怎样在三层交换机上配置DHCP中继