实验五 默认路由

 

实验五 默认路由_第1张图片 

 

2、实验过程
r1(config)#int lo0
r1(config-if)#ip add 192.168.1.1 255.255.255.0
r1(config-if)#int lo1
r1(config-if)#ip add 172.16.1.1 255.255.255.0
r1(config)#int f0/0
r1(config-if)#ip add 10.1.1.1 255.255.255.0
r1(config-if)#no shu
r2(config)#int f0/0
r2(config-if)#ip add 10.1.1.2 255.255.255.0
r2(config-if)#no shut
r2(config-if)#int lo0
r2(config-if)#ip add 192.168.2.2 255.255.255.0
r3(config)#int f0/1
r3(config-if)#ip add 20.1.1.3 255.255.255.0
r3(config-if)#no shut
r3(config-if)#int f0/0
r3(config-if)#ip add 10.1.1.3 255.255.255.0
r3(config-if)#no shut
r3(config)#no ip routing
r3(config)#ip default-gateway 10.1.1.1
r3#sh ip rout
*Aug 3 15:49:04.167: %SYS-5-CONFIG_I: Configured from console by consolee
r3#sh ip route
Default gateway is 10.1.1.1
 
Host               Gateway           Last Use    Total Uses Interface
ICMP redirect cache is empty
测试网络的连通性
r3#ping 172.16.1.1
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/230/1032 ms
r3#ping 192.168.1.1
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/42/108 ms
注:以上就可以说明了ip default-gateway ip address 功能。
r3#ping 192.168.2.2
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.2, timeout is 2 seconds:
U.U.U//这个结果从反面也说明了default-gateway的功能。
Success rate is 0 percent (0/5)
以上是说明了ip default-gateway在关闭路由功能情况的作用了,而我们在没有关闭路由功能情况下也可以配置默认网络,这个命令就是ip route 0.0.0.0 0.0.0.0
配置 ip route 0.0.0.0 0.0.0.0
1、实验拓扑图同上
2、实验过程
R1和R2的配置同上
r3(config)#int f0/1
r3(config-if)#ip add 20.1.1.3 255.255.255.0
r3(config-if)#no shut
r3(config-if)#int f0/0
r3(config-if)#ip add 10.1.1.3 255.255.255.0
r3(config-if)#no shut
r3(config)#ip route 0.0.0.0 0.0.0.0 10.1.1.1
r3#ping 192.168.1.1
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/40/104 ms
r3#p 172.16.1.1
 
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/59/116 ms
以上说明了默认路由的原理。两者的区别是default-gateway只能在路由功能关闭的情况下用,一个路由器只能配置一条,ip route 0.0.0.0 0.0.0.0 是在路由功能开启下运作,每一个路由器可以配置多条。

 

你可能感兴趣的:(职场,休闲,路由和交换)