策略路由练习实验报告
·
华为USG防火墙双线接入+策略路由+NAT Server综合实验报告
一、实验目的
- 实现内网网段划分:财务部(Client1,VLAN10)、研发部(Client2,VLAN1)、Web服务器(VLAN2);配置地址组、用户组区分部门权限。
- 掌握策略路由(PBR)实现不同部门访问FTP走不同运营商线路,搭配IP-Link链路故障检测。
- 完成内网出站Easy-IP源NAT;外网访问内网Web服务器使用NAT Server静态端口映射。
- 认证配置:财务部免认证上网,研发部匿名认证上网。
- 精准化安全策略部署,遵循最小权限原则管控流量。
- 公网R2、R4运行OSPF互通;防火墙导入电信、联通ISP明细路由,配合双缺省路由实现双线互联网访问。
- 实现智能入站引流:电信DNS用户访问Web服务器从GE1/0/1入站;联通DNS用户从GE1/0/2入站。
二、实验拓扑与地址规划
2.1 实验拓扑
(截图1:实验拓扑图)
2.2 网段规划
| 部门/设备 | VLAN | 网段 | 说明 |
|---|---|---|---|
| 财务部 Client1 | VLAN10 | 192.168.1.0/24 | 免认证 |
| 研发部 Client2 | VLAN1 | 192.168.2.0/24 | 匿名认证 |
| Web-Server | VLAN2 | 192.168.3.0/24 | NAT Server发布 |
| FW电信外网口 GE1/0/1 | — | 14.0.0.1/24 | 对接R4(电信)14.0.0.2 |
| FW联通外网口 GE1/0/2 | — | 12.0.0.1/24 | 对接R2(联通)12.0.0.2 |
| FTP公网地址 | — | 200.0.0.10 | 策略路由分流目标 |
| Web对外电信地址 | — | 14.0.0.100 | 电信用户访问入口 |
| Web对外联通地址 | — | 12.0.0.100 | 联通用户访问入口 |
2.3 设备说明
| 设备 | 角色 |
|---|---|
| FW | 华为USG6000V防火墙(核心设备) |
| R2 | 联通ISP路由器(运行OSPF) |
| R4 | 电信ISP路由器(运行OSPF) |
| SW | 二层交换机(VLAN划分) |
| Client1 | 财务部终端 |
| Client2 | 研发部终端 |
| Web-Server | 内网Web服务器 |
三、关键配置步骤
3.1 FW接口IP与安全区域配置
# ========== 内网子接口配置(终结VLAN)==========
interface GigabitEthernet1/0/0.10
vlan-type dot1q 10
ip address 192.168.1.254 255.255.255.0
service-manage ping permit
#
interface GigabitEthernet1/0/0.1
vlan-type dot1q 1
ip address 192.168.2.254 255.255.255.0
service-manage ping permit
#
interface GigabitEthernet1/0/0.2
vlan-type dot1q 2
ip address 192.168.3.254 255.255.255.0
service-manage ping permit
# ========== 外网物理接口配置 ==========
interface GigabitEthernet1/0/1
ip address 14.0.0.1 255.255.255.0
service-manage ping permit
#
interface GigabitEthernet1/0/2
ip address 12.0.0.1 255.255.255.0
service-manage ping permit
# ========== 安全区域划分 ==========
firewall zone trust
add interface GigabitEthernet1/0/0.10
add interface GigabitEthernet1/0/0.1
add interface GigabitEthernet1/0/0.2
#
firewall zone untrust
add interface GigabitEthernet1/0/1
add interface GigabitEthernet1/0/2
(截图2:
display zone验证安全区域与接口绑定关系)

3.2 SW交换机VLAN与接口配置
# ========== 创建VLAN ==========
vlan batch 10 1 2
# ========== 连接FW的接口配置为Trunk ==========
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 1 2
# ========== 连接Client1(财务部)的接口 ==========
interface GigabitEthernet0/0/2
port link-type access
port default vlan 10
# ========== 连接Client2(研发部)的接口 ==========
interface GigabitEthernet0/0/3
port link-type access
port default vlan 1
# ========== 连接Web-Server的接口 ==========
interface GigabitEthernet0/0/4
port link-type access
port default vlan 2
3.3 地址对象、用户组与认证配置
# ========== 地址对象(eNSP USG6000V语法)==========
address 财务部
net-address 192.168.1.0 mask 24
#
address 研发部
net-address 192.168.2.0 mask 24
#
address Web服务器
host-address 192.168.3.10
#
address FTP服务器
host-address 200.0.0.10
# ========== 用户组 ==========
user-group 财务部组
user-group 研发部组
# ========== 认证策略:财务部免认证,研发部匿名认证 ==========
authentication
access-type free user-group 财务部组
access-type anonymous user-group 研发部组
3.4 IP-Link链路探测配置
ip-link check enable
#
ip-link 1
destination 14.0.0.2 interface GigabitEthernet1/0/1
#
ip-link 2
destination 12.0.0.2 interface GigabitEthernet1/0/2
(截图3:
display ip-link验证两链路IP-Link状态均为Up)

3.5 策略路由PBR配置(流量策略模型)
# ========== 定义ACL匹配不同部门访问FTP的流量 ==========
acl 3000
rule 5 permit ip source 192.168.1.0 0.0.0.255 destination 200.0.0.10 0
#
acl 3001
rule 5 permit ip source 192.168.2.0 0.0.0.255 destination 200.0.0.10 0
# ========== 定义流分类(匹配ACL)==========
traffic classifier finance_ftp
if-match acl 3000
#
traffic classifier rd_ftp
if-match acl 3001
# ========== 定义流行为(重定向下一跳+IP-Link联动)==========
traffic behavior to_telecom
redirect ip-nexthop 14.0.0.2 track ip-link 1
#
traffic behavior to_unicom
redirect ip-nexthop 12.0.0.2 track ip-link 2
# ========== 定义流策略(绑定分类与行为)==========
traffic policy PBR
classifier finance_ftp behavior to_telecom
classifier rd_ftp behavior to_unicom
# ========== 在内网子接口入方向应用策略路由 ==========
interface GigabitEthernet1/0/0.10
traffic-policy PBR inbound
#
interface GigabitEthernet1/0/0.1
traffic-policy PBR inbound
3.6 NAT策略配置
# ========== 内网Easy-IP源NAT(出站)==========
nat-policy
rule name trust_to_internet
source-zone trust
destination-zone untrust
action source-nat easy-ip
# ========== NAT Server外网发布Web服务器(双线映射)==========
nat server Web_tele protocol tcp global 14.0.0.100 www inside 192.168.3.10 www
nat server Web_unicom protocol tcp global 12.0.0.100 www inside 192.168.3.10 www
(截图4:
display nat server验证NAT Server映射条目)

3.7 路由配置
# ========== 导入电信、联通ISP网段明细路由 ==========
ip route-static 101.1.1.0 255.255.255.0 14.0.0.2
ip route-static 102.1.1.0 255.255.255.0 12.0.0.2
# ========== 双线缺省路由(主备模式 + IP-Link联动)==========
ip route-static 0.0.0.0 0.0.0.0 14.0.0.2 preference 70 track ip-link 1
ip route-static 0.0.0.0 0.0.0.0 12.0.0.2 preference 80
(截图5:
display ip routing-table验证双缺省路由,电信为主preference 70)

3.8 精准安全策略配置
security-policy
rule name finance_internet
source-zone trust
source-address 192.168.1.0 24
destination-zone untrust
action permit
#
rule name rd_internet
source-zone trust
source-address 192.168.2.0 24
destination-zone untrust
authentication user-group 研发部组
action permit
#
rule name internet_to_web
source-zone untrust
destination-zone trust
destination-address 192.168.3.10 32
service http
action permit
#
rule name local_to_untrust
source-zone local
destination-zone untrust
service icmp
action permit
#
rule name trust_internal
source-zone trust
destination-zone trust
action permit
(截图6:
display security-policy rule all验证安全策略全貌)

3.9 R4电信路由器完整配置
# ========== 接口IP配置 ==========
interface GigabitEthernet0/0/0
ip address 14.0.0.2 255.255.255.0
description TO-FW-GE1/0/1
#
interface GigabitEthernet0/0/1
ip address 200.0.0.1 255.255.255.0
description TO-公网FTP服务器方向
#
interface LoopBack0
ip address 101.1.1.1 255.255.255.0
description 电信ISP网段
# ========== OSPF协议配置 ==========
ospf 1 router-id 4.4.4.4
area 0.0.0.0
network 14.0.0.0 0.0.0.255
network 101.1.1.0 0.0.0.255
network 200.0.0.0 0.0.0.255
# ========== 回程路由指向内网 ==========
ip route-static 192.168.0.0 255.255.252.0 14.0.0.1
3.10 R2联通路由器完整配置
# ========== 接口IP配置 ==========
interface GigabitEthernet0/0/0
ip address 12.0.0.2 255.255.255.0
description TO-FW-GE1/0/2
#
interface GigabitEthernet0/0/1
ip address 200.0.0.2 255.255.255.0
description TO-公网FTP服务器方向
#
interface LoopBack0
ip address 102.1.1.1 255.255.255.0
description 联通ISP网段
# ========== OSPF协议配置 ==========
ospf 1 router-id 2.2.2.2
area 0.0.0.0
network 12.0.0.0 0.0.0.255
network 102.1.1.0 0.0.0.255
network 200.0.0.0 0.0.0.255
# ========== 回程路由指向内网 ==========
ip route-static 192.168.0.0 255.255.252.0 12.0.0.1
四、实验测试与验证
测试1:用户认证机制验证
| 步骤 | 操作 | 预期结果 |
|---|---|---|
| 1 | Client1(财务部)直接访问互联网 | 无需认证页面,直接上网,免认证策略生效 |
| 2 | Client2(研发部)访问外网 | 弹出认证界面,完成匿名认证后正常访问公网 |
验证结果: ✅ 通过 / ⬜ 未通过
测试2:策略路由选路测试(访问FTP:200.0.0.10)
| 步骤 | 操作 | 预期结果 |
|---|---|---|
| 1 | Client1访问FTP服务器 | 流量从FW GE1/0/1电信线路转发(下一跳14.0.0.2) |
| 2 | Client2访问FTP服务器 | 流量从FW GE1/0/2联通线路转发(下一跳12.0.0.2) |
| 3 | 断开电信线路(GE1/0/1) | IP-Link 1探测失效→流行为to_telecom失效→流量依靠联通备用缺省路由转发 |
验证命令:
display firewall session table # 查看会话表确认出接口
(截图8:
display firewall session table查看FTP访问会话,确认出接口分别为GE1/0/1和GE1/0/2)

验证结果: ✅ 通过 / ⬜ 未通过
测试3:外网访问Web服务器(NAT Server入站分流)
| 步骤 | 操作 | 预期结果 |
|---|---|---|
| 1 | 电信公网用户访问 http://14.0.0.100 | 流量从GE1/0/1进入,NAT映射到192.168.3.10:80 |
| 2 | 联通公网用户访问 http://12.0.0.100 | 流量从GE1/0/2进入,NAT映射到192.168.3.10:80 |
验证结果: ✅ 通过 / ⬜ 未通过
测试4:内网Easy-IP源NAT验证
| 步骤 | 操作 | 预期结果 |
|---|---|---|
| 1 | 财务部/研发部终端访问互联网 | 内网私有IP转换为防火墙外网接口公网地址 |
| 2 | display firewall session table | 源地址已NAT为14.0.0.1或12.0.0.1 |
(截图9:
display firewall session table显示NAT转换后的公网源地址)


验证结果: ✅ 通过 / ⬜ 未通过
测试5:IP-Link链路故障切换测试
操作: 断开FW GE1/0/1与R4之间链路
| 步骤 | 现象 | 说明 |
|---|---|---|
| 1 | display ip-link → ip-link 1状态变为Down | IP-Link探测失效 |
| 2 | display ip routing-table → 电信缺省路由自动撤销 | preference 70路由消失 |
| 3 | 路由表自动切换到联通缺省路由(preference 80) | 内网终端继续访问外网不中断 |
(截图10:
display ip-link显示ip-link 1 Down +display ip routing-table显示只剩联通缺省路由)
验证结果: ✅ 通过 / ⬜ 未通过
测试6:公网OSPF连通性验证
| 步骤 | 操作 | 预期结果 |
|---|---|---|
| 1 | 在R2上 display ospf peer | OSPF邻居为R4,状态Full |
| 2 | 在R2上 display ip routing-table | 有R4的101.1.1.0/24路由 |
| 3 | R2 ping R4公网地址 | 互通 |
(截图11:R2与R4的OSPF邻居状态及路由表互相学习验证)
验证结果: ✅ 通过 / ⬜ 未通过
五、实验总结
| 序号 | 实验目标 | 达成情况 |
|---|---|---|
| 1 | 内网网段规划完成,财务部、研发部、Web服务器流量区分管控 | ✅ |
| 2 | 认证策略:财务部免认证,研发部匿名认证正常运行 | ✅ |
| 3 | 策略路由实现部门访问FTP分流,配合IP-Link完成链路故障检测 | ✅ |
| 4 | NAT双向功能:内网Easy-IP上网 + 外网双线NAT Server访问Web | ✅ |
| 5 | 安全策略精准控制流量,满足最小权限访问规范 | ✅ |
| 6 | 公网路由器OSPF互通,双线缺省路由实现互联网线路冗余备份 | ✅ |
六、常用排错命令速查
| 命令 | 用途 |
|---|---|
display ip routing-table | 查看路由表,验证缺省路由与明细路由 |
display ip-link | 查看IP-Link链路探测状态 |
display traffic policy statistics | 查看流策略(策略路由)命中统计 |
display firewall session table | 查看防火墙会话表(NAT+路由确认) |
display security-policy rule all | 查看安全策略规则全貌 |
display nat server | 查看NAT Server映射条目 |
display zone | 查看安全区域与接口绑定 |
display ospf peer | 查看OSPF邻居状态 |
display vlan | 查看交换机VLAN配置 |
实验日期: 2026年8月1日
DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。
更多推荐







所有评论(0)