VRRP 实验
1、 实现PC1和PC2的流量分别走R1和R2,实现负载均衡
2、 跟踪端口,当外部链路出现故障实现主备切换.
R1#conf t
R1(config)#interface e0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#
R1(config-if)#vrrp 10 ip 192.168.1.254 vrrp 10号组虚拟ip地址
R1(config-if)#vrrp 10 priority 120 设置R1的vrrp10号组优先级为120 (R1成为主路由)
R1(config-if)#vrrp 10 preempt 设置抢占模式(默认开启)
R1(config-if)#vrrp 20 ip 192.168.1.253 vrrp 20号组虚拟ip地址
R1(config-if)#vrrp 20 preempt 设置抢占模式(默认开启)
R1(config-if)#vrrp 20 priority 100 设置R1的vrrp20号组优先级为100 (默认)
R1#wr 保存配置
R2#conf t
R2(config)#interface e0/0
R2(config-if)#ip add 192.168.1.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#vrrp 10 ip 192.168.1.254
R2(config-if)#vrrp 10 preempt
R2(config-if)#vrrp 20 ip 192.168.1.253
R2(config-if)#vrrp 20 priority 120
R2(config-if)#vrrp 20 preempt
R2(config-if)#end
R2#
R2#show vrrp 查看结果,R1是10组的master,R2是20组的master
Ethernet0/0 - Group 10
State is Backup
Virtual IP address is 192.168.1.254
Virtual MAC address is 0000.5e00.010a
Advertisement interval is 1.000 sec
Preemption enabled
Priority is 100
Master Router is 192.168.1.1, priority is 120
Master Advertisement interval is 1.000 sec
Master Down interval is 3.609 sec (expires in 2.813 sec)
Ethernet0/0 - Group 20
State is Master
Virtual IP address is 192.168.1.253
Virtual MAC address is 0000.5e00.0114
Advertisement interval is 1.000 sec
Preemption enabled
Priority is 120
Master Router is 192.168.1.2 (local), priority is 120
Master Advertisement interval is 1.000 sec
Master Down interval is 3.531 sec
R2#wr 保存配置
原文地址:http://blog.51cto.com/ronning/2296148