您的位置:首页 > 其它

ip default-network 同 静态路由的区别

2007-04-06 11:22 260 查看

ip default-network 同 静态路由的区别

对于一些准备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和R2上,缺省的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命令,否则使用缺省路由就可以了。

哈哈哈哈~~~我发现我就是一个神仙~~~~~
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: