西安交通大学实验报告
课程:网络技术实验
完成时间:2010年5月14日
实验名称:RIP&OSPF协议的配置
实验内容
使用Boson NetSim软件模拟出路由器的环境,并分别运用RIP协议和OSPF协议配置动态路由。
RIP(Routing information Protocol)是应用较早、使用较普遍的内部网关协议(Interior Gateway Protocol,简称IGP),适用于小型同类网络,是典型的距离向量(distance-vector)协议。RIP通过广播UDP报文来交换路由信息,每30秒发送一次路由信息更新。RIP使用跳跃计数(hop count)作为尺度来衡量路由距离,跳跃计数是一个包到达目标所必须经过的路由器的数目。
OSPF(Open Shortest Path First)是一个内部网关协议(Interior Gateway Protocol,简称IGP),用于在单一自治系统(autonomous system,AS)内决策路由。与RIP相对,OSPF是链路状态路有协议,而RIP是距离向量路由协议。OSPF通过路由器之间通告网络接口的状态来建立链路状态数据库,生成最短路径树(最小生成树),每个OSPF路由器使用这些最短路径构造路由表。
使用Boson NetSim Designer软件设计一个含有三个路由器和两个PC机的网络环境,两个PC机器分别连接到两个路由器(1750)上,这两个1750型路由器连接到同一个2611型路由器上(使用串口)。
网络规划如下:
PC1与Router1相连,网络为192.168.0.0/24,PC1:192.168.0.2,Router1:192.168.0.1。
PC2与Router2相连,网络为192.168.1.0/24,PC2:192.168.1.2,Router2:192.168.1.1。
Router1与Router3相连,网络为192.168.2.0/24,Router1:192.168.2.1,Router3:192.168.2.3。
Router2与Router3相连,网络为192.168.3.0/24,Router2:192.168.3.2,Router3:192.168.3.3。
RIP协议的配置
在Router1上配置RIP协议:
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#router rip
Router(config-router)#network 192.168.0.0
Router(config-router)#network 192.168.2.0
Router(config-router)#exit
在Router2上配置RIP协议:
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#router rip
Router(config-router)#network 192.168.1.0
Router(config-router)#network 192.168.3.0
Router(config-router)#exit
在Router3上配置RIP协议:
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#router rip
Router(config-router)#network 192.168.2.0
Router(config-router)#network 192.168.3.0
Router(config-router)#exit
此时检查Router3的路由表:
Router#show ip route
C 192.168.2.0 is directly connected, Serial0
C 192.168.3.0 is directly connected, Serial1
R 192.168.0.0 [120/1] via 192.168.2.1, 00:04:27, Serial0
R 192.168.1.0 [120/1] via 192.168.3.2, 00:09:12, Serial1
可以看出三个路由器已经通过RIP协议自动配置好了转发路由表。PC1(192.168.0.2)也可以成功连接到PC2(192.168.1.1):
C:>tracert 192.168.1.2
"Type escape sequence to abort."
Tracing the route to 192.168.1.2
1 192.168.0.1 0 msec 16 msec 0 msec
2 192.168.2.3 20 msec 16 msec 16 msec
3 192.168.3.2 20 msec 16 msec 16 msec
4 192.168.1.2 20 msec 16 msec *
OSPF协议的配置
首先分别在三个路由器上执行以下指令以取消RIP协议的配置并清空路由表:conf t
no router rip
exit
clear ip route *
在Router1上执行以下指令(#后为注释,下同):
Router#conf t分别在Router2和Router3上执行类似指令。
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#router ospf 1
Router(config-router)#network 192.168.0.0 0.0.0.255 area 1
Router(config-router)#network 192.168.2.0 0.0.0.255 area 1
router ospf process-id:指定使用OSPF协议,process是1~65535范围内的算法进程号。
network address wildcard-mask area area-id:address和wildcard-mask共同指定一个网络。wildcard-mask是子网掩码的反码(本例中为0.0.0.255)。
此时在Router3上检查路由表,可以看到网络已经连通:
Router#show ip route
C 192.168.2.0 is directly connected, Serial0
C 192.168.3.0 is directly connected, Serial1
O 192.168.0.0 [110/64] via 192.168.2.1, 00:00:16, Serial0
O 192.168.1.0 [110/64] via 192.168.3.2, 00:00:11, Serial1
在PC1上也可以成功连接到PC2上:
C:>tracert 192.168.1.2
"Type escape sequence to abort."
Tracing the route to 192.168.1.2
1 192.168.0.1 0 msec 16 msec 0 msec
2 192.168.2.3 20 msec 16 msec 16 msec
3 192.168.3.1 20 msec 16 msec 16 msec
4 192.168.1.2 20 msec 16 msec *
(完)
笔记:
笔记:
配置动态路由
# PC1
winipcfg
# 192.20.10.87 255.255.255.0 192.20.10.1
# PC2
winipcfg
# 192.168.0.87/24 192.168.0.1
# Router1
enable
conf t
interface e0
ip address 192.20.10.1 255.255.255.0
no shutdown
exit
interface s0
ip address 192.200.10.1 255.255.255.0
exit
exit
show controllers
conf t
interface s0
clock rate 64000
exit
# Router2
......
# Router3
# Router1
conf t
router rip
network 192.20.10.0
network 192.200.10.0
exit
# Router2
conf t
router rip
network 192.168.0.0
network 192.16.10.0
exit
# Router3
conf t
router rip
network 192.200.10.0
network 192.16.10.0
exit
exit
# Router1
# 开始配置OSPF协议
# Router1,2,3
conf t
no router rip
exit
exit
# router1,2,3 清除路由表
clear ip route *
# Router1
conf t
router ospf 100
network 192.20.10.0 0.0.0.255 area 1 # 使用子网掩码的反码
network 192.200.10.0 0.0.0.255 area 1
exit
# Router2
conf t
router ospf 200
network 192.16.10.0 0.0.0.255 area 2
network 192.168.0.0 0.0.0.255 area 2
exit
# Router3
conf t
router ospf 300
network 192.200.10.0 0.0.0.255 area 1
network 192.16.0.0 0.0.0.255 area 2
exit
# Router2
show ip route
# 配置完成
没有评论:
发表评论