静态路由配置实验相关过程

实验要求如下:

  1. 除R5的环回地址固定以外,整个其他所有网段基于192.168.1.0/24进行合理的ip地址划分
  2. R1-R4每个路由器存在两个环回接口,用于模拟连接Pc的网段,地址也在192.168.1.0/24这个范围内
  3. R1-R4上不能直接写到达5.5.5.0/24的静态路由,但依然可以访问
  4. 全网可达,尽量减少每台路由器路由表条日数量,避免环路出现
  5. R4与R5间,正常走1000M链路通信,故障时自动改为100M链路

拓扑图如下:

实验步骤:

  1. IP地址划分,统计拓扑图中一共有多少个广播域,分析各个网段需要的IP地址,分配IP
  2. 配置各个路由器接口地址以及环回地址
  3. 配置静态路由,使其全网可达

划分IP的思路:

由于R1-R4各有两个环回接口,骨干链路共六条,则该拓扑图一共有14个广播域。

IP分配地址如下:

|------------------|----------------------------------------------------------------------------------------------|
| 基于192.168.1.0/24划分过程如下 ||
| 一个骨干 | 划分六个骨干链路 |
| 192.168.1.0/27 | 192.168.1.0/30 192.168.1.4/30 192.168.1.8/30 192.168.1.12/30 192.168.1.16/30 192.168.1.20/30 |
| 四个路由的环回 | 划分两个环回接口 |
| 192.168.32.0/27 | 192.168.1.32/28 192.168.1.48/28 |
| 192.168.1.64/27 | 192.168.1.64/28 192.168.1.80/28 |
| 192.168.1.96/27 | 192.168.1.96/28 192.168.1.112/28 |
| 192.168.1.128/27 | 192.168.1.128/28 192.168.1.144/28 |

R1配置如下:

bash 复制代码
#接口IP地址配置
[R1]int g0/0/0
[R1]ip add 192.168.1.1 30

[R1]disp this 
#静态路由配置如下
ip route-static 192.168.1.8 255.255.255.252 192.168.1.2
ip route-static 192.168.1.12 255.255.255.252 192.168.1.6
ip route-static 192.168.1.16 255.255.255.252 192.168.1.2
ip route-static 192.168.1.16 255.255.255.252 192.168.1.6
ip route-static 192.168.1.64 255.255.255.224 192.168.1.2
ip route-static 192.168.1.96 255.255.255.224 192.168.1.6
ip route-static 192.168.1.128 255.255.255.224 192.168.1.2
ip route-static 192.168.1.128 255.255.255.224 192.168.1.6

#手工汇总环回空接口配置,可防止路由黑洞
[R1]ip route-static 192.168.1.32 27 NULL 0

#缺省路由配置
[R1]ip route-static 0.0.0.0 0 192.168.1.2
[R1]ip route-static 0.0.0.0 0 192.168.1.6

R2配置如下:

bash 复制代码
#静态路由配置如下
[R2]ip route-static 192.168.1.128 27 192.168.1.10
[R2]ip route-static 192.168.1.12 30 192.168.1.10
[R2]ip route-static 192.168.1.96 27 192.168.1.10
[R2]ip route-static 192.168.1.96 27 192.168.1.1
[R2]ip route-static 192.168.1.4 30 192.168.1.1
[R2]ip route-static 192.168.1.16 30 192.168.1.10
[R2]ip route-static 192.168.1.32 27 192.168.1.1


#空接口配置
[R2]ip route-static 192.168.1.64 27 NULL 0

#缺省
[R2]ip route-static 0.0.0.0 0 192.168.1.10

R3配置如下:

bash 复制代码
[R3]dis this 

#静态路由以及空接口配置如下

ip route-static 192.168.1.0 255.255.255.252 192.168.1.5
ip route-static 192.168.1.8 255.255.255.252 192.168.1.14
ip route-static 192.168.1.16 255.255.255.252 192.168.1.14
ip route-static 192.168.1.32 255.255.255.224 192.168.1.5
ip route-static 192.168.1.64 255.255.255.224 192.168.1.5
ip route-static 192.168.1.64 255.255.255.224 192.168.1.14
ip route-static 192.168.1.96 255.255.255.224 NULL0
ip route-static 192.168.1.128 255.255.255.224 192.168.1.14

#缺省
[R3]ip route-static 0.0.0.0 0 192.168.1.14

R4配置如下:

bash 复制代码
[R4]display this 

#静态路由配置、空接口配置如下
ip route-static 0.0.0.0 0.0.0.0 192.168.1.18
ip route-static 192.168.1.0 255.255.255.252 192.168.1.9
ip route-static 192.168.1.4 255.255.255.252 192.168.1.13
ip route-static 192.168.1.32 255.255.255.224 192.168.1.13
ip route-static 192.168.1.32 255.255.255.224 192.168.1.9
ip route-static 192.168.1.64 255.255.255.224 192.168.1.9
ip route-static 192.168.1.96 255.255.255.224 192.168.1.13
ip route-static 192.168.1.128 255.255.255.224 NULL0

#缺省
[R4]ip route-static 0.0.0.0 0 192.168.1.18

#设置100M链路的优先级为61

[R4]ip route-static 0.0.0.0 0.0.0.0 192.168.1.22 preference 61

R5配置如下:

bash 复制代码
#静态路由配置如下
[R5]ip route-static 192.168.1.0 255.255.255.252 192.168.1.17
[R5]ip route-static 192.168.1.4 255.255.255.252 192.168.1.17
[R5]ip route-static 192.168.1.8 255.255.255.252 192.168.1.17
[R5]ip route-static 192.168.1.12 255.255.255.252 192.168.1.17
[R5]ip route-static 192.168.1.32 255.255.255.224 192.168.1.17
[R5]ip route-static 192.168.1.128 255.255.255.224 192.168.1.17
[R5]ip route-static 192.168.1.64 255.255.255.224 192.168.1.17
[R5]ip route-static 192.168.1.96 255.255.255.224 192.168.1.17

#配置100M链路的优先级为61
[R5]ip route-static 192.168.1.0 255.255.255.252 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.4 255.255.255.252 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.8 255.255.255.252 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.12 255.255.255.252 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.32 255.255.255.224 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.128 255.255.255.224 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.64 255.255.255.224 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.96 255.255.255.224 192.168.1.21 preference 61

#!注意R5上的缺省也须配置优先级,不然依然不可到达5.5.5.0的网段

[R5]ip route-static 0.0.0.0 0.0.0.0 192.168.1.21 preference 61

到此,完成了所有实验要求,我们尝试用R1去ping通R5的环回,如下:

可以ping通,实验成功~

配置过程中,需要注意每个经过手工汇总的路由后,一定要再配置其手工汇总的空接口。

相关推荐
wmm_会飞的@鱼7 分钟前
FlexSim-汽车零部件仓库布局优化与仿真
服务器·前端·网络·数据库·数学建模·汽车
Deutsch.22 分钟前
负载均衡Haproxy
运维·负载均衡·haproxy
-XWB-1 小时前
【安全漏洞】网络守门员:深入理解与应用iptables,守护Linux服务器安全
linux·服务器·网络
不做无法实现的梦~1 小时前
mid360连接机载电脑,远程桌面连接不上的情况
运维·服务器·电脑
还是朝夕1 小时前
OSPF路由协议 多区域
网络
消失的旧时光-19431 小时前
Android网络框架封装 ---> Retrofit + OkHttp + 协程 + LiveData + 断点续传 + 多线程下载 + 进度框交互
android·网络·retrofit
运维成长记1 小时前
关于linux运维 出现高频的模块认知
运维·职场和发展·云计算
kura_tsuki2 小时前
[Linux入门] Linux 远程访问及控制全解析:从入门到实战
linux·服务器·安全
张火火isgudi2 小时前
CentOS8 使用 Docker 搭建 Jellyfin 家庭影音服务器
服务器·docker·容器
IT成长日记2 小时前
【自动化运维神器Ansible】Ansible常用模块之archive模块详解
运维·自动化·ansible·常用模块·archive