1、基于192.168.1.0 /24 子网划分
思路:R1-R4需要四个网段---每个网段在划分2个网段
骨干链路1个网段 再从一个网段中划分6个网段
- 192.168.1.0 /24先划分5个网段
骨干链路:192.168.1.0. 27 在划分6个,借三位 27+3 = 30
192.168.1.0 30
192.168.1.4 30
129.168.1.8 30
192.168.1.12 30
192.168.1.16 30
192.168.1.20 30
R1环回192.168.1.32 27
192.168.1.32 28 192.168.1.48 28
R2环回192.168.1.64 27
192.168.1.64 28 192.168.1.80 28
R3环回192.168.1.96 27
192.168.1.96 28 192.168.1.112 28
R4环回192.168.1.128 27
192.168.1.128 28 192.168.1.144 28
子网划分 子网划分极限 30,当划分到30时每个网段只有2个可用的ip地址
2、配置ip
R1
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysn
[Huawei]sysname R1
[R1]interface g0/0/0
[R1-GigabitEthernet0/0/0]ip ad
[R1-GigabitEthernet0/0/0]ip address 192.168.1.1 30
Oct 13 2023 20:35:12-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]q
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip address 192.168.1.5 30
Oct 13 2023 21:19:15-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R1-GigabitEthernet0/0/1]q
[R1]int LoopBack 0
[R1-LoopBack0]ip ad
[R1-LoopBack0]ip address 192.168.1.33 28
[R1-LoopBack0]q
[R1]int LoopBack 1
[R1-LoopBack1]ip address 192.168.1.49 28
[R1-LoopBack1]q
R2
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R2
[R2]int GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]ip address 192.168.1.2 30
Oct 13 2023 20:37:27-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]q
[R2]int g0/0/1
[R2-GigabitEthernet0/0/1]ip address 192.168.1.9 30
Oct 13 2023 20:37:47-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 LoopBack 0
[R2-LoopBack0]ip address 192.168.1.65 28
[R2-LoopBack0]q
[R2]int LoopBack 1
[R2-LoopBack1]ip address 192.168.1.80 28
Error: The specified IP address is invalid.
[R2-LoopBack1]ip address 192.168.1.81 28
[R2-LoopBack1]q
R3
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R3
Enter system view, return user view with Ctrl+Z.
[R3]int g0/0/0
[R3-GigabitEthernet0/0/0]ip address 192.168.1.6 30
Oct 13 2023 20:41:06-08:00 R3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R3-GigabitEthernet0/0/0]q
[R3]int g0/0/1
[R3-GigabitEthernet0/0/1]ip address 192.168.1.13 30
Oct 13 2023 20:45:11-08:00 R3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R3-GigabitEthernet0/0/1]q[R3-GigabitEthernet0/0/0]int g0/0/2
[R3-GigabitEthernet0/0/2]ip address 192.168.1.97 27
Oct 13 2023 22:11:32-08:00 R3 %%01IFNET/4/LINK_STATE(l)[5]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.[R3-GigabitEthernet0/0/2]q
[R3]int LoopBack 0
[R3-LoopBack0]ip address 192.168.1.97 28
[R3-LoopBack0]q
[R3]int LoopBack 1
[R3-LoopBack1]ip address 192.168.1.113 28
[R3-LoopBack1]q
R4
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R4[R4]int g0/0/0
[R4-GigabitEthernet0/0/0]ip address 192.168.1.10 30
Oct 13 2023 20:42:54-08:00 R4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R4-GigabitEthernet0/0/0]q[R4]int g0/0/1
[R4-GigabitEthernet0/0/1]ip address 192.168.1.14 30
Oct 13 2023 20:45:22-08:00 R4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R4-GigabitEthernet0/0/1]q[R4]int g0/0/2
[R4-GigabitEthernet0/0/2]ip address 192.168.1.17 30
Oct 13 2023 20:54:44-08:00 R4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[R4-GigabitEthernet0/0/2]q
[R4]int g4/0/0
[R4-GigabitEthernet4/0/0]ip address 192.168.1.21 30
Oct 13 2023 20:55:00-08:00 R4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet4/0/0 has entered the UP state.
[R4]int LoopBack 0
[R4-LoopBack0]ip address 192.168.1.129 28
[R4-LoopBack0]q
[R4]int LoopBack 1
[R4-LoopBack1]ip address 192.168.1.145 28
[R4-LoopBack1]q
R5
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R5[R5]int g0/0/0
[R5-GigabitEthernet0/0/0]ip address 192.168.1.28 30
Oct 13 2023 20:56:43-08:00 R5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R5-GigabitEthernet0/0/0]q
[R5]int g0/0/1
[R5-GigabitEthernet0/0/1]ip ad
[R5-GigabitEthernet0/0/1]ip address 192.168.1.22 30
Oct 13 2023 20:57:29-08:00 R5 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R5-GigabitEthernet0/0/1]q[R5]int g0/0/2
[R5-GigabitEthernet0/0/2]ip address 12.0.0.1 24
Oct 13 2023 21:00:34-08:00 R5 %%01IFNET/4/LINK_STATE(l)[4]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[R5]int lo
[R5]int LoopBack 0
[R5-LoopBack0]ip address 192.168.1.161 27
[R5-LoopBack0]q
R6
3.开启DHCP服务
<R3>sys
Enter system view, return user view with Ctrl+Z.
[R3]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[R3]ip pool a
Info: It's successful to create an IP address pool.
[R3-ip-pool-a]network 192.168.1.96 mask 27
[R3-ip-pool-a]gateway-list 192.168.1.97
[R3-ip-pool-a]dns-list 114.114.114.114 8.8.8.8
[R3-ip-pool-a]int g0/0/0
[R3-GigabitEthernet0/0/0]dhcp select global
[R3-GigabitEthernet0/0/0]q
结果
为简化实验,先关闭百兆接口
4、手写路由,写缺省路由,注意负载均衡
5.NAT(一对多)
[R5]acl 2000
[R5-acl-basic-2000]rule permit source 192.168.1.0 0.0.0.255
[R5]int g0/0/0
[R5-GigabitEthernet0/0/0]nat outbound 200
6、避免环路,需要在R1、R2、R4配置空接口
7、R4与R5正常通过1000M链R路,故障时通过100M链路
开启百兆接口,将百兆接口的优先级修改为61