首页 > 学院 > 网络管理 > 正文

IP default-network和静态路由区别

2020-03-15 01:03:28
字体:
来源:转载
供稿:网友

  对于一些准备考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

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表