用VRRP配置三层冗余
1.1.
实验目的:
掌握三层网管协议
VRRP
的配置和实验验证;
1.2. 实验
拓扑
1.3
实验配置及验证
方法
(1) 在R1和R2,PC1和PC2上做好基础配置,分别在PC1和PC2上ping 10.1.1 .1和ping 10.1.1.2 ,traceroute 10.1.1.1和traceroute 10.1.1.2。
PC1#ping 10.1.1 .1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1 .1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/230/1076 ms
PC1#tr
PC1#traceroute 10.1.1 .1
Type escape sequence to abort.
Tracing the route to 10.1.1 .1
1 192.168.1.1 32 msec * 36 msec //走的是192.168.1.1 网关
PC2#ping 10.1.1 .1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1 .1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/216/1020 ms
PC2#tr
PC2#traceroute 10.1.1 .1
Type escape sequence to abort.
Tracing the route to 10.1.1 .1
1 192.168.1.2 52 msec * 28 msec //走的是192.168.1.2网关
(2) 此时down掉R2的f0/0接口,分别在R1和R2上ping 10.1.1 .1 traceroute 10.1.1.1
PC1#ping 10.1.1 .1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1 .1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
PC1#tr
PC1#traceroute 10.1.1 .1
Type escape sequence to abort.
Tracing the route to 10.1.1 .1
1 * * *
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
8 * * * // R1已经ping不通 10.1.1 .1 且没有网关
PC2#ping 10.1.1 .1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.1 .1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/219/1024 ms
PC2#traceroute 10.1.1 .1
Type escape sequence to abort.
Tracing the route to 10.1.1 .1
1 192.168.1.2 88 msec * 56 msec // PC2任然可以ping同 10.1.1 .1,且通过R2这个问题说明并没有真正利用好两个路由器之间的冗余,没有起到他们应有的作用,下面通过配置VRRP实现他们的冗余
(3) 在R1和R2上配置VRRP
进入相应的端口
R1(config-if)#vrrp 1 ip 192.168.1.1
*Mar 1 00:13:09.867: %VRRP-6-STATECHANGE: Fa0/0 Grp 1 state Init -> Master //显示R1处于Master
R1(config-if)#vrrp 1 priority 200
% Priority change will have no effect whilst interface is VRRP address owner
R1(config-if)#vrrp 1 preempt
R2(config-if)#vrrp 1 ip 192.168.1.1
R2(config-if)#vrrp 1 priority 100
R2(config-if)#vrrp 1 preempt
*Mar 1 00:14:42.443: %VRRP-6-STATECHANGE: Fa0/0 Grp 1 state Init -> Backup // 显示R2处于备份状态, 因为R2的优先级100小于R1的优先级200
R1(config-if)#vrrp 2 ip 192.168.1.2
R1(config-if)#
*Mar 1 00:15:15.607: %VRRP-6-STATECHANGE: Fa0/0 Grp 2 state Init -> Backup
R1(config-if)#
*Mar 1 00:15:19.219: %VRRP-6-STATECHANGE: Fa0/0 Grp 2 state Backup -> Master
R1(config-if)#
*Mar 1 00:15:19.303: %IP-4-DUPADDR: Duplicate address 192.168.1.2 on FastEthernet0/0, sourced by cc01.0cd8.0000
R1(config-if)#vrrp 2 priority 100
R1(config-if)#
*Mar 1 00:15:49.731: %IP-4-DUPADDR: Duplicate address 192.168.1.2 on FastEthernet0/0, sourced by cc01.0cd8.0000
R1(config-if)#vrrp 2 preempt
R2(config-if)#vrrp 2 ip 192.168.1.2
R2(config-if)#
*Mar 1 00:16:10.815: %VRRP-6-STATECHANGE: Fa0/0 Grp 2 state Init -> Master // 可见R2处于Active状态
R2(config-if)#vrrp 2 preempt
R2(config-if)#vrrp 2 priority 200
% Priority change will have no effect whilst interface is VRRP address owner
R2(config-if)#vrrp 2 preempt
为验证,再查看R1和R2的vrrp信息
R1#sh vrrp
FastEthernet0/0 - Group 1
State is Master //状态时Master状态
Virtual IP address is 192.168.1.1
Virtual MAC address is 0000.5e00.0101
Advertisement interval is 1.000 sec
Preemption enabled
Priority is 255 (cfgd 200)
Master Router is 192.168.1.1 (local), priority is 255 // Master Router 是192.168.1.1
Master Advertisement interval is 1.000 sec
Master Down interval is 3.003 sec
FastEthernet0/0 - Group 2
State is Backup //状态时Backup状态
Virtual IP address is 192.168.1.2
Virtual MAC address is 0000.5e00.0102
Advertisement interval is 1.000 sec
Preemption enabled
Priority is 100
Master Router is 192.168.1.2, priority is 255 Master Router 是192.168.1.1
Master Advertisement interval is 1.000 sec
Master Down interval is 3.609 sec (expires in 2.717 sec)
R2(config-if)#do sh vrrp
FastEthernet0/0 - Group 1
State is Backup
Virtual IP address is 192.168.1.1
Virtual MAC address is 0000.5e00.0101
Advertisement interval is 1.000 sec
Preemption enabled
Priority is 100
Master Router is 192.168.1.1, priority is 255
Master Advertisement interval is 1.000 sec
Master Down interval is 3.609 sec (expires in 2.877 sec)
FastEthernet0/0 - Group 2
State is Master
Virtual IP address is 192.168.1.2
Virtual MAC address is 0000.5e00.0102
Advertisement interval is 1.000 sec
Preemption enabled
Priority is 255 (cfgd 200)
Master Router is 192.168.1.2 (local), priority is 255
Master Advertisement interval is 1.000 sec
Master Down interval is 3.003 sec
在PC1上ping 10.1.1 .1 1000个数据包,在中间把R1上的f0/0接口shutdown
R1(config-if)#
*Mar 1 00:19:32.791: %VRRP-6-STATECHANGE: Fa0/0 Grp 1 state Master -> Init
*Mar 1 00:19:32.791: %VRRP-6-STATECHANGE: Fa0/0 Grp 2 state Backup -> Init
R1(config-if)#no shut
R1(config-if)#
*Mar 1 00:20:53.983: %VRRP-6-STATECHANGE: Fa0/0 Grp 1 state Init -> Master
*Mar 1 00:20:53.987: %VRRP-6-STATECHANGE: Fa0/0 Grp 2 state Init -> Backup
PC1#ping 10.1.1 .1 repeat 1000
Type escape sequence to abort.
Sending 1000, 100-byte ICMP Echos to 10.1.1 .1, timeout is 2 seconds:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!..!!!!!!!!!!!!!!
//在短暂的中断后,又开始ping通
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
PC1#traceroute 10.1.1 .1
Type escape sequence to abort.
Tracing the route to 10.1.1 .1
1 192.168.1.2 68 msec * 28 msec //经过的网关是192.168.1.2,可见现在已经实现的冗余
注意:在PC上ping的时候,要用clear arp命令,清除ARP