静态路由
新一2026-08-15大约 2 分钟-约 499 字
约 499 字大约 2 分钟
2026-08-15
实验目的
- 掌握华为路由器接口 IP 地址配置。
- 理解静态路由原理,手动添加非直连网段路由条目。
- 实现 PC1 与 PC2 全网互通。
- 学会查看路由表,排查路由不通故障。
实验环境
- eNSP 模拟器
- 华为 AR1220 路由器 3 台
- PC 主机 2 台
实验拓扑

IP地址规划
| 设备 | 接口 | IP 地址 / 掩码 |
|---|---|---|
| AR1 | G0/0/0 | 192.168.10.2/24 |
| AR1 | G0/0/1 | 192.168.20.1/24 |
| AR2 | G0/0/0 | 192.168.20.2/24 |
| AR2 | G0/0/1 | 192.168.30.1/24 |
| AR3 | G0/0/0 | 192.168.30.2/24 |
| AR3 | G0/0/1 | 192.168.40.2/24 |
| PC1 | - | 192.168.10.1/24,网关 192.168.10.2 |
| PC2 | - | 192.168.40.1/24,网关 192.168.40.2 |
网段清单:192.168.10.0/24、192.168.20.0/24、192.168.30.0/24、192.168.40.0/24
配置
AR1 配置
<Huawei>system-view
[Huawei]sysname AR1
# 连接PC1接口
[AR1]interface GigabitEthernet 0/0/0
[AR1-Ethernet0/0/0]ip address 192.168.10.2 255.255.255.0
[AR1-Ethernet0/0/0]quit
# 连接AR2接口
[AR1]interface GigabitEthernet 0/0/1
[AR1-Ethernet0/0/1]ip address 192.168.20.1 255.255.255.0
[AR1-Ethernet0/0/1]quitAR2 配置
<Huawei>system-view
[Huawei]sysname AR2
# 连接AR1接口
[AR2]interface GigabitEthernet 0/0/0
[AR2-Ethernet0/0/0]ip address 192.168.20.2 255.255.255.0
[AR2-Ethernet0/0/0]quit
# 连接AR3接口
[AR2]interface GigabitEthernet 0/0/1
[AR2-Ethernet0/0/1]ip address 192.168.30.1 255.255.255.0
[AR2-Ethernet0/0/1]quitAR3 配置
<Huawei>system-view
[Huawei]sysname AR3
# 连接AR2接口
[AR3]interface GigabitEthernet 0/0/0
[AR3-Ethernet0/0/0]ip address 192.168.30.2 255.255.255.0
[AR3-Ethernet0/0/0]quit
# 连接PC2接口
[AR3]interface Ethernet 0/0/1
[AR3-Ethernet0/0/1]ip address 192.168.40.2 255.255.255.0
[AR3-Ethernet0/0/1]quitAR1 静态路由(去往右边所有网段)
#去往192.168.30.0/24,下一跳AR2:192.168.20.2
[AR1]ip route-static 192.168.30.0 255.255.255.0 192.168.20.2
#去往192.168.40.0/24,下一跳AR2:192.168.20.2
[AR1]ip route-static 192.168.40.0 255.255.255.0 192.168.20.2AR2 静态路由(左右双向路由)
#去往左侧192.168.10.0/24,下一跳AR1:192.168.20.1
[AR2]ip route-static 192.168.10.0 255.255.255.0 192.168.20.1
#去往右侧192.168.40.0/24,下一跳AR3:192.168.30.2
[AR2]ip route-static 192.168.40.0 255.255.255.0 192.168.30.2AR3 静态路由(去往左边所有网段)
#去往192.168.10.0/24,下一跳AR2:192.168.30.1
[AR3]ip route-static 192.168.10.0 255.255.255.0 192.168.30.1
#去往192.168.20.0/24,下一跳AR2:192.168.30.1
[AR3]ip route-static 192.168.20.0 255.255.255.0 192.168.30.1结果验证
查看路由表
display ip routing-table路由表中出现 Static 类型条目即为静态路由。
连通性测试
在 PC1 命令行 ping PC2 地址
ping 192.168.40.1出现 Reply from 代表全网互通,实验成功。
