蛋汤 2007-11-13 09:37
ip default-network补充说明
[b][color=#0066cc]1.标记一个路由条目为缺省网络[/color][/b][size=3][color=#0066cc][b] 2.在RIP,EIGRP/IGRP中提供缺省网络的传播[/b][/color][/size]
[b][size=3][color=#0066cc]【补充说明】[/color][/size][/b]
[b][size=3][color=#0066cc]1.使用ip default-network标记静态路由指定的路由为缺省网络,在RIP中不会传播出去;在IGRP、EIGRP中不存在这 个问题,因为它们本来就需要将这个网段通告到路由协议中才能传播出去 [/color][/size][/b]
[b][size=3][color=#0066cc]2.使用ip default-network标记直连网络为缺省不会被使用,因为没有下一跳。[/color][/size][/b]
[b][size=3][color=#0066cc]【案例说明】[/color][/size][/b]
[b][size=3][color=#0066cc]【实验一】[/color][/size][/b]
[img]http://www.one-tom.com/bbs/uploads/justdoit/2006-10-03_144812_default-network2.jpg[/img]
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
[b][color=#0066cc]查看结果[/color][/b]
[color=#000000]R2#sh ip rou [/color]
[color=#000000]Gateway of last resort is 192.168.23.3 to network 3.0.0.0[/color]
[color=#000000]C 192.168.12.0/24 is directly connected, Serial2/0
[b]S* [/b] 3.0.0.0/8 [1/0] via 192.168.23.3
C 192.168.23.0/24 is directly connected, Serial1/0[/color]
R1#sh ip rou
Gateway of last resort is not set
C 192.168.12.0/24 is directly connected, Serial1/0
[b][color=#0066cc]可以看到R1并没有获得这个路由条目。下面更改一下R2的配置:[/color][/b]
R2:
no ip default-network 3.0.0.0
no ip route 3.0.0.0 255.0.0.0 192.168.23.3
[b]ip default-network 192.168.23.0[/b]
R2#sh ip rou
Gateway of last resort is not set
C 192.168.12.0/24 is directly connected, Serial2/0
[b]C*[/b] 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
[b]R* [/b] 0.0.0.0/0 [120/1] via 192.168.12.2, 00:00:20, Serial1/0
[b][color=#0066cc]此时可以看到192.168.23.0也没有在RIP中通告,但是由于使用了ip default-network使其变为了默认网络,从而将该网段通告了出去。[/color][/b]
[color=#0066cc][b]但是此时在R1上ping 6.6.6.6会ping 不通,因就在于R2上现在的缺省网络无下一跳,Gateway of last resort is not set,[/b][/color]
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, [b][color=#0066cc]sending[/color][/b]
*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, [b][color=#0066cc]unroutable[/color][/b]
*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
[b][color=#0066cc]解决方案:在R2上添加静态缺省[/color][/b]
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:
!!!!!
[b][color=#0066cc]搞定![/color][/b]
[b][color=#0066cc][实验二]ip default-network在EIGRP中应用案例[/color][/b]
[img]http://www.one-tom.com/bbs/uploads/justdoit/2006-10-03_154453_default-network2.jpg[/img]
[b][color=#0066cc]R1:[/color][/b]
R1(config)#router eigrp 100
R1(config-router)#net 192.168.12.0
[b][color=#0066cc]R2:[/color][/b]
R2(config)#no router rip
R2(config)#router eigrp 100
R2(config-router)#net 192.168.12.0
[b]R2(config-router)#net 192.168.23.0
R2(config-router)#pa s1/0[/b]
[b][color=#0066cc]实验结果[/color][/b]
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
[b]D* 192.168.23.0/24 [90/2681856] via 192.168.12.2, 00:00:21, Serial1/0[/b]
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
[b][color=#0066cc]可以看到配置中和RIP不同的情况,需要将所通告的默认路由网段通告到EIGRP/IGRP中;而且通告出去不像RIP变为了0 .0.0.0/0,仍旧是缺省网络。[/color][/b]