- 论坛徽章:
- 0
|
-
ip default-gateway
-
ip default-network
-
and ip route 0.0.0.0
0.0.0.0
可通过以上三个命令来设置默认路由,那区别呢?
1. ip default-gateway
当router禁止了ip routing时,此时router就类似一个主机,使用ip default-gateway来指定默认路由。
或者当boot mode的时候,router使用tftp来下载IOS,此时ip routing也是被disabled。
2. ip default-network
这个命令只能使用classful network作为参数,并且在使用这个命令时,路由表总必须存在其相应的路由。
当路由表总存在某个major net的subnet时,例如:
==========================================================
5.0.0.0/24 is subnetted, 1 subnets, 1 masks
S 5.5.5.0 is directly connected, Serial1/1
==========================================================
此时如果使用
ip default-network 5.5.5.0
那么就会自动添加一条
ip route 5.0.0.0 255.0.0.0 5.5.5.0
最终导致路由表变为
===========================================================
5.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
S 5.0.0.0/8 [1/0] via 5.5.5.0
S 5.5.5.0/24 is directly connected, Serial1/1
===========================================================
Note: 路由表总必须存在这个被ip default-network声明的子网,否则即使加了一条规则,但由于下一跳地址不存在(如此例总的5.5.5.0),路由表将不添加这条记录。
此时,必须在使用ip default-network 5.0.0.0来重新标识一下,定义默认路由。
===========================================================
* 5.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
S* 5.0.0.0/8 [1/0] via 5.5.5.0
S 5.5.5.0/24 is directly connected, Serial1/1
===========================================================
也就是需要定义两次,个人觉得挺滑稽的,funny^_^!
Note: 使用ip default-network对AD=0的路由进行标记并不会设置默认路由。
在不同路由协议中的传播
RIPv1:
注意:RIP是基于路由表来传播路由信息的。
传播默认路由:
==============================
ad=0 (connected or static),并且此条路由为当前默认路由,也就是没有其他优先级高的默认路由
不受split-horizon限制,rip 将自动advertise此类candidate route
不传播默认路由:
==============================
R路由被设定
对 R 路由,也就是由RIP协议获得的路由使用ip network-default是不会传递默认路由的。
静态ad=1的路由被设定
IGRP:
必须使用network命令通知igrp来广播这个网段为exterior route,也就是default route。所以IGRP并不象rip那样广播为0.0.0.0默认网段。原因很简单,因为rip包中没有办法辨别是否为default route,所以只能广播为0.0.0.0。但是igrp包括三种包:
- Number of Interior routes - indicates how many of the routing entries in this update are subnets of a directly connected
network. - Number of System routes - indicates how many of the routing entries in this update are not from a directly connected
network. - Number of Exterior routes - indicates how many of the routing entries in this update are default networks.
所以可以辨别出某个route是否为默认路由。
注意: IGRP也是没有mask字段的。
EIGRP:
需要network来通知eigrp传播这条路由。
3. ip route 0.0.0.0 0.0.0.0
ip route 0.0.0.0 0.0.0.0
ip route 0.0.0.0 0.0.0.0
这两个形式都产生默认路由,并被router选取,这两个命令的效果是一样的。
RIPv1:
redistribute
IGRP:
不识别这种默认路由。(因为IGRP包的结构)
EIGRP:
需要redistribute来传播,在EIGRP中,静态路由的传播是不受split horizon的控制的,也就是说,会在所有打开eigrp功能的端口上传播出去。
Note: RIP和IGRP对静态路由的再分配传播是遵循split horizon的,但是eigrp不遵循。
4. 默认路由的优先级
当出现多个ip default-network指定的网络时(AD=0除外)
======================================
AD -> first listed in routing table
当出现ip default-network和ip 0.0.0.0 0.0.0.0的网络时(AD=0除外)
======================================
如果ip default-network为静态路由 -> (y) 这条静态路由为默认路由
|
|
V
(n)
0.0.0.0 路由take precedence
|
|
V
根据AD来进行判断
|
|
V
AD相同,根据metric来判断
多条0.0.0.0路由
==============
load balancing
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/42903/showart_373031.html |
|