----PC的配置-------
PC#configure terminal
PC(config)#no ip routing
PC(config)#ip default-gateway 192.168.1.100
PC(config)#interface e0/0
PC(config-if)#ip address 192.168.1.200 255.255.255.0
PC(config-if)#no shutdown
PC(config-if)#end
----R1的配置-------
R1#configure terminal
R1(config)#interface f0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#standby 1 ip 192.168.1.100
R1(config-if)#standby 1 priority 120
R1(config-if)#standby 1 preempt
R1(config-if)#standby 1 track s1/0 30
R1(config-if)#exit
R1(config-if)#interface s1/0
R1(config-if)#ip address 13.13.13.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#end
----R2的配置-------
R2#configure terminal
R2(config)#interface f0/0
R2(config-if)#ip address 192.168.1.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#standby 1 ip 192.168.1.100
R2(config-if)#standby 1 priority 100
R2(config-if)#standby 1 preempt
R2(config-if)#interface s1/1
R2(config-if)#ip address 23.23.23.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#end
----R3的配置-------
R3#configure terminal
R3(config)#interface s1/0
R3(config-if)#ip address 13.13.13.3 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#interface s1/1
R3(config-if)#ip address 23.23.23.3 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config-if)#interface loopback 0
R3(config-if)#ip address 202.101.18.8 255.255.255.0
R3(config-if)#end
快捷配置方式
----PC的配置-------
configure terminal
no ip routing
ip default-gateway 192.168.1.100
interface e0/0
ip address 192.168.1.200 255.255.255.0
no shutdown
end
----R1的配置-------
configure terminal
interface f0/0
ip address 192.168.1.1 255.255.255.0
no shutdown
standby 1 ip 192.168.1.100
standby 1 priority 120
standby 1 preempt
standby 1 track s1/0 30
interface s1/0
ip address 13.13.13.1 255.255.255.0
no shutdown
end
----R2的配置-------
configure terminal
interface f0/0
ip address 192.168.1.2 255.255.255.0
no shutdown
standby 1 ip 192.168.1.100
standby 1 priority 100
standby 1 preempt
interface s1/0
ip address 23.23.23.2 255.255.255.0
no shutdown
end
----R3的配置-------
configure terminal
interface s1/0
ip address 13.13.13.3 255.255.255.0
no shutdown
interface s1/1
ip address 23.23.23.3 255.255.255.0
no shutdown
interface loopback 0
ip address 202.101.18.8 255.255.255.0
end
说明:如果想查看配置的结果,可以在R1上输入命令
R1#show standby
可以看到如下信息
Virtual IP address is 192.168.1.100 configured
Active router is local
Standby router is 192.168.1.2 expires in 7.900
说明192.168.1.2是Standby状态
如果禁用R1的s1/0口
R1#configure terminal
R1(config)#interface s1/0
R1(config-if)#shutdown
R1#show standby
可以看到如下信息:
Virtual IP address is 192.168.1.100 configured
Active router is 192.168.1.2, priority 100 expires in 7.940
Standby router is local
说明192.168.1.2是Active状态
当然如果你想在PC上traceroute 202.101.18.8,则必须配置路由协议。
如果你不想让R1和R2通过RIP路由协议发现对方,则可以这样配置
R1(config)#router rip
R1(config-router)#network 13.13.13.0
R1(config-router)#network 192.168.1.0
R1(config-router)#passive-interface f0/0
R2(config)#router rip
R1(config-router)#network 23.23.23.0
R1(config-router)#network 192.168.1.0
R2(config-router)#passive-interface f0/0
现在,可以在PC上试一下traceroute命令
PC#traceroute 202.101.18.8
Type escape sequence to abort.
Tracing the route to 202.101.18.8
1 192.168.1.1 52 msec 68 msec 20 msec
2 13.13.13.3 28 msec * 12 msec
PC#
关闭R1的s1/0口,再试
PC#traceroute 202.101.18.8
Type escape sequence to abort.
Tracing the route to 202.101.18.8
1 192.168.1.2 68 msec 109 msec 32 msec
2 23.23.23.3 64 msec * 0 msec
PC#
从两次输出看出结果的正确性。
本文出自 “海阔天空” 博客,请务必保留此出处http://haikuotiankong.blog.51cto.com/633188/1695310
原文地址:http://haikuotiankong.blog.51cto.com/633188/1695310