可以使用 NQA + Track + 浮动静态路由 实现。NQA 的 source interface 只是指定探测报文源地址,真正控制主备切换的是 Track 和静态路由联动。
在哪里配置呢
system-view nqa entry admin main-link type icmp-echo destination ip 223.5.5.5 source interface GigabitEthernet1/0/1 next-hop ip 192.168.1.1 frequency 3000 probe timeout 1000 reaction 1 checked-element probe-fail threshold-type consecutive 3 action-type trigger-only quit track 1 nqa entry admin main-link reaction 1 nqa schedule admin main-link start-time now lifetime forever ip route-static 0.0.0.0 0 192.168.1.1 track 1 ip route-static 0.0.0.0 0 192.168.2.1 preference 80
一、NQA 指定源接口完整命令(ICMP-echo 探测,华三通用)
核心命令:source interface
仅在 type icmp-echo 视图下配置,以该接口主 IP 作为探测报文源地址
bash
运行
system-view
# 创建NQA测试例,管理员admin,测试名test
nqa entry admin test
# 探测类型ICMP
type icmp-echo
# 指定源接口(上联主线路接口,如GE0/0)
source interface GigabitEthernet 0/0
# 探测对端网关/公网DNS(用来判断主路由通畅)
destination ip 223.5.5.5
# 探测周期3秒
frequency 3000
# 连续3次失败判定链路故障
reaction 1 checked-element probe-fail threshold-type consecutive 3 action-type trigger-only
quit
# 绑定track,联动路由
track 1 nqa entry admin test reaction 1
# 永久启动探测
nqa schedule admin test start-time now lifetime forever
补充说明
source interface 和 source ip 二选一,同时配置时source ip 优先级更高;
指定的源接口必须物理 UP,否则 NQA 直接探测失败;
如果你要指定出接口(报文从哪个口发出去)用 out interface,和源接口不是一个概念。
二、双路由器主备自动切换完整方案(NQA+Track + 静态路由)
组网说明
本路由器:GE0/0 主线路接主路由器(下一跳 10.0.0.1);GE0/1 备份线路接备用路由器(下一跳 20.0.0.1)
需求:主路由器链路断 / 网关不通,自动切备用路由器;主线路恢复自动切回主路
完整全套配置
bash
运行
system-view
# 1、配置接口IP
interface GigabitEthernet 0/0
ip address 10.0.0.2 255.255.255.0
interface GigabitEthernet 0/1
ip address 20.0.0.2 255.255.255.0
# 2、NQA探测主线路,源接口为上联主线路GE0/0
nqa entry admin test
type icmp-echo
source interface GigabitEthernet 0/0
destination ip 223.5.5.5
frequency 3000
reaction 1 checked-element probe-fail threshold-type consecutive 3 action-type trigger-only
quit
track 1 nqa entry admin test reaction 1
nqa schedule admin test start-time now lifetime forever
# 3、双静态路由实现主备切换
# 主路由:优先级60,绑定track1,探测失败路由自动失效
ip route-static 0.0.0.0 0.0.0.0 10.0.0.1 track 1 preference 60
# 备份路由:优先级70,无track,主路由失效自动生效
ip route-static 0.0.0.0 0.0.0.0 20.0.0.1 preference 70
切换逻辑
NQA 从 GE0/0 接口发包探测公网地址,连续 3 次丢包 → track1 状态变为 Negative;
主静态路由关联 track1,状态失效后从路由表消失;
备份路由优先级更低,自动成为有效路由,流量切备用路由器;
线路恢复、NQA 探测通 → track1 恢复正常,主路由重新写入路由表,自动切回。
三、验证排查命令
bash
运行
# 查看NQA探测结果
display nqa entry admin test result
# 查看track状态
display track all
# 查看当前生效路由,确认切换是否成功
display ip routing-table
极简总结
NQA 指定源接口:在 icmp-echo 视图下 source interface 接口名;
双路由自动切换靠 NQA 探测链路状态 + Track 绑定 + 两条不同优先级静态路由;
主路由绑定 track,故障自动失效,低优先级备份路由顶上。
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作
举报
×
侵犯我的权益
×
侵犯了我企业的权益
×
抄袭了我的内容
×
原文链接或出处
诽谤我
×
对根叔社区有害的内容
×
不规范转载
×
举报说明
system-view nqa entry admin main-link type icmp-echo destination ip 223.5.5.5 source interface GigabitEthernet1/0/1 next-hop ip 192.168.1.1 frequency 3000 probe timeout 1000 reaction 1 checked-element probe-fail threshold-type consecutive 3 action-type trigger-only quit track 1 nqa entry admin main-link reaction 1 nqa schedule admin main-link start-time now lifetime forever ip route-static 0.0.0.0 0 192.168.1.1 track 1 ip route-static 0.0.0.0 0 192.168.2.1 preference 80