1.3
实验配置及验证
方法
(1)
在
R1
和
R2
,
PC1
和
PC2
上做好基础配置,分别在
PC1
和
PC2
上
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 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.12
网管
(
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 preem
R2(config-if)#vrrp 1 priority 100
R2(config-if)#vrrp 1 preempt
R2(config-if)#vrrp 1 ip 192.168.1.1
*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 pri
R2(config-if)#vrrp 2 priority 200
% Priority change will have no effect whilst interface is VRRP address owner
R2(config-if)#vrrp 2 preem
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