ip default-network在RIP中的应用[文档] 默认路由系列文档2/5
2007-03-28
实验目的:在《手动
配置静态默认路由(详细)[文档] 默认路由系列1/5》的基础上让边界
路由器
自动通告0.0.0.0 /0的默认路由。解决《手动配置静态默认路由(详细)[文档] 默认路由系列1/5》
中的遗留问题。
实验设计:

实验配置:
------------------------------------------------------------------------------------
R1#show run
Building configuration...
Current configuration : 875 bytes
!
version 12.3
!
hostname R1
!
interface Serial1/0
ip address 12.1.1.1 255.255.255.0
!
router
rip
network 12.0.0.0
!
end
------------------------------------------------------------------------------------
R2#show run
Building configuration...
Current configuration : 885 bytes
!
version 12.3
!
hostname R2
!
interface Serial1/0
ip address 12.1.1.2 255.255.255.0
!
interface Serial1/1
ip address 23.1.1.2 255.255.255.0
!
router rip
network 12.0.0.0
!
end
------------------------------------------------------------------------------------
R3#show run
Building configuration...
Current configuration : 934 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
!
ip route 0.0.0.0 0.0.0.0 23.1.1.2
!
end
------------------------------------------------------------------------------------
实验目的:让网络边界两边的路由器互通,
实验说明:
实际中网络边界两边的路由器的配置是相同的
为了实验简便,我在对端(R3)上已经配置了默认路由
ip route 0.0.0.0 0.0.0.0 23.1.1.2
只要这边的路由可以到达对端R3,就可ping通
R2(config)#ip route 0.0.0.0 0.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 0.0.0.0
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, Serial1/1
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/0
S* 0.0.0.0/0 [1/0] via 23.1.1.3
R2有了可以到达R3的路由
我们看看R1的路由表
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
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/
没有默认路由
现在我们让R2向运行RIP的路由器通告默认路由
R2(config)#ip default-network 23.0.0.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 0.0.0.0
* 23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, Serial1/1
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/0
S* 0.0.0.0/0 [1/0] via 23.1.1.3
在看R1 的路由表
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
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/0
没有默认路由!!!
什么原因呢?
我们先配ip default-network看看效果
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#no ip route 0.0.0.0 0.0.0.0 23.1.1.3
R2(config)#do 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
* 23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, Serial1/1
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/0
R2(config)#ip route 0.0.0.0 0.0.0.0 23.1.1.3
再看一下R1 的路由表
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 12.1.1.2 to network 0.0.0.0
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/0
R* 0.0.0.0/0 [120/1] via 12.1.1.2, 00:00:09, Serial1/0
R1#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 = 52/85/164 ms
总结:使用RIP协议时,可以用ip default-network 向内部通告默认路由,简化了配置,方便管理
注意:边界路由器上要先配置 ip route 0.0.0.0 0.0.0.0 x.x.x.x 后配置ip default-network
对于ip default-network这条命令在RIP中作用和要注意的问题请见
《 ip default-network 在RIP协议中要注意的问题[文档] 默认路由系列文档3/5》