<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
看过不是文档 关于自动通告默认路由 结果一做很多不行!
本测试使用的是
NP BSCI
的实验拓扑,拓扑参数可以到我
BLOG
上找!
FR
是全互联的!已下实验都经过测试
<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" />
1
、ip default-gateway 当路由器上的ip routing无效时,使用它指定默认路由
2
、ip default-network和ip route <?XML:NAMESPACE PREFIX = ST1 />0.0.0.0 0.0.0.0 两者都用于ip routing有效的路由器上,区别主要在于路由协议是否传播这条路由信息。比如:IGRP无法识别0.0.0.0,因此传播默认路由时必须用ip default-network。
当用ip default-network指令设定多条默认路由时,administrative distance最短的成为最终的默认路由;如果有复数条路由distance值相等,那么在路由表(show ip route)中靠上的成为默认路由。 同时使用ip default-network和ip route 0.0.0.0 0.0.0.0双方设定默认路由时,如果ip default-network设定的网络是直连(静态、且已知)的,那么它就成为默认路由;如果ip default-network指定的网络是由交换路由信息得来的,则ip route 0.0.0.0 0.0.0.0指定的表项成为默认路由。 最后,如果使用多条ip route 0.0.0.0 0.0.0.0指令,则流量会自动在多条链路上负载均衡。
当
CISCO
路由器的
IP ROUTING
可用的时候你可以使用
Default-network
命令
当你配置
ip default-network
时
你要考虑路由上到达网络的最后求助网关
为每个网络配置
ip default
-
network
如果路由能到达此网络,这个路由将会标记候选路由!
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.2.0 is directly connected, FastEthernet0/0
P1R4(config)# ip route 172.31.0.0 255.255.255.0 10.1.2.2
P1R4(config)#ip default-network 172.31.0.0
*Mar 1 01:08:06.595: %SYS-5-CONFIG_I: Configured from console by console
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is 10.1.2.2 to network 172.31.0.0
* 172.31.0.0/24 is subnetted, 1 subnets
S* 172.31.0.0 [1/0] via 10.1.2.2
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.2.0 is directly connected, FastEthernet0/0
Ip default-network
这个命令是
classful
P1R4(config)#ip route 168.32.1.0 255.255.255.0 10.1.3.3
P1R4(config)#ip default-n
P1R4(config)#ip default-network 168.32.1.0
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is 10.1.2.2 to network 172.31.0.0
168.32.0.0/16 is variably subnetted, 2 subnets, 2 masks
S 168.32.0.0/16 [1/0] via 168.32.1.0
S 168.32.1.0/24 [1/0] via 10.1.3.3
* 172.31.0.0/24 is subnetted, 1 subnets
S* 172.31.0.0 [1/0] via 10.1.2.2
10.0.0.0/24 is subnetted, 2 subnets
C 10.1.3.0 is directly connected, Serial1/0
C 10.1.2.0 is directly connected, FastEthernet0/0
*Mar 1 01:34:55.419: %SYS-5-CONFIG_I: Configured from console by console
P1R4#Explain:
ip default-network
命令是有类别的,意味着如果路由器有一个路由到此命令表示的子网,它才会被作为默认的求助网关。
这时两个网络未被标记作为默认网络。必须使用主网再发出ip default-network命令.
P1R4(config)#ip default-n
P1R4(config)#ip default-network 168.32.0.0
*Mar 1 01:35:59.095: %SYS-5-CONFIG_I: Configured from console by console
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is 168.32.1.0 to network 168.32.0.0
* 168.32.0.0/16 is variably subnetted, 2 subnets, 2 masks
S* 168.32.0.0/16 [1/0] via 168.32.1.0
S 168.32.1.0/24 [1/0] via 10.1.3.3
* 172.31.0.0/24 is subnetted, 1 subnets
S* 172.31.0.0 [1/0] via 10.1.2.2
10.0.0.0/24 is subnetted, 2 subnets
C 10.1.3.0 is directly connected, Serial1/0
C 10.1.2.0 is directly connected, FastEthernet0/0
可以看到
命令是
classful
默认路由又添加了一个!
Gateway of last resort is 168.32.1.0
看看是不是和上面的有变动了!
使用ip default-network命令选择的最后求助网关根据路由协议不同而不同。为了能传播路由,IGRP及EIGRP的 ip default-network命令指定的网络必须为IGRP或EIGRP所知。这意味着网络在路由表里必须是一个IGRP-或EIGRP派生的网络,或者必须再分布用于的静态路由生成路由对网络到IGRP或 EIGRP 。
RIP做通告路由到0.0.0.0 。例如,注意最后求助网关在如下路由器使用IP 路由和ip default-network 命令的组合是获知 。如果在此路由器启用RIP,RIP做通告路由到0.0.0.0 (虽然不对令牌环网络由于纵向隔离):
----------------------------------------------------------------------
P1R1(config)#ip route 0.0.0.0 0.0.0.0 172.31.1.2
创建一条静态路由
也可以
ip route 0.0.0.0 0.0.0.0 s1/0
Gateway of last resort is 0.0.0.0 to network 0.0.0.0
P1R1(config-router)#default-information originate
通过
RIP
协议通告默认路由
!
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is 172.31.1.2 to network 0.0.0.0
172.31.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.31.1.0/24 is directly connected, Serial1/0
R 172.31.0.0/16 [120/1] via 10.1.0.2, 00:00:08, Serial1/1
10.0.0.0/24 is subnetted, 3 subnets
R 10.1.2.0 [120/1] via 10.1.0.2, 00:00:08, Serial1/1
C 10.1.1.0 is directly connected, FastEthernet0/0
C 10.1.0.0 is directly connected, Serial1/1
S* 0.0.0.0/0 [1/0] via 172.31.1.2
*Mar 1 00:03:06.415: %SYS-5-CONFIG_I: Configured from console by console
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is 10.1.0.1 to network 0.0.0.0
172.31.0.0/24 is subnetted, 1 subnets
C 172.31.1.0 is directly connected, Serial1/0
10.0.0.0/24 is subnetted, 3 subnets
C 10.1.2.0 is directly connected, FastEthernet0/0
R 10.1.1.0 [120/1] via 10.1.0.1, 00:00:13, Serial1/1
C 10.1.0.0 is directly connected, Serial1/1
R* 0.0.0.0/0 [120/1] via 10.1.0.1, 00:00:03, Serial1/1
------------------------------------------------------
P1R1(config)#ip route 0.0.0.0 0.0.0.0 s1/0
P1R1(config-router)#default-information originate
*Mar 1 00:22:52.363: %SYS-5-CONFIG_I: Configured from console by console
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is 0.0.0.0 to network 0.0.0.0
172.31.0.0/24 is subnetted, 1 subnets
C 172.31.1.0 is directly connected, Serial1/0
10.0.0.0/24 is subnetted, 3 subnets
O 10.1.2.0 [110/65] via 10.1.0.2, 00:02:14, Serial1/1
C 10.1.1.0 is directly connected, FastEthernet0/0
C 10.1.0.0 is directly connected, Serial1/1
S* 0.0.0.0/0 is directly connected, Serial1/0
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is 10.1.0.1 to network 0.0.0.0
172.31.0.0/24 is subnetted, 1 subnets
O 172.31.1.0 [110/128] via 10.1.0.1, 00:00:05, Serial1/1
10.0.0.0/24 is subnetted, 3 subnets
C 10.1.2.0 is directly connected, FastEthernet0/0
O 10.1.1.0 [110/65] via 10.1.0.1, 00:00:05, Serial1/1
C 10.1.0.0 is directly connected, Serial1/1
O*E2 0.0.0.0/0 [110/1] via 10.1.0.1, 00:00:05, Serial1/1
通过
Default-information origiate
传播到外地的路由表中!
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is 10.1.2.2 to network 0.0.0.0
172.31.0.0/24 is subnetted, 1 subnets
O 172.31.1.0 [110/129] via 10.1.2.2, 00:06:30, FastEthernet0/0
10.0.0.0/24 is subnetted, 3 subnets
C 10.1.2.0 is directly connected, FastEthernet0/0
O 10.1.1.0 [110/66] via 10.1.2.2, 00:06:30, FastEthernet0/0
O 10.1.0.0 [110/65] via 10.1.2.2, 00:06:30, FastEthernet0/0
O*E2 0.0.0.0/0 [110/1] via 10.1.2.2, 00:06:30, FastEthernet0/0
Default metric
是
1
而不是
BSCI
自学指南
P212
上说的
10
书的作者已经试验验证了!
--------------------------------------------------------------------------------
Eigrp
在默认的情况下不重发
0.0.0.0 0.0.0.0
默认路由
但是如果在
NETWORK
中添加
network 0.0.0.0
命令
由于ip route 0.0.0.0 0.0.0.0 interface 命令所产生的结果(不是ip route 0.0.0.0 0.0.0.0 add 或ip default-network).
他将重分发一条默认路由。实验见:
方法一:
P1R1(config-router)#ip route 0.0.0.0 0.0.0.0 s1/0
*Mar 1 00:00:44.851: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to down
P1R1(config)#router eigrp 100
P1R1(config-router)#network 0.0.0.0
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is 0.0.0.0 to network 0.0.0.0
172.31.0.0/16 is variably subnetted, 2 subnets, 2 masks
C 172.31.1.0/24 is directly connected, Serial1/0
D 172.31.0.0/16 is a summary, 00:05:04, Null0
10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
D 10.1.2.0/24 [90/2172416] via 10.1.0.2, 00:05:07, Serial1/1
C 10.1.1.0/24 is directly connected, FastEthernet0/0
D 10.0.0.0/8 is a summary, 00:05:04, Null0
C 10.1.0.0/24 is directly connected, Serial1/1
S* 0.0.0.0/0 is directly connected, Serial1/0
*Mar 1 00:06:28.071: %SYS-5-CONFIG_I: Configured from console by console
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is 10.1.0.1 to network 0.0.0.0
D 172.31.0.0/16 [90/2681856] via 10.1.0.1, 00:00:02, Serial1/1
10.0.0.0/24 is subnetted, 3 subnets
C 10.1.2.0 is directly connected, FastEthernet0/0
D 10.1.1.0 [90/2172416] via 10.1.0.1, 00:00:05, Serial1/1
C 10.1.0.0 is directly connected, Serial1/1
D* 0.0.0.0/0 [90/2681856] via 10.1.0.1, 00:00:02, Serial1/1
-------------------------------------------------------------------
方法二:
ip route 0.0.0.0 0.0.0.0 172.31.1.3(
#
接口或者地址都可以
)
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is 172.31.1.3 to network 0.0.0.0
172.31.0.0/24 is subnetted, 1 subnets
C 172.31.1.0 is directly connected, Serial1/0
10.0.0.0/24 is subnetted, 3 subnets
D 10.1.2.0 [90/2172416] via 10.1.0.2, 00:02:34, Serial1/1
C 10.1.1.0 is directly connected, FastEthernet0/0
C 10.1.0.0 is directly connected, Serial1/1
S* 0.0.0.0/0 [1/0] via 172.31.1.3
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is 10.1.0.1 to network 0.0.0.0
10.0.0.0/24 is subnetted, 3 subnets
C 10.1.2.0 is directly connected, FastEthernet0/0
D 10.1.1.0 [90/2172416] via 10.1.0.1, 00:00:33, Serial1/1
C 10.1.0.0 is directly connected, Serial1/1
D*EX 0.0.0.0/0 [
170
/2681856] via 10.1.0.1, 00:00:03, Serial1/1
通过
Redistribute static
也是可以的
但是
作为外部的
EIGRP
路由通告出去!
------------------------------------------------------------------------
注意:
在早期的
RIP
版本中
使用
IP ROUTE 0.0.0.0 0.0.0.0
创建的默认路由会自动的在
rip
路由器
中被宣告
但是
CISCO SOFTWATE RELEASE 12.0T
以后的版本中
RIP
不会宣告默认路由
就算是此设置为默认的网络被
RIP
学习的情况下
重分配进RIP就变成已个必要的步骤!
或者使用 default-information originate命令。
OSPF,类似RIP,为 0.0.0.0 0.0.0.0做通告路由。然而,与OSPF,必须用 default-information originate命令配置产生默认路由的 路由器。关于详细信息 ,请参阅 如何执行OSPF生成默认路由?.
ip route 0.0.0.0 0.0.0.0 创建静态路由到网络0.0.0.0 0.0.0.0是另一 个方式设置最后求助网关在路由器。照同 ip default-network命令,使用静态路由到0.0.0.0不依靠任何路由协议。然而, 在路由器必须启用 IP路由。
注意: IGRP不了解路由到0.0.0.0因此不能传播使用 ip route 0.0.0.0 0.0.0.0命令被创建的 默认路由。 使用 ip default-network命令使 IGRP使用默认路由。
EIGRP传播一个 路由对网络0.0.0.0,但必须再分布静态路由到EIGRP。RIP和 OSPF 正常运行如所描述当使用 ip default-network命令时。记住上面附注仍 然适用。
如果 配置多个网络作为候选默认路由使用 ip default-network命令,有最低管理距离的网络被选择作为网络为最后求助网关。如 果所有网络有同一管理距离然后网络列表首先在路由表里 (show ip route 列出 路由表)被选择作为网络为最后一招网关。如果使用 ip default-network 和 ip route 0.0.0.0 0.0.0.0 命令配置候选默认值网络, 并且ip default-network命令使用的 网络静态知道,用ip default-network 命 令被定义的 网络采取优先次序 和为最后一招网关被选择。否则如果ip default-network命 令使用的 网络由路由协议派 生, ip route 0.0.0.0 0.0.0.0命令,将有一个更低的管 理距离,采取优先次序和为最后一招网关被选择。最后,如 果使用多个 ip route 0.0.0.0 0.0.0.0 命 令配置默认路由,数据流在多个路由负载平衡。
汇总 当IP路由 在Cisco路由器时, 禁用总结,您能使用 ip default-gateway命令。使用 ip default-network 和 ip route 0.0.0.0 0.0.0.0 命令设置最后一招网关在有被启用的IP路由 的 Cisco路由器。路由协议传播默认路由信息的方式为每个协议变化。
|
|