首页 > 技术文章 > 华为NQA实验

xiykj 2022-04-04 22:05 原文

网络拓扑如下:

目的:通过配置nqa路由检测工具,来实现静态路由的自动切换,达到网络链路联通性,当主路径故障时,通过配置nqa可使PC1与PC2之间的网络可以无缝连接

 

PC上配置好ip,网关为路由器直连接口ip地址

路由器各接口配置地址:

R1:

<Huawei>system-view
[R1]sysname R1
[R1]interface GigabitEthernet 0/0/2
[R1-GigabitEthernet0/0/2]ip address 10.1.1.254 24        #配置PC1的网关ip

[R1-GigabitEthernet0/0/2]inter gig0/0/0
[R1-GigabitEthernet0/0/0]ip address 12.1.1.1 24

[R1-GigabitEthernet0/0/0]inter gig0/0/1
[R1-GigabitEthernet0/0/1]ip address 13.1.1.1 24
[R1-GigabitEthernet0/0/1]qu


[R1]dis ip interface brief        #查看接口ip地址
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 0

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              12.1.1.1/24          up         up        
GigabitEthernet0/0/1              13.1.1.1/24          up         up        
GigabitEthernet0/0/2              10.1.1.254/24        up         up        
NULL0                             unassigned           up         up(s)     
[R1]

 

R2:

<Huawei>sys
[Huawei]sysname R2
[R2]interface gig0/0/0
[R2-GigabitEthernet0/0/0]ip address 12.1.1.2 24

[R2-GigabitEthernet0/0/0]inter gig0/0/1
[R2-GigabitEthernet0/0/1]ip address 24.1.1.2 24
[R2-GigabitEthernet0/0/1]qu

[R2]dis ip interface brief         #查看接口ip地址
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              12.1.1.2/24          up         up        
GigabitEthernet0/0/1              24.1.1.2/24          up         up        
GigabitEthernet0/0/2              unassigned           down       down      
NULL0                             unassigned           up         up(s)     
[R2]

 

R3:

<Huawei>system-view
[Huawei]sysname R3
[R3]inter GigabitEthernet 0/0/1
[R3-GigabitEthernet0/0/1]ip address 13.1.1.3 24

[R3-GigabitEthernet0/0/1]inter gig0/0/2
[R3-GigabitEthernet0/0/2]ip address 34.1.1.3 24
[R3-GigabitEthernet0/0/2]qu

[R3]dis ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              unassigned           down       down      
GigabitEthernet0/0/1              13.1.1.3/24          up         up        
GigabitEthernet0/0/2              34.1.1.3/24          up         up        
NULL0                             unassigned           up         up(s)     
[R3]

 

R4:

<Huawei>sys
[Huawei]sysname R4
[R4]inter gig0/0/0
[R4-GigabitEthernet0/0/0]ip address 172.16.2.254 24

[R4-GigabitEthernet0/0/0]inter gig0/0/1
[R4-GigabitEthernet0/0/1]ip address 24.1.1.4 24

[R4-GigabitEthernet0/0/1]inter gig0/0/2
[R4-GigabitEthernet0/0/2]ip address 34.1.1.4 24
[R4-GigabitEthernet0/0/2]qu

[R4]dis ip interface brief 
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 0

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              172.16.2.254/24      up         up        
GigabitEthernet0/0/1              24.1.1.4/24          up         up        
GigabitEthernet0/0/2              34.1.1.4/24          up         up        
NULL0                             unassigned           up         up(s)     
[R4]

 

在R1、R4上配置nqa

[R1]nqa test-instance kelly cat        #创建nqa管理员Kelly,cat进程
[R1-nqa-kelly-cat]test-type icmp        #协议基于icmp
[R1-nqa-kelly-cat]frequency 5        #5秒发送一次探针
[R1-nqa-kelly-cat]timeout 2        #超过2秒网络故障;注:interval seconds默认时间为4s,timeout时间如果大于4s,则需要调整interval seconds的时间大于timeout,且frequency也需大于timeout时间,不然nqa进程无法启动
[R1-nqa-kelly-cat]threshold rtd 1        #超过1秒代表网络质量不好
[R1-nqa-kelly-cat]probe-count 1        #一次发送1个探针
[R1-nqa-kelly-cat]destination-address ipv4 24.1.1.4        #目的ip
[R1-nqa-kelly-cat]source-address ipv4 12.1.1.1        #源ip
[R1-nqa-kelly-cat]start now        #现在开始启动

 

[R4]nqa test-instance kelly cat        #创建nqa管理员Kelly,cat进程
[R4-nqa-kelly-cat]test-type icmp        #协议基于icmp
[R4-nqa-kelly-cat]frequency 5        #5秒发送一次探针
[R4-nqa-kelly-cat]timeout 2        #超过2秒网络故障;注:interval seconds默认时间为4s,timeout时间如果大于4s,则需要调整interval seconds的时间大于timeout,且frequency也需大于timeout时间,不然nqa进程无法启动
[R4-nqa-kelly-cat]threshold rtd 1        #超过1秒代表网络质量不好
[R4-nqa-kelly-cat]probe-count 1        #一次发送1个探针
[R4-nqa-kelly-cat]destination-address ipv4 12.1.1.1        #目的ip
[R4-nqa-kelly-cat]source-address ipv4 24.1.1.4       #源ip
[R4-nqa-kelly-cat]start now        #现在开始启动

 

所有路由器配置静态路由:

R1

[R1]ip route-static 24.1.1.0 24 GigabitEthernet 0/0/0 12.1.1.2        #去往24.1.1.0网络出接口GE0/0/0,下一跳地址12.1.1.2

[R1]ip route-static 172.16.2.0 24 GigabitEthernet 0/0/0 12.1.1.2 track nqa kelly cat        #去往172.16.2.0网络出接口GE0/0/0,下一跳地址12.1.1.2,并调用nqa路由追踪

[R1]ip route-static 172.16.2.0 24 GigabitEthernet 0/0/1 13.1.1.3 preference 100        #备用路径,将优先级调为100,作为备用路由

 

R2

[R2]ip route-static 10.1.1.0 24 GigabitEthernet 0/0/0 12.1.1.1

[R2]ip route-static 172.16.2.0 24 GigabitEthernet 0/0/1 24.1.1.4

 

R3

[R3]ip route-static 10.1.1.0 24 GigabitEthernet 0/0/1 13.1.1.1

[R3]ip route-static 172.16.2.0 24 GigabitEthernet 0/0/2 34.1.1.4

 

R4

[R4]ip route-static 12.1.1.0 24 GigabitEthernet 0/0/1 24.1.1.2

[R4]ip route-static 10.1.1.0 24 GigabitEthernet 0/0/1 24.1.1.2 track nqa kelly cat

[R4]ip route-static 10.1.1.0 24 GigabitEthernet 0/0/2 34.1.1.3 preference 100

 

nqa查询命令:

display nqa results        #查看nqa结果

 

display nqa history        #查询nqa历史记录

 

推荐阅读