这里只单纯配置了VRRP
创建两个vlan 10 20,做负载分担
两台是设备Eth-trunk1口放行vlan10 20
SW1配置
[sw1]vlan batch 10 20 [sw1]interface vlan10 [sw1-Vlanif10]ip ad 192.168.10.1 24 #配置物理网关地址 [sw1-Vlanif10]vrrp vrid 1 virtual-ip 192.168.10.254 #配置vrrp组1 配置虚拟网关地址 [sw1-Vlanif10]vrrp vrid 1 priority 120 #配置优先级为120,默认100数字越大越优先,使它成为vlan10的Master [sw1-Vlanif10]vrrp vrid 1 track interface GigabitEthernet0/0/3 reduced 30 #检测上联端口,如果断开优先级降低30(之后会作为backup) [sw1-Vlanif10]dis this # interface Vlanif10 ip address 192.168.10.1 255.255.255.0 vrrp vrid 1 virtual-ip 192.168.10.254 vrrp vrid 1 priority 120 vrrp vrid 1 track interface GigabitEthernet0/0/3 reduced 30 # [sw1-Vlanif20]ip address 192.168.20.1 255.255.255.0 #配置vlan20的物理网关 [sw1-Vlanif20]vrrp vrid 2 virtual-ip 192.168.20.254 #配置vlan20的虚拟网关 [sw1-Vlanif20]vrrp vrid 2 preempt-mode timer delay 20 #延迟20秒后抢占 [sw1-Vlanif20]dis this # interface Vlanif20 ip address 192.168.20.1 255.255.255.0 vrrp vrid 2 virtual-ip 192.168.20.254 vrrp vrid 2 preempt-mode timer delay 20 #
SW2配置
[sw2]vlan batch 10 20 [sw2-Vlanif10]dis this # interface Vlanif10 ip address 192.168.10.2 255.255.255.0 #配置vlan10网关 vrrp vrid 1 virtual-ip 192.168.10.254 #配置vrrp组1 配置虚拟网关和SW1一样 vrrp vrid 1 preempt-mode timer delay 20 #延迟20s后抢占 # [sw2-Vlanif20]dis this # interface Vlanif20 ip address 192.168.20.2 255.255.255.0 #配置vlan20网关 vrrp vrid 2 virtual-ip 192.168.20.254 #配置vrrp组2 配置虚拟网关和SW1一样 vrrp vrid 2 priority 120 #配置优先级为120,使vrrp2 成为vlan20的Master
vrrp vrid 2 track interface GigabitEthernet0/0/22 reduced 30 #配置上联链路检测,如果断开优先级减去30 使它成为backup
#
查看vrrp状态
SW1
<sw1>dis vrrp Vlanif10 | Virtual Router 1 State : Master #vrid1组为vlan10的Master Virtual IP : 192.168.10.254 Master IP : 192.168.10.1 PriorityRun : 120 PriorityConfig : 120 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 Track IF : GigabitEthernet0/0/3 Priority reduced : 30 IF state : UP Create time : 2021-09-07 08:22:09 UTC-08:00 Last change time : 2021-09-07 10:22:52 UTC-08:00 Vlanif20 | Virtual Router 2 State : Backup #vrid2组为vlan20的backup Virtual IP : 192.168.20.254 Master IP : 192.168.20.2 PriorityRun : 100 PriorityConfig : 100 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 Create time : 2021-09-07 08:31:38 UTC-08:00 Last change time : 2021-09-07 10:54:05 UTC-08:00
SW2
[sw2]dis vrrp Vlanif10 | Virtual Router 1 State : Backup #vrid1为vlan10的backup Virtual IP : 192.168.10.254 Master IP : 192.168.10.1 PriorityRun : 100 PriorityConfig : 100 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 Create time : 2021-09-07 08:22:37 UTC-08:00 Last change time : 2021-09-07 10:22:52 UTC-08:00 Vlanif20 | Virtual Router 2 State : Master #vrid2为vlan20的Master Virtual IP : 192.168.20.254 Master IP : 192.168.20.2 PriorityRun : 120 PriorityConfig : 120 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 Track IF : GigabitEthernet0/0/22 Priority reduced : 30 IF state : UP Create time : 2021-09-07 08:32:01 UTC-08:00 Last change time : 2021-09-07 10:54:05 UTC-08:00
这样可实现负载分担,vlan10的流量走SW1,vlan20的流量走SW2