nqa是一种实时的网络性能探测和统计技术,可以对响应时间、网络抖动、丢包率等网络信息进行统计。如图1所示,接口备份与NQA联动功能配置相对简单,只需在本端RouterA上配置NQA测试例,并在RouterA的备份接口上配置接口备份与NQA联动,即可实现对主链路连通状态的实时检测和主备链路的切换。当NQA检测到主链路状态良好时,由主链路承担业务传输;当NQA检测到主链路不可达或链路质量较差时,通知RouterA启用备份接口,由备份链路临时承担业务传输;当NQA检测到原先故障的主链路恢复正常时,业务会重新切换到主链路。
AR1:
[Huawei]dis current-configuration
[V200R003C00]
firewall zone Local
priority 15
interface GigabitEthernet0/0/0
ip address 12.1.1.1 255.255.255.0
interface GigabitEthernet0/0/1
ip address 13.1.1.1 255.255.255.0
interface GigabitEthernet0/0/2
interface NULL0
interface LoopBack0
ip address 1.1.1.1 255.255.255.0
ip route-static 4.4.4.0 255.255.255.0 13.1.1.3 preference 100
ip route-static 4.4.4.0 255.255.255.0 GigabitEthernet0/0/0 12.1.1.2 track nqa ad
min icmp
ip route-static 24.1.1.0 255.255.255.0 12.1.1.2
ip route-static 34.1.1.0 255.255.255.0 13.1.1.2
nqa test-instance admin icmp //配置名为admin icmp的NQA测试例
test-type icmp //配置测试例类型为ICMP
destination-address ipv4 192.168.3.1 //配置NQA测试例的目的地址为192.168.3.1
frequency 10 //配置NQA测试例两次测试之间间隔10秒
probe-count 2 //配置NQA测试例的测试探针数目为2
start now //立即开始执行当前的NQA测试例
return
AR2:
[Huawei]dis cu
[Huawei]dis current-configuration
[V200R003C00]
snmp-agent local-engineid 800007DB03000000000000
snmp-agent
clock timezone China-Standard-Time minus 08:00:00
portal local-server load portalpage.zip
drop illegal-mac alarm
set cpu-usage threshold 80 restore 75
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher % %K8m.Nt84DZ}e#<0`8bmE3Uw}% %
local-user admin service-type http
firewall zone Local
priority 15
interface GigabitEthernet0/0/0
ip address 12.1.1.2 255.255.255.0
interface GigabitEthernet0/0/1
ip address 24.1.1.2 255.255.255.0
interface GigabitEthernet0/0/2
interface NULL0
ip route-static 1.1.1.0 255.255.255.0 12.1.1.1
ip route-static 4.4.4.0 255.255.255.0 24.1.1.4
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
wlan ac
return
[Huawei]
dis cu
dis current-configuration
[V200R003C00]
interface GigabitEthernet0/0/0
ip address 12.1.1.2 255.255.255.0
interface GigabitEthernet0/0/1
ip address 24.1.1.2 255.255.255.0
interface GigabitEthernet0/0/2
interface NULL0
ip route-static 1.1.1.0 255.255.255.0 12.1.1.1
ip route-static 4.4.4.0 255.255.255.0 24.1.1.4
return
AR3:
interface GigabitEthernet0/0/0
ip address 13.1.1.3 255.255.255.0
interface GigabitEthernet0/0/1
ip address 34.1.1.3 255.255.255.0
interface GigabitEthernet0/0/2
interface NULL0
ip route-static 1.1.1.0 255.255.255.0 13.1.1.1
ip route-static 4.4.4.0 255.255.255.0 34.1.1.4
user-interface con 0
authentication-mode password
user-interface vty 0 4
user-interface vty 16 20
wlan ac
return
AR4:
interface GigabitEthernet0/0/0
ip address 24.1.1.4 255.255.255.0
interface GigabitEthernet0/0/1
ip address 34.1.1.4 255.255.255.0
interface GigabitEthernet0/0/2
interface NULL0
interface LoopBack0
ip address 4.4.4.4 255.255.255.0
ip route-static 1.1.1.0 255.255.255.0 24.1.1.2
ip route-static 1.1.1.0 255.255.255.0 34.1.1.3
ip route-static 12.1.1.0 255.255.255.0 24.1.1.2
ip route-static 13.1.1.0 255.255.255.0 34.1.1.3
return
在RouterA上执行命令display nqa results test-instance admin icmp查看NQA测试结果,其中可以看到“Lost packet ratio: 0 %”,这说明链路状态完好。然后执行命令display ip routing-table查看路由表,可以看到到目的网段4.4.4.0/24,下一条为12.1.1.2的静态路由存在于路由表中,而配置的优先级为100的静态路由不存在与路由表中。
在RouterB的两个接口的任一接口视图下执行命令shutdown,来模拟链路出现故障。然后在RouterA上执行命令display nqa results test-instance admin icmp,查看NQA测试结果,其中可以看到“Completion:failed”和“Lost packet ratio: 100 %”,这说明检测到链路出现故障。接着执行命令display ip routing-table查看路由表,可以看到之前到目的网段4.4.4.0/24,下一条为13.1.1.3的静态路由被优先级为100的静态路由在路由表中所取代。