2.4默认路由 | |
| |
实验连接图 | |
![]() | |
提要描述 | |
所谓的默认路由,是指路由器在路由表中如果找不到到达目的网络的具体路由时,最后会采用的路由。默认路由通常会在末节网络(STUB network,即只有一个出口的网络)中使用。很多时候,人们将默认路由叫做"0/0"路由,因为这些路由的IP地址是0.0.0.0,而子网掩码也是0.0.0.0。
实验目标: "不管是什么IP地址,也不管子网掩码是什么,都从我这里发就OK"。 | |
基本配置 | |
R1的配置 |
R2的配置 |
!
hostname R1
interface Serial1/1
ip address
no sh
clock rate 64000
! |
!
hostname R2
interface Serial1/0
ip address
no sh
!
interface Serial1/1
ip address
no sh
! |
R3的配置 |
|
!
hostname R3
!
interface Loopback0
ip address
!
interface Serial1/0
ip address
no sh
clock rate 64000
! |
|
↓调试配置及监测步骤↓ |
2.4默认路由
原创
©著作权归作者所有:来自51CTO博客作者sharkii的原创作品,请联系作者获取转载授权,否则将追究法律责任
首先使用命令:Ip route 0.0.0.0 0.0.0.0{下一跳地址 | 出站接口 } 分别在R1、R3上配置默认路由
R1(config)#ip route 0.0.0.0 0.0.0.0 s1/1
R3(config)#ip route 0.0.0.0 0.0.0.0 23.1.1.2
看看上面蓝色:用出站接口和下一跳地址的区别:
R1#show ip route
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/1
S* 0.0.0.0/0 is directly connected, Serial1/1
R3#show ip route
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, Serial1/0
10.0.0.0/24 is subnetted, 4 subnets
C 10.1.3.0 is directly connected, Loopback2
C 10.1.2.0 is directly connected, Loopback1
C 10.1.1.0 is directly connected, Loopback0
C 10.1.4.0 is directly connected, Loopback3
S* 0.0.0.0/0 [1/0] via 23.1.1.2
从上面的路由表来看R1、R3都已经添加了默认路由,下面用ping测试一下连通性:
R1#ping 23.1.1.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 23.1.1.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 36/84/160 ms
R3#ping 12.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 24/82/120 ms
R1#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:
U.U.U
Success rate is 0 percent (0/5)
结果显示R1和R3和ping都可以通,但ping R3的loopback接口不通,是因为没有路由可到达。在R2添加默认路由看看
R2(config)#ip route 0.0.0.0 0.0.0.0 23.1.1.3
R1#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 = 44/88/160 ms
提示:默认路由在实在环境中很常见,特别在中小企业的网络环境,默认路由会大大简化路由器的配置,减轻管理员的工作负担,提高网络性能。例如:和运营商之间的连接线路,客户端不用理会运营商用什么路由协议,直接用默认路由就可以了。
上一篇:2.1基本静态路由
下一篇:3.1 RIP版本1&2配置
![](https://ucenter.51cto.com/images/noavatar_middle.gif)
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章