这是 network/pbr.md 的每次改动内容,按时间从新到旧。其他文章一起提交的部分不会出现在这里。
#1
2026-10-18
+79
−0
docs: 网络进阶(MSTP/ACL/NAT/PBR)、Linux 进阶(模块/性能/bonding)、Windows 进阶(DFS/DHCP/AD CS)
42afade
new file mode 100644
@@ -0,0 +1,79 @@
+---
+tags: [策略路由, PBR, 网络进阶]
+order: 125
+---
+
+# 策略路由(PBR)
+
+## 场景
+
+两条出口,财务的流量必须走专线、其它走宽带;或者特定目的地址绕过默认路由。
+
+## 前置条件
+
+- 知道要匹配的源地址段或目的地址
+- 两条出口的下一跳地址
+- 接口上已经配好基础路由(PBR 是叠加,不是替代)
+
+## 配置
+
+### H3C
+
+```text
+system-view
+acl advanced 3000
+ rule 0 permit ip source 10.10.0.0 0.0.0.255
+ quit
+
+policy-based-route FINANCE permit node 10
+ if-match acl 3000
+ apply next-hop 10.1.0.1
+ quit
+
+interface Vlan-interface10
+ ip policy-based-route FINANCE
+ quit
+```
+
+### 华为
+
+```text
+acl number 3000
+ rule 5 permit ip source 10.10.0.0 0.0.0.255
+ quit
+
+policy-based-route FINANCE permit node 10
+ if-match acl 3000
+ apply ip-address next-hop 10.1.0.1
+ quit
+
+interface Vlanif10
+ ip policy-based-route FINANCE
+ quit
+```
+
+## 验证
+
+```text
+display policy-based-route
+display policy-based-route statistics
+tracert -a 10.10.0.10 8.8.8.8
+```
+
+用带源地址的 `tracert` 确认走的是专线出口。
+
+## 回滚
+
+```text
+interface Vlan-interface10
+ undo ip policy-based-route
+```
+
+## 坑
+
+- **PBR 只在入接口生效**,配到错误接口上等于没配。
+- 下一跳不可达时流量被丢,不会自动回退到路由表(有些平台可以配 `track`)。
+- 只对「经过本机」的流量生效,本机自己发起的流量要看平台支持。
+- 匹配条件写太宽,把不需要的流量也带偏了。
+- 高可用切换后 PBR 不跟着切,要配合健康检查。
+- 排查时先看路由表再看 PBR,顺序反了容易误判。