一,实验需求
1,除R5的环回地址固定以外,整个其他所有网段基于192.168.1.0/24进行合理的IP地址划分
2,R1-R4每个路由器存在两个环回接口,用于模拟连接PC网段,地址也在192.168.1.0/24这个网络范围内
3,R1-R4不能直接编写到达5.5.5.0/24的静态路由,但依然可以访问
4,全网可达,尽量减少每台路由器路由表条目数,避免环路出现
5,R4与R5之间,正常1000M通信,故障时自动改为100M
二,实验目的
掌握环回接口配置
掌握手工汇总配置
掌握缺省路由配置
掌握空接口路由配置
掌握浮动静态路由配置
掌握静态路由配置
三,实验步骤
1,新建拓扑,布置器件,连线开机
2,数广播域,划分网段
共有7个骨干链路和8个环回
192.168.1.0/24
192.168.1.0/27----骨干链路
192.168.1.0/30 R1-R2
192.168.1.4/30 R1-R3
192.168.1.8/30 R2-R4
192.168.1.12/30 R3-R4
192.168.1.16/30 R4-R5(1000M)
192.168.1.20/30 R4-R5(100M)
192.168.1.24/30
192.168.1.28/30
汇总192.168.1.24/29
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
3,每个接口配置IP地址并更改名字(记得保存配置)
R1配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R1
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip address 192.168.1.1 30
Sep 27 2023 21:20:11-08:00 R1 %%01IFNET/4/LINK_STATE(l)[2]: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.6 30
Sep 27 2023 21:20:26-08:00 R1 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R1-GigabitEthernet0/0/1]q
[R1]interface lo
[R1]interface LoopBack 0
[R1-LoopBack0]ip address 192.168.1.32 28
Error: The specified IP address is invalid.
[R1-LoopBack0]ip address 192.168.1.33 28
[R1-LoopBack0]interface LoopBack 1
[R1-LoopBack1]ip address 192.168.1.49 28
[R1-LoopBack1]q
[R1]q
<R1>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
It will take several minutes to save configuration file, please wait.......
Configuration file had been saved successfully
Note: The configuration file will take effect after being activated
R2配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R2
[R2]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip ad 192.168.1.2 30
Sep 27 2023 21:24:25-08:00 R2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R2-GigabitEthernet0/0/0]int g 0/0/1
[R2-GigabitEthernet0/0/1]ip ad 192.168.1.9 30
Sep 27 2023 21:24:36-08:00 R2 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R2-GigabitEthernet0/0/1]int lo 0
[R2-LoopBack0]ip ad 192.168.1.65 28
[R2-LoopBack0]int lo 1
[R2-LoopBack1]ip ad 192.168.1.81 28
[R2-LoopBack1]q
[R2]q
<R2>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
It will take several minutes to save configuration file, please wait.......
Configuration file had been saved successfully
Note: The configuration file will take effect after being activated
R3配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R3
[R3]int g 0/0/0
[R3-GigabitEthernet0/0/0]ip ad 192.168.1.6 30
Sep 27 2023 21:28:46-08:00 R3 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R3-GigabitEthernet0/0/0]int g 0/0/1
[R3-GigabitEthernet0/0/1]ip ad 192.168.1.13 30
Sep 27 2023 21:29:07-08:00 R3 %%01IFNET/4/LINK_STATE(l)[4]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R3-GigabitEthernet0/0/1]int lo 0
[R3-LoopBack0]ip ad 192.168.1.97 28
[R3-LoopBack0]int lo 1
[R3-LoopBack1]ip ad 192.168.1.113 28
[R3-LoopBack1]q
[R3]q
<R3>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
It will take several minutes to save configuration file, please wait.......
Configuration file had been saved successfully
Note: The configuration file will take effect after being activated
R4配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R4
[R4]int g 0/0/0
[R4-GigabitEthernet0/0/0]ip a
[R4-GigabitEthernet0/0/0]ip accounting
[R4-GigabitEthernet0/0/0]ip address 192.168.1.10 30
Sep 27 2023 21:31:41-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]int g 0/0/1
[R4-GigabitEthernet0/0/1]ip address 192.168.1.14 30
Sep 27 2023 21:31:49-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]int g 0/0/2
[R4-GigabitEthernet0/0/2]ip address 192.168.1.17 30
Sep 27 2023 21:32:13-08:00 R4 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[R4-GigabitEthernet0/0/2]int g 4/0/0
[R4-GigabitEthernet4/0/0]ip address 192.168.1.21 30
Sep 27 2023 21:32:29-08:00 R4 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface GigabitEthernet4/0/0 has entered the UP state.
[R4-GigabitEthernet4/0/0]int lo 0
[R4-LoopBack0]ip address 192.168.1.129 28
[R4-LoopBack0]int lo 1
[R4-LoopBack1]ip address 192.168.1.145 28
[R4-LoopBack1]q
[R4]q
<R4>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
It will take several minutes to save configuration file, please wait.......
Configuration file had been saved successfully
Note: The configuration file will take effect after being activated
R5配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys R5
[R5]int g 0/0/0
[R5-GigabitEthernet0/0/0]ip ad 192.168.1.18 30
Sep 28 2023 11:49:47-08:00 R5 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R5-GigabitEthernet0/0/0]int g 0/0/1
[R5-GigabitEthernet0/0/1]ip ad 192.168.1.22 30
Sep 28 2023 11:50:03-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]int lo 0
[R5-LoopBack0]ip ad 5.5.5.1 24
[R5-LoopBack0]q
[R5]q
<R5>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
It will take several minutes to save configuration file, please wait.......
Configuration file had been saved successfully
Note: The configuration file will take effect after being activated
编写静态路由,实现全网可达,为减少环路,进行手工汇总,为避免出现环路,配置空接口路由。R1-R4不能直接编写到达5.5.5.0/24的静态路由,但依然可以访问,配置缺省路由
R1配置
配置到R3静态路由时,发现IP地址出错,改动。
[R1-GigabitEthernet0/0/0]int g 0/0/1
[R1-GigabitEthernet0/0/1]undo ip address 192.168.1.6 30
Sep 28 2023 12:26:37-08:00 R1 %%01IFNET/4/LINK_STATE(l)[5]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the DOWN state.
[R1-GigabitEthernet0/0/1]ip address 192.168.1.5 30
[R1-GigabitEthernet0/0/1]
Sep 28 2023 12:26:44-08:00 R1 %%01IFNET/4/LINK_STATE(l)[6]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R1]ip route-static 192.168.1.96 27 192.168.1.6
[R1]ip route-static 192.168.1.64 27 192.168.1.2
[R1]ip route-static 192.168.1.8 30 192.168.1.2
[R1]ip route-static 192.168.1.12 30 192.168.1.6
[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.6
[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.6
[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.6
R2配置
[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.1
[R2]ip route-static 192.168.1.96 27 192.168.1.10
[R2]ip route-static 192.168.1.4 30 192.168.1.1
[R2]ip route-static 0.0.0.0 0 192.168.1.10
[R2]ip route-static 192.168.1.128 27 192.168.1.10
[R2]ip route-static 192.168.1.16 30 192.168.1.10
R3配置
[R3]ip route-static 192.168.1.32 27 192.168.1.5
[R3]ip route-static 192.168.1.0 30 192.168.1.5
[R3]ip route-static 192.168.1.64 27 192.168.1.5
[R3]ip route-static 192.168.1.64 27 192.168.1.14
[R3]ip route-static 0.0.0.0 0 192.168.1.14
[R3]ip route-static 192.168.1.128 27 192.168.1.14
[R3]ip route-static 192.168.1.8 30 192.168.1.14
[R3]ip route-static 192.168.1.16 30 192.168.1.14
R4配置
[R4]ip route-static 192.168.1.32 27 192.168.1.9
[R4]ip route-static 192.168.1.32 27 192.168.1.13
[R4]ip route-static 192.168.1.0 30 192.168.1.9
[R4]ip route-static 192.168.1.4 30 192.168.1.13
[R4]ip route-static 192.168.1.64 27 192.168.1.9
[R4]ip route-static 192.168.1.96 27 192.168.1.13
[R4]ip route-static 0.0.0.0 0 192.168.1.17
[R4]ip route-static 0.0.0.0 0 192.168.1.18
[R4]ip route-static 0.0.0.0 0 192.168.1.22 preference 61
R5配置
[R5]ip route-static 192.168.1.0 24 192.168.1.17
[R5]ip route-static 192.168.1.0 24 192.168.1.21 pre
[R5]ip route-static 192.168.1.0 24 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.0 24 null 0
测试结果:
空接口防环
R1
[R1]ip route-static 192.168.1.32 27 null 0
R2
[R2]ip route-static 192.168.1.64 27 null 0
R3
[R3]ip route-static 192.168.1.96 27 null 0
R4
[R4]ip route-static 192.168.1.128 27 null 0
正常R4到R5路由表
上面断开:
Routing Tables: Public
Destinations : 26 Routes : 27
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Static 61 0 RD 192.168.1.22 GigabitEthernet
4/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.1.0/30 Static 60 0 RD 192.168.1.9 GigabitEthernet
0/0/0
192.168.1.4/30 Static 60 0 RD 192.168.1.13 GigabitEthernet
0/0/1
192.168.1.8/30 Direct 0 0 D 192.168.1.10 GigabitEthernet
0/0/0
192.168.1.10/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.1.11/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.1.12/30 Direct 0 0 D 192.168.1.14 GigabitEthernet
0/0/1
192.168.1.14/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.1.15/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.1.20/30 Direct 0 0 D 192.168.1.21 GigabitEthernet
4/0/0
192.168.1.21/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/0
192.168.1.23/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
4/0/0
192.168.1.32/27 Static 60 0 RD 192.168.1.9 GigabitEthernet
0/0/0
Static 60 0 RD 192.168.1.13 GigabitEthernet
0/0/1
192.168.1.64/27 Static 60 0 RD 192.168.1.9 GigabitEthernet
0/0/0
192.168.1.96/27 Static 60 0 RD 192.168.1.13 GigabitEthernet
0/0/1
192.168.1.128/27 Static 60 0 D 0.0.0.0 NULL0
192.168.1.128/28 Direct 0 0 D 192.168.1.129 LoopBack0
192.168.1.129/32 Direct 0 0 D 127.0.0.1 LoopBack0
192.168.1.143/32 Direct 0 0 D 127.0.0.1 LoopBack0
192.168.1.144/28 Direct 0 0 D 192.168.1.145 LoopBack1
192.168.1.159/32 Direct 0 0 D 127.0.0.1 LoopBack1