目录
一、简介
静态路由(Static routing):
是一种路由的方式,路由项(routing entry)由手动配置,而非动态决定。与动态路由不同,静态路由是固定的,不会改变,即使网络状况已经改变或是重新被组态。一般来说,静态路由是由网络管理员逐项加入路由表
。
RIP(Routing Information Protocol,路由信息协议):
是一种内部网关协议(IGP),是一种动态路由选择协议,用于自治系统(AS)内的路由信息的传递。RIP协议基于距离矢量算法(Bellham-Ford)(DistanceVectorAlgorithms),使用“跳数”(即metric)来衡量到达目标地址的路由距离。
OSPF(Open Shortest Path First,OSPF):
开放式最短路径优先,是被最广泛使用的一种动态路由协议,是一种链路状态协议。具有路由变化收敛速度快、无路由环路、支持变长子网掩码(VLSM)和汇总、层次区域划分等优点。
二、要求
2.1、实验所需要的拓扑图:
2.2、网络规划:
(1)、交换机与路由器之间的接口全部为 Trunk 类型,与pc之间的接口全部为Access。
(2)、R4:R4之下规划为4网段,接口G1设置ip为254。
R4与R1之间规划为1网段,接口G1设置ip为1。
(3)、R1:R1之下规划为1网段,接口G1设置ip为254。
R4与R1之间规划为1网段,接口G2设置ip为2。
R1与R2之间规划为1网段,接口G0设置ip为1。
(4)、R2:R1与R2之间规划为1网段,接口G0设置ip为2。
R2与R3之间规划为1网段,接口G1设置ip为1。
(5)、R3:R3之下规划为3网段,接口G1设置ip为254。
R2与R3之间规划为1网段,接口G0设置ip为2。
R3与R5之间规划为1网段,接口G2设置ip为1。
(6)、R5:R5之下规划为3网段,接口G1设置ip为254。
R3与R5之间规划为1网段,接口G0设置ip为2。
(7) PC的IP 地址及网关如下:
PC4的IP地址: 192.168.4.41/24,网关为192.168.4.254/24
PC1的IP地址: 192.168.1.11/24,网关为192.168.1.254/24
PC2的IP地址: 192.168.2.21/24,网关为 192.168.2.254/24
PC3的IP地址: 192.168.3.31/24,网关为 192.168.3.254/24
2.3、实验设备
1、2台S3700交换机
2、1台路由器
3、2台S5700交换机
4、4台PC端(分配好ip地址)
三、参数配置
3.1、配置PC端的基础配置
PC4的参数配置:
PC1的参数配置:
PC2的参数配置:
PC3的参数配置:
3.2、直连链路配置
S4参数配置:
sys
undo t m
sysname S4
int e0/0/1
p l a
int g0/0/1
p l tr
S1参数配置:
sys
undo t m
sysname S1
int e0/0/1
p l a
int g0/0/1
p l tr
S2参数配置:
sys
undo t m
sysname S2
int e0/0/1
p l a
int g0/0/1
p l tr
S3参数配置:
sys
undo t m
sysname S3
int e0/0/1
p l a
int g0/0/1
p l tr
R4的参数配置:
sys
undo t m
sysname R4
int g0/0/1
ip add 192.168.4.254 24
int g0/0/0
ip add 40.0.1.1 30
q
R1的参数配置:
sys
undo t m
sysname R1
int g0/0/1
ip add 40.0.1.2 30
int g0/0/0
ip add 10.0.1.1 30
int g0/0/2
ip add 192.168.1.254 24
ip route-static 20.0.1.0 30 10.0.1.2
ip route-static 30.0.1.0 30 10.0.1.2
q
R2的参数配置:
sys
undo t m
sysname R2
int g0/0/0
ip add 10.0.1.2 30
int g0/0/1
ip add 20.0.1.1 30
q
R3的参数配置:
sys
undo t m
sysname R3
int g0/0/0
ip add 20.0.1.2 30
int g0/0/1
ip add 30.0.1.1 30
int g0/0/2
ip add 192.168.2.254 24
q
R5的参数配置:
sys
undo t m
sysname R5
int g0/0/0
ip add 30.0.1.2 30
int g0/0/1
ip add 192.168.3.254 24
q
3.3、非直连链路配置
以下使用三种方法配置非直连链路(静态路由、RIP协议动态路由、OSPF路由),可按自己的需求选择一种进行配置
3.3.1、静态路由
R4的参数配置:
ip route-static 192.168.1.0 24 40.0.1.2
ip route-static 192.168.2.0 24 40.0.1.2
ip route-static 192.168.3.0 24 40.0.1.2
ip route-static 10.0.1.0 30 40.0.1.2
ip route-static 20.0.1.0 30 40.0.1.2
ip route-static 30.0.1.0 30 40.0.1.2
R1的参数配置:
ip route-static 192.168.4.0 24 40.0.1.1
ip route-static 192.168.3.0 24 10.0.1.2
ip route-static 192.168.2.0 24 10.0.1.2
ip route-static 20.0.1.0 30 10.0.1.2
ip route-static 30.0.1.0 30 10.0.1.2
R2的参数配置:
ip route-static 192.168.4.0 24 10.0.1.1
ip route-static 192.168.1.0 24 10.0.1.1
ip route-static 192.168.2.0 24 20.0.1.2
ip route-static 192.168.3.0 24 20.0.1.2
ip route-static 40.0.1.0 30 10.0.1.1
ip route-static 30.0.1.0 30 20.0.1.2
R3的参数配置:
ip route-static 192.168.4.0 24 20.0.1.1
ip route-static 192.168.1.0 24 20.0.1.1
ip route-static 192.168.3.0 24 30.0.1.2
ip route-static 40.0.1.0 30 20.0.1.1
ip route-static 10.0.1.0 30 20.0.1.1
R5的参数配置:
ip route-static 192.168.4.0 24 30.0.1.1
ip route-static 192.168.1.0 24 30.0.1.1
ip route-static 192.168.2.0 24 30.0.1.1
ip route-static 40.0.1.0 30 30.0.1.1
ip route-static 10.0.1.0 30 30.0.1.1
ip route-static 20.0.1.0 30 30.0.1.1
3.3.2、RIP协议配置动态路由
R4的参数配置:
rip 1
version 2
network 192.168.4.0
network 40.0.0.0
R1的参数配置:
rip 1
version 2
network 192.168.1.0
network 40.0.0.0
network 10.0.0.0
R2的参数配置:
rip 1
version 2
network 10.0.0.0
network 20.0.0.0
R3的参数配置:
rip 1
version 2
network 192.168.2.0
network 20.0.0.0
network 30.0.0.0
R5的参数配置:
rip 1
version 2
network 192.168.3.0
network 30.0.0.0
3.3.3、OSPF路由配置
R4配置参数:
ospf 1 router-id 1.1.1.1
area 0
network 192.168.4.0 0.0.0.255
network 40.0.1.0 0.0.0.3
R1配置参数:
ospf 1 router-id 2.2.2.2
area 0
network 192.168.1.0 0.0.0.255
network 40.0.1.0 0.0.0.3
network 10.0.1.0 0.0.0.3
R2配置参数:
ospf 1 router-id 3.3.3.3
area 0
network 10.0.1.0 0.0.0.3
network 20.0.1.0 0.0.0.3
R5配置参数:
ospf 1 router-id 5.5.5.5
area 0
network 30.0.1.0 0.0.0.3
network 192.168.3.0 0.0.0.255
R3配置参数:
ospf 1 router-id 4.4.4.4
area 0
network 30.0.1.0 0.0.0.3
network 20.0.1.0 0.0.0.3
network 192.168.2.0 0.0.0.255
最后记得使用“save”保存
四、测试
PC4 ping PC1、PC2、PC3
点赞收藏不迷路,给个好评吧~