实验要求:
1.除R5的环回地址固定以外,整个其他所有网段基于192.168.1.0/24进行合理的ip地址划分
2.R1-R4每个路由器存在两个环回接口,用于模拟连接pc网段;地址也在192.168.1.0/24这个网络范围内,R3下面pc通过DHCP获取一个合法的地址
3.R1-R4上不能直接编写到达5.5.5.0/24的静态路由,但依然可以访问
4.全网可达,尽量减少每台路由器,路由表条目数量,避免环路出现
5.R4与R5间,正常1000M链路同学,故障时自动改为100M
实验步骤:
1.先根据实验要求对拓扑图进行分析:
- R1,R2,R4上各有两个环回接口,相当于各有两个广播域,R3有一个环回接口,所以总共有7个广播域
- 骨干线路共有6条,相当于共有6个广播域
- 如果直接对这13个广播域进行子网划分,会浪费部分IP地址,利用率不能最大化,预留的IP地址也会较少
2.IP地址划分
思路:
- ①将R1,R2,R4上的两个环回地址看做为一个整体
- ②将所有的骨干线路的广播域看做一个整体
- ③因此,共有5个广播域。因为2^3=8,所以至少需要向主机位借3位
2.1基于192.168.1.0/24进行合理的ip地址划分
192.168.1.0 24 ===>192.168.1.000 00000
主机位借3位共有以下8种结果:
①000 ②001 ③010 ④011 ⑤100 ⑥101 ⑦110 ⑧111
所以可以最多划分出8个网段
第一个网段:192.168.1.000 00000 ——192.168.1.0 27
可用范围(主机位不能全0 或全1):192.168.1.1—192.168.1.30
将第一个网段分配给骨干线路,因此需要继续将此网段划分为6个子网段
又因为骨干线路之间只有连接彼此设备的作用,相当于一个网段只需要有2个可用IP地址即可,
因此需要让192.168.1.0 的子网掩码为30,即
骨干线路1:192.168.1.000 000 00——192.168.1.0 30
可用IP地址:①192.168.1.1 30 ②192.168.1.2 30
骨干线路2:192.168.1.000 001 00——192.168.1.4 30
可用IP地址:①192.168.1.5 30 ②192.168.1.6 30
骨干线路3:192.168.1.000 010 00——192.168.1.8 30
可用IP地址:①192.168.1.9 30 ②192.168.1.10 30
骨干线路4:192.168.1.000 011 00——192.168.1.12 30
可用IP地址:①192.168.1.13 30②192.168.1.14 30
骨干线路5:192.168.1.000 100 00——192.168.1.16 30
可用IP地址:①192.168.1.17 30②192.168.1.18 30
骨干线路6:192.168.1.000 101 00——192.168.1.20 30
可用IP地址:①192.168.1.21 30②192.168.1.22 30
第二个网段:192.168.1.001 00000 ——192.168.1.32 27
可用范围(主机位不能全0 或全1):192.168.1.33—192.168.1.62
将该网段分配给R1使用,因为R1还有两个环回地址,所以以该网段为基础继续划分子网
子网1:192.168.1.001 0 0000——192.168.1.32 28
子网2:192.168.1.001 1 0000——192.168.1.48 28
第三个网段:192.168.1.010 00000 ——192.168.1.64 27
可用范围(主机位不能全0 或全1):192.168.1.65—192.168.1.94
将该网段分配给R2使用,因为R2还有两个环回地址,所以以该网段为基础继续划分子网
子网1::192.168.1.010 0 0000——192.168.1.64 28
子网2::192.168.1.010 1 0000——192.168.1.80 28
第四个网段:192.168.1.011 00000 ——192.168.1.96 27
可用范围(主机位不能全0 或全1):192.168.1.97—192.168.1.126
将该网段分配给直接R3使用
第五个网段:192.168.1.100 00000——192.168.1.128 27
可用范围(主机位不能全0 或全1):192.168.1.129—192.168.1.158
将该网段分配给R4使用,因为R4还有两个环回地址,所以以该网段为基础继续划分子网
子网1:192.168.1.100 0 0000——192.168.1.128 28
子网2:192.168.1.100 1 0000——192.168.1.144 28
剩下的网段作为预留网段,暂不使用
第六个网段:192.168.1.101 00000——192.168.1.160 27
可用范围(主机位不能全0 或全1):192.168.1.161 —192.168.1.190
第七个网段:192.168.1.110 00000——192.168.1.192 27
可用范围(主机位不能全0 或全1):192.168.1.193—192.168.1.222
第八个网段:192.168.1.111 00000——192.168.1.224 27
可用范围(主机位不能全0 或全1):192.168.1.225—192.168.1.254
2.2根据划分好的IP地址对设备进行配置
给R1配置环回地址:
[R1]interface LoopBack 0
[R1-LoopBack0]ip address 192.168.1.33 28
[R1-LoopBack0]q
[R1]interface LoopBack 1
[R1-LoopBack1]ip address 192.168.1.49 28
给R1配置接口的IP地址:
[R1]interface GigabitEthernet 0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.1.1 30
Jun 15 2024 19:22:57-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R1-GigabitEthernet0/0/0]int g 0/0/1
[R1-GigabitEthernet0/0/1]ip address 192.168.1.5 30
Jun 15 2024 19:23:21-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
R2,R3,R4,R5相关的环回地址和接口的IP地址的配置操作相同,不在展示。
3.静态路由配置
3.1给R1配置静态路由
[R1]ip route-static 192.168.1.64 27 192.168.1.2
[R1]ip route-static 192.168.1.96 27 192.168.1.10
[R1]ip route-static 192.168.1.4 30 192.168.1.2
[R1]ip route-static 192.168.1.12 30 192.168.1.10
[R1]ip route-static 192.168.1.128 27 192.168.1.2
[R1]ip route-static 192.168.1.128 27 192.168.1.10
[R1]ip route-static 192.168.1.16 30 192.168.1.2
[R1]ip route-static 192.168.1.16 30 192.168.1.10
[R1]ip route-static 192.168.1.20 30 192.168.1.2
[R1]ip route-static 192.168.1.20 30 192.168.1.10//配置指向R5的缺省路由
[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.10
3.2给R2配置静态路由
[R2]ip route-static 192.168.1.8 30 192.168.1.1
[R2]ip route-static192.168.1.12 30 192.168.1.6
[R2]ip route-static 192.168.1.12 30 192.168.1.6
[R2]ip route-static 192.168.1.128 27 192.168.1.6
[R2]ip route-static 192.168.1.96 27 192.168.1.6
[R2]ip route-static 192.168.1.96 27 192.168.1.1
[R2]ip route-static 192.168.1.16 30 192.168.1.6
[R2]ip route-static 192.168.1.20 30 192.168.1.6[R2]ip route-static 192.168.1.32 27 192.168.1.1
//配置指向R5的缺省路由
[R2]ip route-static 0.0.0.0 0 192.168.1.6
3.3给R3配置静态路由
[R3]ip route-static 192.168.1.32 27 192.168.1.9
[R3]ip route-static 192.168.1.0 30 192.168.1.9
[R3]ip route-static 192.168.1.64 27 192.168.1.9
[R3]ip route-static 192.168.1.64 27 192.168.1.14
[R3]ip route-static 192.168.1.4 30 192.168.1.14
[R3]ip route-static 192.168.1.128 27 192.168.1.14
[R3]ip route-static 192.168.1.16 30 192.168.1.14
[R3]ip route-static 192.168.1.20 30 192.168.1.14//配置指向R5的缺省路由
[R3]ip route-static 0.0.0.0 0 192.168.1.14
3.4给R4配置静态路由
[R4]ip route-static 192.168.1.64 27 192.168.1.5
[R4]ip route-static 192.168.1.0 30 192.168.1.5
[R4]ip route-static 192.168.1.96 27 192.168.1.13
[R4]ip route-static 192.168.1.8 30 192.168.1.13
[R4]ip route-static 192.168.1.32 27 192.168.1.13
[R4]ip route-static 192.168.1.32 27 192.168.1.5//配置指向R5的缺省路由
[R4]ip route-static 0.0.0.0 0 192.168.1.18
3.5给R5配置静态路由
[R5]ip route-static 192.168.1.128 27 192.168.1.17
[R5]ip route-static 192.168.1.4 30 192.168.1.17
[R5]ip route-static 192.168.1.12 30 192.168.1.17
[R5]ip route-static 192.168.1.64 27 192.168.1.17
[R5]ip route-static 192.168.1.96 27 192.168.1.17
[R5]ip route-static 192.168.1.0 30 192.168.1.17
[R5]ip route-static 192.168.1.8 30 192.168.1.17
[R5]ip route-static 192.168.1.32 27 192.168.1.17
4.浮动静态路由配置
4.1对R4的缺省路由进行浮动静态路由配置
[R4]ip route-static 0.0.0.0 0 192.168.1.22 preference 61
4.2对R5进行浮动静态路由配置
[R5]ip route-static 192.168.1.128 27 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.4 30 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.12 30 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.64 27 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.96 27 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.0 30 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.8 30 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.32 27 192.168.1.21 preference 61
5.对R3进行DHCP配置,使其可以对PC端自动下发IP地址
[R3]ip pool 123
Info: It's successful to create an IP address pool.
[R3-ip-pool-123]network 192.168.1.96 mask 27
[R3-ip-pool-123]gateway-list 192.168.1.97
[R3-ip-pool-123]dns-list 8.8.8.8
[R3-ip-pool-123]q
[R3]int g 0/0/2
[R3-GigabitEthernet0/0/2]dhcp select global