路由如下图
要求:
1.除R5环回地址固定以外,其他所有网段基于192.168.1.0/24进行合理的IP地址划分。
2.R1-R4路由器上均存在两个环回,用来模拟用户网段,地址使用192.168.1.0/24划分。
3.R1-R4上不能直接写去往5.5.5.5/24网段路由,但仍可访问。
4.全网可达,尽量减少每台路由器路由表路由条目。
5.R4-R5之间,正常走1000M链路,故障走100M链路。
第一步:
子网划分:从192.168.1.0 24划分5个子网用于路由器环回及骨干链路,其中一子网个再划分6个子网与骨干链路,具体如上图所示
第二步:
给路由器配置接口IP和环回
r1:
The device is running!
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r1
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.1.1 30
[r1-GigabitEthernet0/0/0]
Jul 8 2023 17:23:25-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 add 192.168.1.9 30
Jul 8 2023 17:23:57-08:00 r1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r1-GigabitEthernet0/0/1]q
[r1]int
[r1]interface lo
[r1]interface LoopBack 0
[r1-LoopBack0]ip add 192.168.1.33 28
[r1-LoopBack0]interface LoopBack 1
[r1-LoopBack1]ip add 192.168.1.49 28
[r1-LoopBack1]
r2:
The device is running!
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys r2
[r2]int g0/0/0
[r2-GigabitEthernet0/0/0]ip add 192.168.1.2 30
[r2-GigabitEthernet0/0/0]
Jul 8 2023 17:25:46-08:00 r2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r2-GigabitEthernet0/0/0]int g0/0/1
[r2-GigabitEthernet0/0/1]ip add 192.168.1.5 30
[r2-GigabitEthernet0/0/1]
Jul 8 2023 17:26:00-08:00 r2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r2-GigabitEthernet0/0/1]q
[r2]int lo
[r2]int LoopBack 0
[r2-LoopBack0]ip add 192.168.1.65 28
[r2-LoopBack0]int LoopBack 1
[r2-LoopBack1]ip add 192.168.1.81 28
[r2-LoopBack1]
r3、r4、r5由此推断
r3:
r4
r5
第三步:
路由配置,注意要考虑负载均衡
r1:
<r1>sys
Enter system view, return user view with Ctrl+Z.
[r1]ip rou
[r1]ip route
[r1]ip route-static 192.168.1.64 27 192.168.1.2
[r1]ip route-static 192.168.1.4 30 192.168.1.2
[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.12 30 192.168.1.10
[r1]ip route-static 192.168.1.96 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.10
[r1]ip route-static 192.168.1.20 30 192.168.1.2
[r1]
r2
<r2>sys
Enter system view, return user view with Ctrl+Z.
[r2]ip rou
[r2]ip route
[r2]ip route-static 192.168.1.128 27 192.168.1.6
[r2]ip route-static 192.168.1.16 30 192.168.1.6
[r2]ip route-static 192.168.1.22 30 192.168.1.6
Info: The destination address and mask of the configured static route mismatched
, and the static route 192.168.1.20/30 was generated.
[r2]ip route-static 192.168.1.20 30 192.168.1.6
Error: The route already exists.
[r2]ip route-static 192.168.1.12 30 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.8 30 192.168.1.1
[r2]ip route-static 192.168.1.32 27 192.168.1.1
[r2]
r3
<r3>sys
Enter system view, return user view with Ctrl+Z.
[r3]ip rou
[r3]ip route
[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
[r3]
r4
<r4>sys
Enter system view, return user view with Ctrl+Z.
[r4]ip rou
[r4]ip route
[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.32 27 192.168.1.5
[r4]ip route-static 192.168.1.32 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.96 27 192.168.1.13
[r4]
r5
<r5>sys
Enter system view, return user view with Ctrl+Z.
[r5]ip rou
[r5]ip route
[r5]ip route-static 192.168.1.128 27 192.168.1.17
[r5]ip route-static 192.168.1.64 27 192.168.1.17
[r5]ip route-static 192.168.1.32 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.4 30 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.12 30 192.168.1.17
[r5]
第四步:
因为要访问5.5.5.5 24 所有要给r1、r2、r3、r4、r5配置缺省路由,也得考虑负载均衡,同时因为缺省和路由相遇会成环,所以得汇总网段指向空接口
r1
<r1>sys
Enter system view, return user view with Ctrl+Z.
[r1]ip rou
[r1]ip route
[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
[r1]ip rou
[r1]ip route
[r1]ip route-static 192.168.1.32 27 N
[r1]ip route-static 192.168.1.32 27 NULL 0
[r1]
r2
<r2>sys
Enter system view, return user view with Ctrl+Z.
[r2]ip rou
[r2]ip route
[r2]ip route-static 0.0.0.0 0 192.168.1.6
[r2]ip route-static 192.168.1.64 27 NULL 0
[r2]
r3
<r3>sys
Enter system view, return user view with Ctrl+Z.
[r3]ip rou
[r3]ip route
[r3]ip route-static 0.0.0.0 0 192.168.1.14
[r3]ip route-static 192.168.1.96 27 NULL 0
[r3]
r4
<r4>sys
Enter system view, return user view with Ctrl+Z.
[r4]ip rou
[r4]ip route
[r4]ip route-static 0.0.0.0 0 192.168.1.17
[r4]ip route-static 192.168.1.128 27 NULL 0
[r4]
第五步:
因为R4-R5之间,正常走1000M链路,故障走100M链路,所以192.168.1.20网段用浮动路由
r4
[r4]
[r4]ip route-static 0.0.0.0 0 192.168.1.22 pre
[r4]ip route-static 0.0.0.0 0 192.168.1.22 preference 70
[r4]
r5
[r5]
[r5]ip route-static 192.168.1.128 27 192.168.1.21 pre
[r5]ip route-static 192.168.1.128 27 192.168.1.21 preference 70
[r5]ip route-static 192.168.1.64 27 192.168.1.21 preference 70
[r5]ip route-static 192.168.1.32 27 192.168.1.21 preference 70
[r5]ip route-static 192.168.1.96 27 192.168.1.21 preference 70
[r5]ip route-static 192.168.1.4 30 192.168.1.21 preference 70
[r5]ip route-static 192.168.1.0 30 192.168.1.21 preference 70
[r5]ip route-static 192.168.1.8 30 192.168.1.21 preference 70
[r5]ip route-static 192.168.1.12 30 192.168.1.21 preference 70
[r5]
最后测试:
r1
<r1>ping 5.5.5.5
PING 5.5.5.5: 56 data bytes, press CTRL_C to break
Reply from 5.5.5.5: bytes=56 Sequence=1 ttl=253 time=80 ms
Reply from 5.5.5.5: bytes=56 Sequence=2 ttl=253 time=100 ms
Reply from 5.5.5.5: bytes=56 Sequence=3 ttl=253 time=50 ms
Reply from 5.5.5.5: bytes=56 Sequence=4 ttl=253 time=100 ms
Reply from 5.5.5.5: bytes=56 Sequence=5 ttl=253 time=50 ms
--- 5.5.5.5 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 50/76/100 ms
<r1>ping 192.168.1.129
PING 192.168.1.129: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.129: bytes=56 Sequence=1 ttl=254 time=30 ms
Reply from 192.168.1.129: bytes=56 Sequence=2 ttl=254 time=30 ms
Reply from 192.168.1.129: bytes=56 Sequence=3 ttl=254 time=30 ms
Reply from 192.168.1.129: bytes=56 Sequence=4 ttl=254 time=40 ms
Reply from 192.168.1.129: bytes=56 Sequence=5 ttl=254 time=40 ms
--- 192.168.1.129 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/34/40 ms
r2
<r3>ping 5.5.5.5
PING 5.5.5.5: 56 data bytes, press CTRL_C to break
Reply from 5.5.5.5: bytes=56 Sequence=1 ttl=254 time=50 ms
Reply from 5.5.5.5: bytes=56 Sequence=2 ttl=254 time=40 ms
Reply from 5.5.5.5: bytes=56 Sequence=3 ttl=254 time=30 ms
Reply from 5.5.5.5: bytes=56 Sequence=4 ttl=254 time=30 ms
Reply from 5.5.5.5: bytes=56 Sequence=5 ttl=254 time=30 ms
--- 5.5.5.5 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 30/36/50 ms
<r3>ping 192.168.1.65
PING 192.168.1.65: 56 data bytes, press CTRL_C to break
Reply from 192.168.1.65: bytes=56 Sequence=1 ttl=254 time=40 ms
Reply from 192.168.1.65: bytes=56 Sequence=2 ttl=254 time=40 ms
Reply from 192.168.1.65: bytes=56 Sequence=3 ttl=254 time=40 ms
Reply from 192.168.1.65: bytes=56 Sequence=4 ttl=254 time=50 ms
Reply from 192.168.1.65: bytes=56 Sequence=5 ttl=254 time=60 ms
--- 192.168.1.65 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 40/46/60 ms
其他路由器也一样可以ping通所有IP地址,就不一一列举了,成功实现全网可达!