VRRP(Virtual Router Redundancy Protocol,虚拟路由冗余协议)
VRRP Router角色(dis vrrp)
一.Master:主用
选择:1.优先级最高(可抢占);2.IP最高(不可抢占)。
作用:1.用VMAC应答主机ARP请求;2.转发用户Data。
二.Backup:备用
监听Master定期(1秒)发送的通告,在Master_Down_Interval时间内未收到,则认为Master失效,立即成为Master,即切换。
SW1
syst
sysn SW1
vlan 2
int ether 0/0/1
port link-t trun
port trunk all vla all
int ether 0/0/2
port link-t trun
port trunk all vla all
int vlanif 2
ip add 192.168.20.5 24
ospf 1
ar 0
net 192.168.20.0 0.0.0.255
user-interf con 0
idle-t 0 0
q
SW2
syst
sysn SW2
int ether 0/0/1
port link-t trun
port trunk all vla all
int ether 0/0/2
port link-t trun
port trunk all vla all
user-interf con 0
idle-t 0 0
q
SWA
syst
sysn SWA
vlan 2
int g0/0/1
port link-t trun
port trunk all vla all
int g0/0/2
port link-t trun
port trunk all vla all
int vlanif 1
ip add 192.168.10.1 24
int vlanif 2
ip add 192.168.20.1 24
ospf 1
ar 0
net 192.168.10.0 0.0.0.255
net 192.168.20.0 0.0.0.255
user-interf con 0
idle-t 0 0
q
SWB
syst
sysn SWB
vlan 2
int g0/0/1
port link-t trun
port trunk all vla all
int g0/0/2
port link-t trun
port trunk all vla all
int vlanif 1
ip add 192.168.10.2 24
int vlanif 2
ip add 192.168.20.2 24
ospf 1
ar 0
net 192.168.10.0 0.0.0.255
net 192.168.20.0 0.0.0.255
user-interf con 0
idle-t 0 0
q
SWA
return
sys
stp priority 4096
int g0/0/3
port link-type trunk
port trunk allow-pass vlan all
int vlanif 1
vrrp vrid 1 virtual-ip 192.168.10.254
vrrp vrid 1 priority 110
dis vrrp
SWB
return
sys
stp priority 8192
int g0/0/3
port link-type trunk
port trunk allow-pass vlan all
int vlanif 1
vrrp vrid 1 virtual-ip 192.168.10.254
dis vrrp
验证测试
#CLIENT1
tracert 192.168.20.5
#SWA
return
sys
int vlanif 1
sh
#CLIENT1
tracert 192.168.20.5
#SWA
return
sys
int vlanif 1
undo sh
#CLIENT1
tracert 192.168.20.5
接口跟踪(Track)功能,当上行链路(Uplink)down时,Master降低优先级(默认降低10),进行主备切换;当上行链路恢复up,原Master恢复优先级,抢占为Master,即回切。
SWA
sys
int vlanif 1
vrrp vrid 1 track int g0/0/2 redu 20
vrrp vrid 1 track int g0/0/3 redu 20
#关闭接口验证
int g0/0/2
sh
dis vrrp
#CLIENT1
tracert 192.168.20.5
#SWA开启接口验证是否恢复
sys
int g0/0/2
undo sh
dis vrrp
#CLIENT1
tracert 192.168.20.5