1.标记一个路由条目 为缺省网络 2.在RIP,EIGRP/IGRP中提供缺省网络的传播
【补充说明】
1.使用ip default-network标记静态路由指定的路由为缺省网络,在RIP中不会传播出去;在IGRP、EIGRP中不存在这 个问题,因为它们本来就需要将这个网段通告到路由协议中才能传播出去
2.使用ip default-network标记直连网络为缺省不会被使用,因为没有下一跳。
【案例说明】
【实验一】
R1:
interface Serial1/0
ip address 192.168.12.1 255.255.255.0
serial restart-delay 0
!
interface Serial2/0
no ip address
shutdown
serial restart-delay 0
!
router rip
network 192.168.12.0
R2:
interface Serial1/0
ip address 192.168.23.2 255.255.255.0
!
interface Serial2/0
ip address 192.168.12.2 255.255.255.0
router rip
network 192.168.12.0
ip default-network 3.0.0.0
ip route 3.0.0.0 255.0.0.0 192.168.23.3
R3:
interface Loopback3
ip address 6.6.6.6 255.255.255.0 secondary
ip address 3.3.3.3 255.255.255.0
!
interface Serial2/0
ip address 192.168.23.3 255.255.255.0
!
ip route 0.0.0.0 0.0.0.0 192.168.23.2
查看结果
R2#sh ip rou
Gateway of last resort is 192.168.23.3 to network 3.0.0.0
C 192.168.12.0/24 is directly connected, Serial2/0
S* 3.0.0.0/8 [1/0] via 192.168.23.3
C 192.168.23.0/24 is directly connected, Serial1/0
R1#sh ip rou
Gateway of last resort is not set
C 192.168.12.0/24 is directly connected, Serial1/0
可以看到R1并没有获得这个路由条目。下面更改一下R2的配置:
R2:
no ip default-network 3.0.0.0
no ip route 3.0.0.0 255.0.0.0 192.168.23.3
ip default-network 192.168.23.0
R2#sh ip rou
Gateway of last resort is not set
C 192.168.12.0/24 is directly connected, Serial2/0
C*192.168.23.0/24 is directly connected, Serial1/0
R2#
*Oct 3 07:15:26.147: RIP: sending v1 update to 255.255.255.255 via Serial2/0 (192.168.12.2)
*Oct 3 07:15:26.147: RIP: build update entries
*Oct 3 07:15:26.147: subnet 0.0.0.0 metric 1
R1#sh ip rou
Gateway of last resort is 192.168.12.2 to network 0.0.0.0
C 192.168.12.0/24 is directly connected, Serial1/0
R* 0.0.0.0/0 [120/1] via 192.168.12.2, 00:00:20, Serial1/0
此时可以看到192.168.23.0也没有在RIP中通告,但是由于使用了ip default-network使其变为了默认网络,从而将该网段通告了出去。
但是此时在R1上ping 6.6.6.6会ping 不通,因就在于R2上现在的缺省网络无下一跳,Gateway of last resort is not set,
R1#ping 6.6.6.6
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 6.6.6.6, timeout is 2 seconds:
U
*Oct 3 07:21:46.751: IP: tableid=0, s=192.168.12.1 (local), d=6.6.6.6 (Serial1/0), routed via RIB
*Oct 3 07:21:46.751: IP: s=192.168.12.1 (local), d=6.6.6.6 (Serial1/0), len 100, sending
*Oct 3 07:21:46.779: IP: tableid=0, s=192.168.12.2 (Serial1/0), d=192.168.12.1 (Serial1/0), routed via RIB
R2(config)#
*Oct 3 07:21:46.711: IP: s=192.168.12.1 (Serial2/0), d=6.6.6.6, len 100, unroutable
*Oct 3 07:21:46.711: IP: tableid=0, s=192.168.12.2 (local), d=192.168.12.1 (Serial2/0), routed via RIB
解决方案:在R2上添加静态缺省
R2(config)#ip route 0.0.0.0 0.0.0.0 192.168.23.3
R1#ping 6.6.6.6
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 6.6.6.6, timeout is 2 seconds:
!!!!!
搞定!
[实验二]ip default-network在EIGRP中应用案例
R1:
R1(config)#router eigrp 100
R1(config-router)#net 192.168.12.0
R2:
R2(config)#no router rip
R2(config)#router eigrp 100
R2(config-router)#net 192.168.12.0
R2(config-router)#net 192.168.23.0
R2(config-router)#pa s1/0
实验结果
R2#sh ip rou
Gateway of last resort is 192.168.23.3 to network 0.0.0.0
C 192.168.12.0/24 is directly connected, Serial2/0
C* 192.168.23.0/24 is directly connected, Serial1/0
S* 0.0.0.0/0 [1/0] via 192.168.23.3
R1#sh ip rou
Gateway of last resort is 192.168.12.2 to network 192.168.23.0
C 192.168.12.0/24 is directly connected, Serial1/0
D* 192.168.23.0/24 [90/2681856] via 192.168.12.2, 00:00:21, Serial1/0
R1#ping 6.6.6.6
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 6.6.6.6, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 40/41/48 ms
可以看到配置中和RIP不同的情况,需要将所通告的默认路由网段通告到 EIGRP/IGRP中;而且通告出去不像RIP变为了0 .0.0.0/0,仍旧是缺省网络。
网页名称:Ciscoiosipdefault-network补充说明
文章源于:
http://cdkjz.cn/article/ispidi.html