網絡拓撲如下:
目的:通過配置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歷史記錄