static-route
Skill2 starsChanged 3 months agoMITView on GitHub
This skill should be used when the user asks to configure or troubleshoot static routes on Huawei CloudEngine / S series switches. Covers IPv4/IPv6 static route, default route, route preference, recursive routing, BFD/NQA linkage for fast failover, floating static route, and permanent advertisement. Applicable platforms S1720/S2700/S5700/S6720 V200R011C10+ and CloudEngine 5800-9800 V200R022C00+.
In this repository16 other files it gives its agents.
- aaa-auth-configSkill
- attack-defenseSkill
- bgp-configSkill
- ha-hrpSkill
- health-checkSkill
- interface-configSkill
- ipsec-vpnSkill
- mirrorSkill
- nat-configSkill
- ospf-configSkill
- security-policySkill
- ssl-vpnSkill
- stack-istackSkill
- vlan-configSkill
- vrrpSkill
- wlan-ac-configSkill
The file
Files
华为交换机静态路由配置技能 (static-route)
适用平台 S 系列 V200R011C10+ | CE 系列 V200R022C00+ 文档来源 华为产品文档 dc_cfg_static-route_*
静态路由是手工配置 适合小型网络与策略路由 大型网络配合动态路由作兜底
触发场景
- 小型网络规划路由
- 配置默认路由 出口
- 浮动静态路由(多链路主备)
- 静态路由 + BFD 实现毫秒级切换
- 静态路由 + NQA 实现链路探测
- 跨网段路由不通排查
- IPv6 静态路由配置
静态路由优先级
| 路由类型 | 默认优先级 |
| Direct(直连) | 0 |
| OSPF | 10 |
| IS-IS | 15 |
| Static | 60(可改) |
| RIP | 100 |
| BGP-External | 255 |
数值越小越优先 → 静态路由 60 默认低于 OSPF 高于 BGP
浮动静态路由:把备份链路静态路由优先级调高(数值更大)
配置三步走
1 基础 IPv4 静态路由
system-view
ip route-static <目的网络> <掩码> <下一跳IP|出接口>2 默认路由(最常用)
ip route-static 0.0.0.0 0.0.0.0 <下一跳IP>3 验证
display ip routing-table
display ip routing-table protocol static高级用法
浮动静态路由 主备链路
# 主链路 优先级默认 60
ip route-static 192.168.10.0 24 10.1.1.2
# 备链路 优先级 100(数值越大越不优先)
ip route-static 192.168.10.0 24 10.2.1.2 preference 100主链路 down 后 备链路自动接管
静态路由 + BFD 联动 毫秒级切换
# 1 建 BFD 会话
bfd
quit
bfd to_R2 bind peer-ip 10.1.1.2 source-ip 10.1.1.1
discriminator local 1
discriminator remote 1
commit
# 2 静态路由绑 BFD
ip route-static 192.168.10.0 24 10.1.1.2 track bfd-session to_R2对端 BFD 检测到链路 down 立即触发路由切换(毫秒级 比物理 down 检测快)
静态路由 + NQA 联动 端到端探测
# 1 创建 NQA 探测
nqa test-instance admin to_server
test-type icmp
destination-address ipv4 8.8.8.8
frequency 5
start now
# 2 静态路由绑 NQA
ip route-static 0.0.0.0 0.0.0.0 10.1.1.2 track nqa admin to_serverNQA 探测失败 → 路由失效 → 切到备份
永久发布
ip route-static 10.0.0.0 8 NULL0 permanent即使出接口 down 也保留路由(黑洞路由防环用)
IPv6 静态路由
ipv6
ipv6 route-static 2001:db8::1 64 fe80::1 GigabitEthernet0/0/1
ipv6 route-static :: 0 2001:db8::1 # IPv6 默认路由
display ipv6 routing-table命令体系
配置
| 命令 | 视图 | 说明 |
ip route-static <net> <mask> <next-hop>|<if> | system | 创建静态路由 |
ip route-static <net> <mask> <nh> preference <pref> | system | 指定优先级 |
ip route-static <net> <mask> <nh> tag <tag> | system | 路由 tag |
ip route-static <net> <mask> <nh> description <text> | system | 描述 |
ip route-static <net> <mask> <nh> track bfd-session <name> | system | BFD 联动 |
ip route-static <net> <mask> <nh> track nqa <admin> <name> | system | NQA 联动 |
ip route-static <net> <mask> <nh> permanent | system | 永久发布 |
ip route-static <net> <mask> <if> permanent | system | 出接口永久 |
ip route-static default-preference <pref> | system | 改默认优先级 |
ip route-static vpn-instance <vpn> <net> <mask> <nh> | system | VPN 实例静态 |
IPv6
| 命令 | 视图 | 说明 |
| ipv6 | system | 启用 IPv6 |
ipv6 route-static <net> <prefix-len> <nh> [<if>] | system | IPv6 静态 |
查看
| 命令 | 说明 |
| display ip routing-table | 全路由表 |
| display ip routing-table protocol static | 仅静态 |
display ip routing-table <ip> | 查指定网段 |
display ip routing-table <ip> longer-match | 最长匹配 |
| display ip routing-table verbose | 详细 |
| display ip routing-table statistics | 路由统计 |
| display ipv6 routing-table | IPv6 路由表 |
| display bfd session all | BFD 会话状态 |
| display nqa results | NQA 结果 |
完整范式 双出口主备 + BFD
需求:出口路由器 R1 主 R2 备 主链路 ISP1 故障 50ms 切换 ISP2
system-view
# 1 BFD 全局开
bfd
# 2 配置到 R1 R2 的 BFD 会话
bfd to_isp1 bind peer-ip 10.1.1.2 source-ip 10.1.1.1
discriminator local 100
discriminator remote 100
commit
quit
bfd to_isp2 bind peer-ip 10.2.1.2 source-ip 10.2.1.1
discriminator local 200
discriminator remote 200
commit
quit
# 3 默认路由 主链路绑 BFD
ip route-static 0.0.0.0 0.0.0.0 10.1.1.2 track bfd-session to_isp1
# 4 默认路由 备链路 优先级调低(数值大)
ip route-static 0.0.0.0 0.0.0.0 10.2.1.2 preference 100常见陷阱
- 下一跳不可达(路由表里查不到下一跳)→ 静态路由不生效
- 出接口配错 → 配 next-hop IP 更稳 出接口适合点对点链路
- 浮动静态优先级搞反 → 备链路反成主
- BFD 没 commit → 配了等于没配
- IPv6 静态路由忘了先
ipv6启用 - NQA 频率太低(如 60s)→ 切换感知慢 改成 5s
- 写了
ip route-static <net> <mask> <if>但接口是以太网 → ARP 学习每个目的地址 性能差 改成 next-hop IP
排查流程
ping 不通
|
v
[1] display ip routing-table <目的IP> → 看是否有匹配路由
|
├─ 无 → 走分支 A 路由未配置或失效
└─ 有
|
v
[2] 看 NextHop 是否可达 → ping <next-hop>
|
├─ 不通 → 走分支 B 下一跳直连问题
└─ 通 → 走分支 C 对端回程路由问题相关文件
- references/static-route-commands.md 完整命令
- references/static-route-troubleshooting.md 故障排查
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

