出共有6个网段。而每个网段都需要两个ip地址,因此可以用30位的掩码。
192.168.1.0/24
192.168.1.00000000 192.168.1.000 000 00 27
1、192.168.1.000 000 00 192.168.1.0/30
2、192.168.1.000 001 00 192.168.1.4/30
3、192.168.1.000 010 00 192.168.1.8/30
4、192.168.1.000 011 00 192.168.1.12/30
5、192.168.1.000 100 00 192.168.1.16/30
6、192.168.1.000 101 00 192.168.1.20/30
7、192.168.1.000 110 00 192.168.1.24/30
8、192.168.1.000 111 00 192.168.1.28/30
根据要求2,AR1-AR4每个路由器需两个环回接口。
AR1:192.168.1.001 0 0000 192.168.1.32/27 ----汇总后的子网
192.168.1.001 0 0000 192.168.1.32/28
192.168.1.001 1 0000 192.168.1.48/28
AR2:192.168.1.010 0 0000 192.168.1.64/27 ----汇总后的子网
192.168.1.010 0 0000 192.168.1.64/28
192.168.1.010 1 0000 192.168.1.80/28
AR3:192.168.1.011 0 0000 192.168.1.96/27 ----汇总后的子网
192.168.1.011 0 0000 192.168.1.96/28
192.168.1.011 1 0000 192.168.1.112/28
AR4:192.168.1.100 0 0000 192.168.1.128/27 ----汇总后的子网
192.168.1.100 0 0000 192.168.1.128/28
192.168.1.100 1 0000 192.168.1.144/28
AR1:
[Huawei-GigabitEthernet0/0/0]ip add 192.168.1.1 30
Sep 20 2024 21:42:39-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[0]:The line protocol
IP on the interface GigabitEthernet0/0/0 has entered the UP state.
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 192.168.1.5 30
Sep 20 2024 21:43:00-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[1]:The line protocol
IP on the interface GigabitEthernet0/0/1 has entered the UP state.
[Huawei-GigabitEthernet0/0/1]int lo 0
[Huawei-LoopBack0]ip add 192.168.1.33 28
[Huawei-LoopBack0]int lo 1
[Huawei-LoopBack1]ip add 192.168.1.49 28
AR2:<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip ad 192.168.1.2 30
Sep 20 2024 21:45:14-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[0]:The line protocol
IP on the interface GigabitEthernet0/0/0 has entered the UP state.
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip ad 192.168.1.9 30
Sep 20 2024 21:45:31-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[1]:The line protocol
IP on the interface GigabitEthernet0/0/1 has entered the UP state.
[Huawei-GigabitEthernet0/0/1]int lo 0
[Huawei-LoopBack0]ip ad 192.168.1.65 28
[Huawei-LoopBack0]int lo1
[Huawei-LoopBack1]ip ad 192.168.1.81 28
AR3:<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip ad 192.168.1.6 30
Sep 20 2024 21:46:43-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[0]:The line protocol
IP on the interface GigabitEthernet0/0/0 has entered the UP state.
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip ad 192.168.1.13 30
Sep 20 2024 21:46:54-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[1]:The line protocol
IP on the interface GigabitEthernet0/0/1 has entered the UP state.
[Huawei-GigabitEthernet0/0/1]int lo0
[Huawei-LoopBack0]ip ad 192.168.1.97 28
[Huawei-LoopBack0]int lo1
[Huawei-LoopBack1]ip ad 192.168.1.113 28
AR4:<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip ad 192.168.1.10 30
[Huawei-GigabitEthernet0/0/0]
Sep 20 2024 22:18:33-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[7]:The line protocol
IP on the interface GigabitEthernet0/0/0 has entered the UP state.
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip ad 192.168.1.14 30
Sep 20 2024 22:18:47-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[8]:The line protocol
IP on the interface GigabitEthernet0/0/1 has entered the UP state.
[Huawei-GigabitEthernet0/0/1]int g4/0/0
[Huawei-GigabitEthernet4/0/0]ip ad 192.168.1.17 30
[Huawei-GigabitEthernet4/0/0]
Sep 20 2024 22:18:58-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[9]:The line protocol
IP on the interface GigabitEthernet4/0/0 has entered the UP state.
[Huawei-GigabitEthernet4/0/0]int g0/0/2
[Huawei-GigabitEthernet0/0/2]ip ad 192.168.1.21 30
Sep 20 2024 22:19:08-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[10]:The line protoco
l IP on the interface GigabitEthernet0/0/2 has entered the UP state.
[Huawei-GigabitEthernet0/0/2]int lo0
[Huawei-LoopBack0]ip ad 192.168.1.129 28
[Huawei-LoopBack0]int lo1
[Huawei-LoopBack1]ip ad 192.168.1.145 28
AR5:<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 192.168.1.18 30
Sep 20 2024 21:54:46-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[0]:The line protocol
IP on the interface GigabitEthernet0/0/1 has entered the UP state.
[Huawei-GigabitEthernet0/0/1]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 192.168.1.22 30
Sep 20 2024 21:54:57-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[1]:The line protocol
IP on the interface GigabitEthernet0/0/0 has entered the UP state.
[Huawei-GigabitEthernet0/0/0]int lo0
[Huawei-LoopBack0]ip ad 5.5.5.5 24
要实现全网可达,现在对每个路由进行路由配置
AR1:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]ip route-static 192.168.1.64 27 192.168.1.2
Error: The route already exists.
[Huawei]ip route-static 192.168.1.96 27 192.168.1.6
[Huawei]ip route-static 192.168.1.8 30 192.168.1.2
[Huawei]ip route-static 192.168.1.12 30 192.168.1.6
[Huawei]ip route-static 192.168.1.128 27 192.168.1.2
[Huawei]ip route-static 192.168.1.128 27 192.168.1.6
[Huawei]ip route-static 192.168.1.16 30 192.168.1.2
[Huawei]ip route-static 192.168.1.16 30 192.168.1.6
AR2:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]ip route-static 192.168.1.32 27 192.168.1.1
[Huawei]ip route-static 192.168.1.128 27 192.168.1.10
[Huawei]ip route-static 192.168.1.96 27 192.168.1.1
[Huawei]ip route-static 192.168.1.96 27 192.168.1.10
[Huawei]ip route-static 192.168.1.16 30 192.168.1.10
[Huawei]ip route-static 192.168.1.4 30 192.168.1.1
[Huawei]ip route-static 192.168.1.12 30 192.168.1.10
[Huawei]
AR3:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]ip route-static 192.168.1.32 27 192.168.1.5
[Huawei]ip route-static 192.168.1.0 30 192.168.1.5
[Huawei]ip route-static 192.168.1.128 27 192.168.1.14
[Huawei]ip route-static 192.168.1.8 30 192.168.1.14
[Huawei]ip route-static 192.168.1.16 30 192.168.1.14
[Huawei]ip route-static 192.168.1.64 27 192.168.1.5
[Huawei]ip route-static 192.168.1.64 27 192.168.1.14
AR4:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]ip route-static 192.168.1.96 27 192.168.1.13
[Huawei]ip route-static 192.168.1.4 30 192.168.1.13
[Huawei]ip route-static 192.168.1.64 27 192.168.1.9
[Huawei]ip route-static 192.168.1.0 30 192.168.1.9
[Huawei]ip route-static 192.168.1.32 27 192.168.1.9
[Huawei]ip route-static 192.168.1.32 27 192.168.1.13
AR5:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]ip route-static 192.168.1.128 27 192.168.1.17
[Huawei]ip route-static 192.168.1.8 30 192.168.1.17
[Huawei]ip route-static 192.168.1.12 30 192.168.1.17
[Huawei]ip route-static 192.168.1.64 27 192.168.1.17
[Huawei]ip route-static 192.168.1.0 30 192.168.1.17
[Huawei]ip route-static 192.168.1.32 27 192.168.1.17
[Huawei]ip route-static 192.168.1.96 27 192.168.1.17
[Huawei]ip route-static 192.168.1.4 30 192.168.1.17
AR1的缺省地址:
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]ip route-static 0.0.0.0 0.0.0.0 192.168.1.2
[Huawei]ip route-static 0.0.0.0 0.0.0.0 192.168.1.6
[Huawei]
AR2的缺省地址:
[Huawei]
[Huawei]ip route-static 0.0.0.0 0.0.0.0 192.168.1.10
AR3的缺省地址:
[Huawei]ip route-static 0.0.0.0 0.0.0.0 192.168.1.14
AR4的缺省地址:
[Huawei]ip route-static 0.0.0.0 0.0.0.0 192.168.1.18
避免环路出现,还应该在每个路由添加空接口
AR1:
[Huawei]ip route-static 192.168.1.32 27 NULL 0
AR2:
[Huawei]ip route-static 192.168.1.64 27 NULL 0
AR3:
[Huawei]ip route-static 192.168.1.96 27 NULL 0
AR4:
[Huawei]ip route-static 192.168.1.128 27 NULL 0
要使R4与R5间,正常1000M链路通信,故障时自动改为100M,就要用到浮动静态路由,根据优先级的数值越小,优先级越高,将100M链路的优先级调整为61即可。
AR5路由:
修改100M链路的优先级
接下来验证是否在故障时使用的是100M的链路,首先需将1000M链路断开
断开AR4:
断开AR5:
最后去AR4路由查看此时的路由表: