实验作业1+整理笔记截图
一需求
1.除了R5的环回地址固定5.5.5.0/24,其他网段基于192.168.1.0/24进行合理划分;
2.R1-R4每个路由器存在两个环回接口,模拟PC,地址也在192.168.1.0/24网络内;
3.R1-R4不能直接编写到达5.5.5.0/24的静态路由,但依然可以访问;
4.全网可达,尽量减少每台路由器路由条目数量,避免环路;
5.R4与R5间,正常1000M链路通信,故障时自动改为100M;
二分析
网段划分分析(基于 192.168.1.0/24)
- 划分逻辑
- 采用 “二分法” 先将 192.168.1.0/24 拆分为两个 / 25 子网:
- 192.168.1.0/25(0-127):用于设备间骨干链路(共 6 条链路,每条需 2 个 IP,采用 / 30 子网掩码,每个子网含 2 个可用 IP)。
- 192.168.1.128/25(128-255):用于 R1-R4 的环回接口(共 8 个接口,每个环回划分为 / 28 子网,含 14 个可用 IP,满足 “每个路由器 2 个环回” 需求)。
- 采用 “二分法” 先将 192.168.1.0/24 拆分为两个 / 25 子网:
- 具体划分结果
- 骨干链路:192.168.1.0/30、4/30、8/30、12/30、16/30、20/30(覆盖 6 条链路)。
- 环回网段:
- R1:128/28(128-143)、144/28(144-159)
- R2:160/28(160-175)、176/28(176-191)
- R3:192/28(192-207)、208/28(208-223)
- R4:224/28(224-239)、240/28(240-255)
- 合理性:通过 VLSM 实现地址精准分配,无浪费,且链路与环回地址段严格分离,便于管理。
R1-R4 环回接口配置分析
- 模拟 PC 的实现
- 每台路由器配置 2 个 LoopBack 接口(如 R1 的 LoopBack0/1),接口地址取自对应环回网段的第一个可用 IP(如 R1 的 LoopBack0 为 192.168.1.129/28),符合 “环回地址在 192.168.1.0/24 内” 的要求。
- 环回接口采用 / 28 子网掩码,既满足单接口主机地址需求,又预留扩展空间(每个环回网段含 14 个 IP,可模拟多台 PC)。
R1-R4 访问 5.5.5.0/24 的路由策略分析
- 需求满足方式
- R1-R4 未直接配置到达 5.5.5.0/24 的静态路由,而是通过以下路径间接访问:
- R1 通过默认路由(下一跳 192.168.1.2/6)指向 R2/R3,再由 R2/R3 转发至 R4,最终由 R4 通过静态路由(指向 R5 的 192.168.1.18/22)到达 5.5.5.0/24。
- R2/R3 通过静态路由(下一跳 R4 的 192.168.1.10/14)将 5.5.5.0/24 的流量转发至 R4,再由 R4 传递给 R5。
- 核心逻辑:借助中间设备(R2/R3/R4)的路由传递,避免 R1-R4 直接配置目标路由,同时实现可达性。
- R1-R4 未直接配置到达 5.5.5.0/24 的静态路由,而是通过以下路径间接访问:
全网可达与路由优化分析
- 全网可达保障
- 所有设备通过静态路由手动指定跨网段路径:例如 R1 配置指向 R2 的路由覆盖 R2 环回、R3 环回、R4 环回及 R5 链路;R5 配置指向 R4 的路由覆盖所有 192.168.1.0/24 子网,确保双向通信。
- 路由条目优化与防环
- 减少条目:通过汇总路由(如 R1 用 192.168.1.160/27 指向 R2,覆盖 R2 的两个环回)代替明细路由,降低单设备路由数量。
- 防环措施:静态路由采用 “单向指向” 设计(如 R1→R2→R4→R5),避免路由双向交叉;同时通过子网掩码严格区分网段,防止地址重叠导致的环路。
R4 与 R5 链路冗余分析
- 链路优先级配置
- 1000M 链路(GigabitEthernet0/0/2 与 R5 的 GigabitEthernet0/0/0):IP 为 192.168.1.17/18,R4 配置指向该链路的路由优先级为默认(60),作为主链路。
- 100M 链路(GigabitEthernet4/0/0 与 R5 的 GigabitEthernet0/0/1):IP 为 192.168.1.21/22,R5 配置该链路的路由优先级为 61(高于主链路的 60),作为备份链路。
- 故障自动切换
- 正常情况下,R4 优先选择主链路(1000M)转发流量,因主链路路由优先级更高。
- 当主链路故障(如断连),R4/R5 的路由表自动启用备份链路(100M)的路由(优先级 61),实现流量无缝切换,满足 “故障时自动切换” 需求。
三IP地址分配
8个环回网段
6个骨干链路网段
将192.168.1.0/24划分为两个子网
192.168.1.0/25 给骨干链路使用
192.168.1.128/25给环回网段使用
先做骨干链路的需求:
192.168.1.0 00000 00 192.168.1.0/30
192.168.1.0 00001 00 192.168.1.4/30
192.168.1.0 00010 00 192.168.1.8/30
192.168.1.0 00011 00 192.168.1.12/30
192.168.1.0 00100 00 192.168.1.16/30
192.168.1.0 00101 00 192.168.1.20/30
环回网段:
192.168.1.128/25 划分为四个子网,每个子网再分别换分为两个子网
192.168.1.1 00 00000 192.168.1.128/27 给R1的环回使用
192.168.1.1 01 00000 192.168.1.160/27 给R2的环回使用
192.168.1.1 10 00000 192.168.1.192/27 给R3的环回使用
192.168.1.1 11 00000 192.168.1.224/27 给R4的环回使用
R1的两个环回:192.168.1.128/28 192.168.1.144/28
R2的两个环回:192.168.1.160/28 192.168.1.176/28
R3的两个环回:192.168.1.192/28 192.168.1.208/28
R4的两个环回:192.168.1.224/28 192.168.1.240/28
四各个配置
R1
sysname R1
#
interface GigabitEthernet0/0/0
ip address 192.168.1.1 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 192.168.1.5 255.255.255.252
#
interface LoopBack0
ip address 192.168.1.129 255.255.255.240
#
interface LoopBack1
ip address 192.168.1.145 255.255.255.240
#
ip route-static 0.0.0.0 0.0.0.0 192.168.1.2
ip route-static 0.0.0.0 0.0.0.0 192.168.1.6
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.2
ip route-static 192.168.1.16 255.255.255.252 192.168.1.2
ip route-static 192.168.1.20 255.255.255.252 192.168.1.2
ip route-static 192.168.1.160 255.255.255.224 192.168.1.2
ip route-static 192.168.1.192 255.255.255.224 192.168.1.2
ip route-static 192.168.1.224 255.255.255.224 192.168.1.2
R2
sysname R2
#
interface GigabitEthernet0/0/0
ip address 192.168.1.2 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 192.168.1.9 255.255.255.252
#
interface GigabitEthernet0/0/2
#
interface LoopBack0
ip address 192.168.1.161 255.255.255.240
#
interface LoopBack1
ip address 192.168.1.177 255.255.255.240
#
ip route-static 0.0.0.0 0.0.0.0 192.168.1.10
ip route-static 5.5.5.0 255.255.255.240 192.168.1.10
ip route-static 192.168.1.4 255.255.255.252 192.168.1.1
ip route-static 192.168.1.12 255.255.255.252 192.168.1.10
ip route-static 192.168.1.16 255.255.255.252 192.168.1.10
ip route-static 192.168.1.20 255.255.255.252 192.168.1.10
ip route-static 192.168.1.128 255.255.255.224 192.168.1.1
ip route-static 192.168.1.192 255.255.255.224 192.168.1.1
ip route-static 192.168.1.224 255.255.255.224 192.168.1.10
R3
#
sysname R3
#interface GigabitEthernet0/0/0
ip address 192.168.1.13 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 192.168.1.6 255.255.255.252
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
ip address 192.168.1.193 255.255.255.240
#
interface LoopBack1
ip address 192.168.1.209 255.255.255.240
#
ip route-static 0.0.0.0 0.0.0.0 192.168.1.14
ip route-static 5.5.5.0 255.255.255.240 192.168.1.14
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.20 255.255.255.252 192.168.1.14
ip route-static 192.168.1.128 255.255.255.224 192.168.1.5
ip route-static 192.168.1.160 255.255.255.224 192.168.1.2
ip route-static 192.168.1.224 255.255.255.224 192.168.1.14
#
R4
#
sysname R4
interface GigabitEthernet0/0/0
ip address 192.168.1.10 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 192.168.1.14 255.255.255.252
#
interface GigabitEthernet0/0/2
ip address 192.168.1.17 255.255.255.252
#
interface GigabitEthernet4/0/0
ip address 192.168.1.21 255.255.255.252
interface LoopBack0
ip address 192.168.1.225 255.255.255.240
#
interface LoopBack1
ip address 192.168.1.241 255.255.255.240
#
ip route-static 0.0.0.0 0.0.0.0 192.168.1.18
ip route-static 0.0.0.0 0.0.0.0 192.168.1.22
ip route-static 5.5.5.0 255.255.255.240 192.168.1.18
ip route-static 5.5.5.0 255.255.255.240 192.168.1.22
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.128 255.255.255.224 192.168.1.9
ip route-static 192.168.1.128 255.255.255.224 192.168.1.13
ip route-static 192.168.1.160 255.255.255.224 192.168.1.9
ip route-static 192.168.1.192 255.255.255.224 192.168.1.13
R5
#
sysname R5
#interface GigabitEthernet0/0/0
ip address 192.168.1.18 255.255.255.252
#
interface GigabitEthernet0/0/1
ip address 192.168.1.22 255.255.255.252
interface LoopBack0
ip address 5.5.5.5 255.255.255.0
#
ip route-static 192.168.1.0 255.255.255.252 192.168.1.17
ip route-static 192.168.1.0 255.255.255.252 192.168.1.21 preference 61
ip route-static 192.168.1.4 255.255.255.252 192.168.1.17
ip route-static 192.168.1.4 255.255.255.252 192.168.1.21 preference 61
ip route-static 192.168.1.8 255.255.255.252 192.168.1.17
ip route-static 192.168.1.8 255.255.255.252 192.168.1.21 preference 61
ip route-static 192.168.1.12 255.255.255.252 192.168.1.17
ip route-static 192.168.1.12 255.255.255.252 192.168.1.21 preference 61
ip route-static 192.168.1.128 255.255.255.224 192.168.1.7
ip route-static 192.168.1.128 255.255.255.224 192.168.1.21 preference 61
ip route-static 192.168.1.160 255.255.255.224 192.168.1.7
ip route-static 192.168.1.160 255.255.255.224 192.168.1.21 preference 61
ip route-static 192.168.1.192 255.255.255.224 192.168.1.17
ip route-static 192.168.1.192 255.255.255.224 192.168.1.21 preference 61
ip route-static 192.168.1.224 255.255.255.224 192.168.1.17
ip route-static 192.168.1.224 255.255.255.224 192.168.1.21 preference 61
#
五实验验证: