查看完整版本: ip default-network 在RIP协议中要注意的问题

隐身术 2007-11-12 12:54

ip default-network 在RIP协议中要注意的问题

ip default-network 在RIP协议中要注意的问题[文档]  默认路由系列文档3/5
2007-03-28
实验设计:

[img=357,240]http://www.one-tom.com/bbs/uploads/20070328_140116_XY007.png[/img]
配置:
R1#show run
Building configuration...
Current configuration : 901 bytes
!
version 12.3
!
hostname R1
!
interface Loopback0
ip address 1.1.1.1 255.255.255.0
!
interface FastEthernet0/0
ip address 112.1.1.1 255.255.255.0
!
end
--------------------------------------------------------------------
R2#show run
Building configuration...
Current configuration : 939 bytes
!
version 12.3
!
hostname R2
!
interface Loopback0
ip address 2.2.2.2 255.255.255.0
!
interface FastEthernet0/0
ip address 112.1.1.2 255.255.255.0
!
interface Serial1/1
ip address 23.1.1.2 255.255.255.0
!
end
-----------------------------------------------------------------------
R3#show run
Building configuration...
Current configuration : 900 bytes
!
version 12.3
!
hostname R3
!
interface Loopback0
ip address 3.3.3.3 255.255.255.0
!         
interface Serial1/0
ip address 23.1.1.3 255.255.255.0
!
end
-------------------------------------------------------------
1、R2(config)#ip default-network 23.1.1.0
R2#show ip ro
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 23.1.1.3 to network 10.0.0.0
     2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, Loopback0
     23.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C       23.1.1.0/24 is directly connected, Serial1/1
S       23.0.0.0/8 [1/0] via 23.1.1.0
     112.0.0.0/24 is subnetted, 1 subnets
C       112.1.1.0 is directly connected, FastEthernet0/0
出现了一条静态路由
我们看看配置文件
R2#show run
Building configuration...
Current configuration : 948 bytes
!
version 12.3
!
hostname R2
!
.
.
.
!  
ip route 23.0.0.0 255.0.0.0 23.1.1.0
!
end
出现了一条奇怪的静态路由,尤其是下一条地址怎么可能是X.X.X.0呢。
说明ip default-network后面之可以接主类网络的网络号
删除掉上面的配置
R2(config)#no ip route 23.0.0.0 255.0.0.0 23.1.1.0
%No matching route to delete                                                //报错
R2(config)#no ip default-network 23.1.1.0                           
可以(与实验手册的实验结果不同,可能是IOS版本的原因)
附:本文档实验环境
IOS (tm) 7200 Software (C7200-JK9SU2-M), Version 12.3(16a), RELEASE SOFTWARE (fc2)
2、
R2(config)#ip default-network 23.0.0.0
R2#show run
Building configuration...
Current configuration : 939 bytes
!
version 12.3
!
hostname R2
!
.
.
.
!
ip default-network 23.0.0.0
!
end
         
R2#show ip ro
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
     2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, Loopback0
*   23.0.0.0/24 is subnetted, 1 subnets
C       23.1.1.0 is directly connected, Serial1/1
     112.0.0.0/24 is subnetted, 1 subnets
C       112.1.1.0 is directly connected, FastEthernet0/0
R2#ping 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
路由表中有了星号的默认路由,但无法到达R3的环回口

3、R2(config)#router rip
      R2(config-router)#net 112.0.0.0
      
      R1(config)#router rip
      R1(config-router)#net 112.0.0.0
R1#show ip ro
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 112.1.1.2 to network 0.0.0.0
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
     112.0.0.0/24 is subnetted, 1 subnets
C       112.1.1.0 is directly connected, FastEthernet0/0
R*   0.0.0.0/0 [120/1] via 112.1.1.2, 00:00:09, FastEthernet0/0
对于这种没有对应接口的默认路由,RIP会通告一条0.0.0.0/0的路由条目出去
R1#ping 23.1.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 23.1.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/68/132 ms
4、
R2(config)#no ip default-network 23.0.0.0
R2(config)#ip default-network 10.0.0.0
R2(config)#ip route 10.0.0.0 255.0.0.0 23.1.1.3
R2#show ip ro
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 23.1.1.3 to network 10.0.0.0
     2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, Loopback0
     23.0.0.0/24 is subnetted, 1 subnets
C       23.1.1.0 is directly connected, Serial1/1
     112.0.0.0/24 is subnetted, 1 subnets
C       112.1.1.0 is directly connected, FastEthernet0/0
S*   10.0.0.0/8 [1/0] via 23.1.1.3
R2#ping 3.3.3.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/54/100 ms
默认路由有了对应的端口,R2 的任何未知路由都会发到这个端口
R1#show ip ro
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
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
     112.0.0.0/24 is subnetted, 1 subnets
C       112.1.1.0 is directly connected, FastEthernet0/0
此时R2不会发送0.0.0.0/0的默认路由了

[color=#0000ff]总结[/color]:
         1、ip default-network 后面接的网络地址要求是主类网络号
         2、不手动加静态路由的时候,默认路由没有对应端口。RIP会通告出0.0.0.0/0的默认路由。
         注意:此时 ip default-network 后面的网络地址必须在路由表中有,否则不起作用;但是具体是哪个地址,效果一样。也就是说这个地址没有实际作用,该路有并不可以ping到外部路由的环回口地址。
         3、手动加上该主类网络的静态路由时,默认路由就有了对应端口,此时该路由器就可以ping外部路由器的环回口地址了。
[color=#0000ff][b]对于ip default-network 在EIGRP协议中的应用请见[/b][/color]
[color=#0000ff][b]《ip default-network 在EIGRP协议中的应用[文档]  默认路由系列文档4/5》
[/b][/color]

寻衣草 2007-12-8 23:16

谢谢楼主的提醒,确实很多问题都应该注意的

吉祥猪 2008-1-14 15:07

楼主说的删除掉上面的配置是指那个静态地址还是配置文件里的所有配置
页: [1]
查看完整版本: ip default-network 在RIP协议中要注意的问题