电脑软硬件应用网
当前位置: 电脑软硬件应用网 > 电脑学院 > 局域网技术 > 正文
IP default-network和静态路由区别
IP default-network和静态路由区别
2007-6-19 17:16:51  文/sanandi   出处:ccidnetbbs   

  对于一些准备考CCNA和CCNP的人来说,配置一条静态路由和使用思科的命令IP default-network的区别是一个令人迷惑的地方。

  初一看,他们都是一样的。结果都是配置一个目的地,使得路由器知道如果一个包在路由表中没有指定的路由的话,这个包将会被发往何地。

  他们之间的主要区别是:配置一条静态缺省路由仅是为你在配置的路由器定义一条路由,而ip default-network将通过使用的路由协议进行传播。

  下面,我们在一个星形网络(hub-and-spoke network)中来试验ip default-network命令。R1为中心,R2和R3叶子。他们通过网络172.12.123.0/24连接起来,而且每台路由器都根据它的路由器号码被配置了32位掩码的LOOPBACK地址(1.1.1.1/32,等等)。路由协议使用RIP协议,LOOPBACK地址在网络中被广播。

  R1路由器配置有一个串口,地址为10.1.1.1/24,这个网络被通过使用命令ip default-network 10.0.0.0命令,配置为一条缺省网络。它还没有被RIP广播。

  接下来,路由协议广播了这条路由。使用RIP,缺省网络被广播为0.0.0.0(如果使用了IGRP,它会显示网络号,但是被标识成IGRP的外部路由)。这个路由被指定为R1的一条缺省的路由,正如我们在下面看到的。

R1#show ip route

Gateway of last resort is not set

1.0.0.0/32 is subnetted, 1 subnets
C 1.1.1.1 is directly connected, Loopback0
R 2.0.0.0/8 [120/1] via 172.12.123.2, 00:00:11, Serial0
R 3.0.0.0/8 [120/1] via 172.12.123.3, 00:00:11, Serial0
172.12.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.12.21.0/30 is directly connected, BRI0
C 172.12.123.0/24 is directly connected, Serial0
* 10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Serial1


  在R2和R3上,缺省的RIP路由也将出现:

R2#show ip route
Gateway of last resort is 172.12.123.1 to network 0.0.0.0

R 1.0.0.0/8 [120/1] via 172.12.123.1, 00:00:00, Serial0.213
2.0.0.0/32 is subnetted, 1 subnets
C 2.2.2.2 is directly connected, Loopback0
R 3.0.0.0/8 [120/2] via 172.12.123.1, 00:00:00, Serial0.213
172.12.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.12.21.0/30 is directly connected, BRI0
C 172.12.123.0/24 is directly connected, Serial0.213
R* 0.0.0.0/0 [120/1] via 172.12.123.1, 00:00:00, Serial0.213


R3#show ip route
Gateway of last resort is 172.12.123.1 to network 0.0.0.0

R 1.0.0.0/8 [120/1] via 172.12.123.1, 00:00:27, Serial0.31
R 2.0.0.0/8 [120/2] via 172.12.123.1, 00:00:28, Serial0.31
3.0.0.0/32 is subnetted, 1 subnets
C 3.3.3.3 is directly connected, Loopback0
172.12.0.0/24 is subnetted, 1 subnets
C 172.12.123.0 is directly connected, Serial0.31
R* 0.0.0.0/0 [120/1] via 172.12.123.1, 00:00:28, Serial0.31


  所以缺省路由起了使用:如果我们在R2和R3上PING10.1.1.1,即使他们在路由表中没有配置的路由,他们会使用缺省路由。

R2#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 = 68/68/68 ms

R3#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 = 68/68/68 ms


  当决定是使用缺省路由还是使用default network时,要记信:如果想路由协议广播这条路由,那么使用default-network命令,否则使用缺省路由就可以了。

  • 上一篇文章:

  • 下一篇文章:
  • 最新热点 最新推荐 相关文章
    轻松六步处理网络连接故障的技巧总结
    提高局域网速度的21招
    浅谈如何解决局域网传输速度慢的问题
    简述HTTP网络协议工作原理的流程
    局域网里固定IP地址无法上网故障
    房东给我限速了,咋办?
    两台电脑可以用同一IP上网吗?
    计算机MAC地址查询方法
    网络不存在或尚未启动\以及局域网互…
    提高网速排除线缆、端口、环路障碍
    关于45IT | About 45IT | 联系方式 | 版权声明 | 网站导航 |

    Copyright © 2003-2011 45IT. All Rights Reserved 浙ICP备09049068号