作者:zieckey(zieckey@yahoo.com.cn)
All Rights Reserved
1. 实验目的
1)
掌握默认路由在组网中的应用
2)
掌握
ip default-network
命令的用法
3)
比较
ip default-network
命令和
ip route 0.0.0.0 0.0.0.0
命令设置路由的实现方法和实现特点
2. 实验原理
可被路由的协议(
Routed Protocol
)由路由协议
(Routing Protocol
)传输,前者亦称为网络协议。这些网络协议执行在源与目的设备的用户应用间通信所需的各种功能,不同的协议中这些功能可能差异很大。网络协议发生在
OSI
参考模型的上四层:传输层、会话层、表示层和应用层。
术语
routed protocol
(可被路由的协议)和
routing protocol
(路由协议)经常被混淆。
routed protocol
在网络中被路由,例如
IP
、
DECnet
、
AppleTalk
、
Novell NetWare
、
OSI
、
Banyan VINES
和
Xerox Network System(XNS)
。而路由协议是实现路由算法的协议,简单地说,它给网络协议做导向。路由协议如:
IGRP
、
EIGRP
、
OSPF
、
EGP
、
BGP
、
IS-IS
及
RIP
等。
3. 实验过程
3.1.配置路由器各个接口IP地址
London
(config)#interface s0/0/1
London
(config-if)#ip address 172.16.1.1 255.255.255.0
London
(config-if)#no shutdown
London
(config-if)#exit
London
(config)#interface loopback 0
London
(config-if)#ip address 10.1.1.1 255.255.255.0
London
(config-if)#no shutdown
London
(config-if)#exit
London
#show CDP neighbors
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
S - Switch, H - Host, I - IGMP, r - Repeater
Device ID Local Intrfce Holdtme Capability Platform Port ID
denver
Ser 0/0/0 170 R S I 2811 Ser 0/0/1
sw5 Fas 0/1 169 S I WS-C3560- Fas 0/3
Florence
Ser 0/0/1 156 R S I 2811 Ser 0/0/0
sw9 Fas 0/0 176 S I WS-C2950T Fas 0/23
London
#
测试是否连通
London
#ping 192.168.1.1
3.2.配置RIP v1
London
(config)#router rip
London
(config-router)#network 10.0.0.0
Florence
(config)#router rip
Florence
(config-router)#network 10.0.0.0
Florence
(config-router)#network 172.16.0.0
3.3.配置Florence、Denvor路由
Florence
(config-router)# ip route 0.0.0.0 0.0.0.0 172.16.3.1
Denvor(config-router)# ip route 10.1.1.0 0.0.0.0 172.16.3.2
Denvor (config-router)# ip route 10.3.3.0 0.0.0.0 172.16.3.2
3.4.在London上ping 192.168.1.1
London
#ping 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
这里
ping
不通是很正常的,因为,在
London
上没有到
192.168.1.1
的路由,
London
#show ip route
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 le
ia - IS-IS inter area, * - candidate default, U - per-user stati
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.1.0 is directly connected, Serial0/0/1
10.0.0.0/24 is subnetted, 1 subnets
C 10.1.1.0 is directly connected, Loopback0
C 192.168.100.0/24 is directly connected, FastEthernet0/1
3.5.配置一条默认路由
London
#ip default-network 172.16.0.0
3.6.再次在London上ping 192.168.1.1
London
#ping 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/28/28 ms
配置默认路由后网络就通了,这就说明在路由表中有默认路由时,没有在路由表中的
IP
地址的数据包就通过默认路由发送。
London
#show ip route
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 10.3.3.2 to network 172.16.0.0
R* 172.16.0.0/16 [120/1] via 10.3.3.2, 00:00:01, Serial0/0/1
10.0.0.0/24 is subnetted, 2 subnets
C 10.3.3.0 is directly connected, Serial0/0/1
C 10.1.1.0 is directly connected, Loopback0
C 192.168.100.0/24 is directly connected, FastEthernet0/1
4. 实验分析与总结
通过这次实验让我们更深刻的了解了路由表中默认路由的用法和好处。同时我们又多接触了一些
Cisco IOS
命令。
下面对默认路由的原理和用法总结一下:
R1---1.0---R2---2.0---R3
假如这是一个拓扑,那么在
R1
上起默认路由数据将从
R1
的
S0
口转发出去到达
R2
,因为
R2
的路由表上有一条
2.0
网段的路由所以数据就可以发到
R3
上,然后在
R3
上起默认路由数据将从
R3
的
S0
口转发出去到达
R2
,因为
R2
的路由表上有一条
1.0
网段的路由所以数据就可以发到
R1
上,这样整个网络就可以连通了
---1.1.1.1---R1---1.0---R2---2.0---R3---2.2.2.2---
如果在
R1
和
R3
的两端加上环回接口,那么因为
R2
没有到达两个环回的路由所以数据无法到达环回的网段上,这时只要在
R2
上起两条静态路由到环回上在
R2
上就有到达两个环回的路由,依照前面的原理就知道这时整个网段都是连通的。