实验配置要求:
- 全网所有网段全部基于192.168.1.0/24划分所得
- R1-R4每台设备均有两个环回地址
- 全网可达
- 尽量减少路由条目,且防止环路
- R5的环回5.5.5.5/24不能出现在其他设备的路由表中
- 按照图中所示,做浮动静态路由
子网划分:
由要求可知R1-R4个需要两个环回地址,总计8个
路由器之间需要6个地址,所以总共需要14段地址
192.168.1.0/24 借4位—划分16个网段(可用地址数量是14个)
每一条链路只用2个地址,划分的每个网段中有14个,但只用两个地址,这样会造成IP地址浪费所以,要使所划分的网段的可用地址刚好为两个,则需要借6位,子网掩码为30
骨干链路—路由器和路由器之间需要两个地址
子网划分到30位的时候,只有两个可用地址
子网划分的极限-----/30,主机位只剩2 可用地址数量2^2-2=2
汇总:
每台路由器上有两个环回地址,相当于两端地址,为减少路由表条目数量可将其看成这两段地址汇总后的一段地址
划分思路:
将骨干链路看成1段地址,划分6段
R1的环回看成一段地址,划分两端,R2,R3, R4同理
192.168.1.0/24—借三位
192.168.1.0/27----骨干链路,在划分6段地址,借3位
192.168.1.0/30–R1与R2间的骨干链路
192.168.1.4/30–R2与R3间的骨干链路
192.168.1.8/30–R3与R5之间的千兆骨干链路
192.168.1.12/30–R3与R5之间的百兆骨干链路
192.168.1.16/30–R3与R4之间的骨干链路
192.168.1.20/30–R4与R1之间的骨干链路
192.168.1.24/30—保留
192.168.1.28/30—保留
192.168.1.32/27----R1环回
192.168.1.32/28
192.168.1.48/28
192.168.1.64/27----R2环回
192.168.1.64/28
192.168.1.80/28
192.168.1.96/27----R3环回
192.168.1.96/28
192.168.1.112/28
192.168.1.128/27----R4环回
192.168.1.128/28
192.168.1.144/28
192.168.1.160/27
192.168.1.192/27 可不用
192.168.1.224/27
将划分好的地址标注在拓扑图上,如下所示:
开始配置
R1:
IP配置:
sy
[Huawei]sy R1
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.1.1 30
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.1.22 30
[R1-GigabitEthernet0/0/1]
[R1]interface LoopBack 0
[R1-LoopBack0]ip add 192.168.1.33 28
[R1-LoopBack0]int l1
[R1-LoopBack1]ip add 192.168.1.49 28
[R1-LoopBack1]
写路由:
骨干路由:
[R1]ip route-static 192.168.1.4 30 192.168.1.2
[R1]ip route-static 192.168.1.16 30 192.168.1.21
[R1]ip route-static 192.168.1.8 30 192.168.1.2
[R1]ip route-static 192.168.1.8 30 192.168.1.21
[R1]ip route-static 192.168.1.12 30 192.168.1.21
[R1]ip route-static 192.168.1.12 30 192.168.1.2
环回路由:
[R1]ip route-static 192.168.1.64 27 192.168.1.2
[R1]ip route-static 192.168.1.128 27 192.168.1.21
[R1]ip route-static 192.168.1.96 27 192.168.1.21
[R1]ip route-static 192.168.1.96 27 192.168.1.2
配置缺省路由:
[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.21
防环,配置空接口:
[R1]ip route-static 192.168.1.32 27 NULL 0
R2:
IP配置:
sy
[Huawei]sy R2
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.1.2 30
[R2-GigabitEthernet0/0/0]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 192.168.1.5 30
[R2]int l0
[R2-LoopBack0]ip add 192.168.1.65 28
[R2-LoopBack0]int l1
[R2-LoopBack1]ip add 192.168.1.81 28
写路由:
骨干路由:
[R2]ip route-static 192.168.1.20 30 192.168.1.1
[R2]ip route-static 192.168.1.16 30 192.168.1.6
[R2]ip route-static 192.168.1.8 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.32 27 192.168.1.1
[R2]ip route-static 192.168.1.96 27 192.168.1.6
[R2]ip route-static 192.168.1.128 27 192.168.1.1
[R2]ip route-static 192.168.1.128 27 192.168.1.6
配置缺省路由:
[R2]ip route-static 0.0.0.0 0 192.168.1.6
防环,配置空接口:
[R2]ip route-static 192.168.1.64 27 NULL 0
R3:
IP配置:
sy
[Huawei]sy R3
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip add 192.168.1.6 30
[R3-GigabitEthernet0/0/0]int g0/0/1
[R3-GigabitEthernet0/0/1]ip add 192.168.1.9 30
[R3-GigabitEthernet0/0/1]int g0/0/2
[R3-GigabitEthernet0/0/2]ip add 192.168.1.17 30
[R3-GigabitEthernet0/0/2]int g4/0/0
[R3-GigabitEthernet4/0/0]ip add 192.168.1.14 30
sy
[R3]int l0
[R3-LoopBack0]ip add 192.168.1.97 28
[R3-LoopBack0]int l1
[R3-LoopBack1]ip add 192.168.1.113 28
[R3-LoopBack1]
写路由:
骨干路由:
[R3]ip route-static 192.168.1.0 30 192.168.1.5
[R3]ip route-static 192.168.1.20 30 192.168.1.18
环回路由:
[R3]ip route-static 192.168.1.32 27 192.168.1.5
[R3]ip route-static 192.168.1.32 27 192.168.1.18
[R3]ip route-static 192.168.1.64 27 192.168.1.5
[R3]ip route-static 192.168.1.128 27 192.168.1.18
配置缺省路由:
[R3]ip route-static 0.0.0.0 0 192.168.1.10
[R3]ip route-static 0.0.0.0 0 192.168.1.13
防环,配置空接口:
[R3]ip route-static 192.168.1.96 27 NULL 0
R4:
IP配置:
sy
[Huawei]sy R4
[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip add 192.168.1.21 30
[R4-GigabitEthernet0/0/0]int g0/0/1
[R4-GigabitEthernet0/0/1]ip add 192.168.1.18 30
sy
[R4]int l0
[R4-LoopBack0]ip add 192.168.1.129 28
[R4-LoopBack0]int l1
[R4-LoopBack1]ip add 192.168.1.145 28
[R4-LoopBack1]
写路由:
骨干链路:
[R4]ip route-static 192.168.1.0 30 192.168.1.22
[R4]ip route-static 192.168.1.4 30 192.168.1.17
[R4]ip route-static 192.168.1.8 30 192.168.1.17
[R4]ip route-static 192.168.1.12 30 192.168.1.17
环回路由:
[R4]ip route-static 192.168.1.32 27 192.168.1.22
[R4]ip route-static 192.168.1.96 27 192.168.1.17
[R4]ip route-static 192.168.1.64 27 192.168.1.22
[R4]ip route-static 192.168.1.64 27 192.168.1.17
配置缺省路由:
[R4]ip route-static 0.0.0.0 0 192.168.1.17
防环,配置空接口:
[R4]ip route-static 192.168.1.128 27 NULL 0
R5:
IP配置:
sy
[Huawei]sy R5
[R5]int g0/0/0
[R5-GigabitEthernet0/0/0]ip add 192.168.1.10 30
[R5-GigabitEthernet0/0/0]int g0/0/1
[R5-GigabitEthernet0/0/1]ip add 192.168.1.13 30
[R5]int l0
[R5-LoopBack0]ip add 5.5.5.5 24
写路由:
骨干路由:
[R5]ip route-static 192.168.1.4 30 192.168.1.9
[R5]ip route-static 192.168.1.0 30 192.168.1.9
[R5]ip route-static 192.168.1.16 30 192.168.1.9
[R5]ip route-static 192.168.1.20 30 192.168.1.9
[R5]ip route-static 192.168.1.4 30 192.168.1.14
[R5]ip route-static 192.168.1.0 30 192.168.1.14
[R5]ip route-static 192.168.1.16 30 192.168.1.14
[R5]ip route-static 192.168.1.20 30 192.168.1.14
环回路由:
[R5]ip route-static 192.168.1.96 27 192.168.1.9
[R5]ip route-static 192.168.1.64 27 192.168.1.9
[R5]ip route-static 192.168.1.32 27 192.168.1.9
[R5]ip route-static 192.168.1.128 27 192.168.1.9
[R5]ip route-static 192.168.1.96 27 192.168.1.14
[R5]ip route-static 192.168.1.64 27 192.168.1.14
[R5]ip route-static 192.168.1.32 27 192.168.1.14
[R5]ip route-static 192.168.1.128 27 192.168.1.14
浮动静态路由:
做备份
[R3]ip route-static 0.0.0.0 0 192.168.1.13 preference 80
将指向1.13的优先级改为80,当上方G0/0/1口关闭时,走下方链路