NQA與VRRP、MSTP配合聯動檢測

組網及說明


NQA實驗

問題描述

通過NQA的檢測,檢測上行網絡是否正常,當上行網絡出現故障時,能告知VRRP、MSTP進行主備的切換。

過程分析

SW1為接入交換機,負責VLAN 10 、VLAN 20的接入

SW2為核心交換機,負責提供VLAN 10、VLAN20的網關,根據負載均衡的需求,在SW2交換機中,VLAN 10為MSTP主根,VLAN 20為備根。SW2交換機在網絡正常的情況下主要走VLAN10的流量。在SW2中配置NQA檢測,監控上行端口當發生故障時VLAN 10可快速切換到SW3交換機。

SW3為核心交換機,負責提供VLAN 10、VLAN20的網關,根據負載均衡的需求,在SW3交換機中,VLAN 20為MSTP主根,VLAN10為備根。SW3交換機在網絡正常的情況下主要走VLAN10的流量。在SW3中配置NQA檢測,監控上行端口當發生故障時VLAN 20可快速切換到SW2交換機。

R1為核心路由器,負責將業務路由高速轉發到下一個網絡中。

配置過程:

SW1:
<code>[H3C]sysname SW1

[SW1]vlan 10

[SW1-vlan10]qu

[SW1]vlan 20

[SW1-vlan20]qu

[SW1]int ran gi 1/0/1 to gi 1/0/2

[SW1-if-range]po li tr

[SW1-if-range]undo po tr pe vlan 1

[SW1-if-range]po tr pe vlan 10 20

[SW1-if-range]quit

[SW1]int gi 1/0/3

[SW1-GigabitEthernet1/0/3]po li acc

[SW1-GigabitEthernet1/0/3]po acc vl 10

[SW1-GigabitEthernet1/0/3]quit

[SW1]/<code>
SW2:
<code>[H3C]sysname SW2

[SW2]vlan 10

[SW2-vlan10]quit

[SW2]vlan 20

[SW2-vlan20]quit

[SW2]int ran gi 1/0/2 to gi 1/0/3

[SW2-if-range]po li tr

[SW2-if-range]undo po tr pe vlan 1

[SW2-if-range]po tr pe vlan 10 20

[SW2-if-range]quit

[SW2]int gi 1/0/1

[SW2-GigabitEthernet1/0/1]port link-mode route

[SW2-GigabitEthernet1/0/1]ip address 10.0.0.1 30

[SW2-GigabitEthernet1/0/1]undo shutdown

[SW2-GigabitEthernet1/0/1]quit/<code>
NQA配置
<code>[SW2]nqa agent enable 

[SW2]nqa entry weijianing ninglihua

[SW2-nqa-weijianing-ninglihua]type icmp-echo

[SW2-nqa-weijianing-ninglihua-icmp-echo]source int GigabitEthernet 1/0/1

[SW2-nqa-weijianing-ninglihua-icmp-echo]destination ip 10.0.0.2

[SW2-nqa-weijianing-ninglihua-icmp-echo]frequency 100000

[SW2-nqa-weijianing-ninglihua-icmp-echo]probe timeout 30

[SW2-nqa-weijianing-ninglihua-icmp-echo]next-hop 10.0.0.2

[SW2-nqa-weijianing-ninglihua-icmp-echo] history-record enable

[SW2-nqa-weijianing-ninglihua-icmp-echo]history-record number 50

[SW2-nqa-weijianing-ninglihua-icmp-echo]probe count 10

[SW2-nqa-weijianing-ninglihua-icmp-echo]probe timeout 30

[SW2-nqa-weijianing-ninglihua-icmp-echo]reaction 1 checked-element probe-fail threshold-type consecutive 1 action-type trigger-only

[SW2-nqa-weijianing-ninglihua-icmp-echo]route-option bypass-route

[SW2]track 1 nqa entry weijianing ninglihua reaction 1

[SW2]nqa schedule weijianing ninglihua start-time now lifetime forever

#

[SW2]int vlan 10

[SW2-Vlan-interface10]ip address 192.168.10.252 24

[SW2-Vlan-interface10]vrrp vrid 1 vi

[SW2-Vlan-interface10]vrrp vrid 1 virtual-ip 192.168.10.254

[SW2-Vlan-interface10]vrrp vrid 1 priority 120

[SW2-Vlan-interface10]vrrp vrid 1 preempt-mode

[SW2-Vlan-interface10]vrrp vrid 1 track 1 priority reduced 30

[SW2]int vlan 20

[SW2-Vlan-interface20]ip address 192.168.20.252 24

[SW2-Vlan-interface20]vrrp vrid 2 virtual-ip 192.168.20.254/<code>
MSTP配置
<code>[SW2]stp glo enable

[SW2]stp mode mstp

[SW2]stp region-configuration

[SW2-mst-region]region-name weijianing.com

[SW2-mst-region]instance 1 vlan 10

[SW2-mst-region]instance 2 vlan 20

[SW2-mst-region]active region-configuration



[SW2]stp instance 1 root primary

[SW2]stp instance 2 root secondary

#

[SW2]   int lo 0

[SW2-LoopBack0]ip add 1.1.1.1 32

[SW2-LoopBack0]undo shutdown

[SW2-LoopBack0]quit

[SW2]router id 1.1.1.1

[SW2]



[SW2]ospf 1

[SW2-ospf-1]silent-interface Vlan-interface 10

[SW2-ospf-1]silent-interface Vlan-interface 20

[SW2-ospf-1]area 0.0.0.0

[SW2-ospf-1-area-0.0.0.0]network 10.0.0.1 0.0.0.0

[SW2-ospf-1-area-0.0.0.0]net[SW2-ospf-1-area-0.0.0.0]network 1.1.1.1 0.0.0.0

[SW2-ospf-1-area-0.0.0.0]network 192.168.10.0 0.0.0.255

[SW2-ospf-1-area-0.0.0.0]network 192.168.20.0 0.0.0.255

[SW2-ospf-1-area-0.0.0.0]quit

[SW2-ospf-1]quit

[SW2]/<code>
SW3:
<code>[SW3]vlan 10

[SW3-vlan10]quit

[SW3]vlan 20

[SW3-vlan20]quit

[SW3]int ran gi 1/0/2 to gi 1/0/3

[SW3-if-range]po li tr

[SW3-if-range]undo po tr pe vlan 1

[SW3-if-range]po tr pe vlan 10 20

[SW3-if-range]quit

[SW3]

[SW3]int gi 1/0/1

[SW3-GigabitEthernet1/0/1]port link-mode route

[SW3-GigabitEthernet1/0/1]ip address 10.0.0.5 30

[SW3-GigabitEthernet1/0/1]undo shutdown

[SW3-GigabitEthernet1/0/1]quit

[SW3]/<code>
NQS配置:
<code>[SW3]nqa agent enable

[SW3]nqa entry weijianing ninglihua

[SW3-nqa-weijianing-ninglihua]type icmp-echo

[SW3-nqa-weijianing-ninglihua-icmp-echo]source int gi 1/0/1

[SW3-nqa-weijianing-ninglihua-icmp-echo]destination ip 10.0.0.6

[SW3-nqa-weijianing-ninglihua-icmp-echo]next-hop 10.0.0.6

[SW3-nqa-weijianing-ninglihua-icmp-echo]frequency 100000

[SW3-nqa-weijianing-ninglihua-icmp-echo] history-record enable

[SW3-nqa-weijianing-ninglihua-icmp-echo]history-record number 50

[SW3-nqa-weijianing-ninglihua-icmp-echo]probe count 10

[SW3-nqa-weijianing-ninglihua-icmp-echo]probe timeout 30

[SW3-nqa-weijianing-ninglihua-icmp-echo]reaction 1 checked-element probe-fail threshold-type consecutive 1 action-type trigger-only

[SW3-nqa-weijianing-ninglihua-icmp-echo]route-option bypass-route

[SW3]track 1 nqa entry weijianing ninglihua reaction 1

#

[SW3]int vlan 10

[SW3-Vlan-interface10]ip address 192.168.10.253 24

[SW3-Vlan-interface10]vrrp vrid 1 virtual-ip 192.168.10.254

[SW3-Vlan-interface10]quit

[SW3]



[SW3]int vlan 20

[SW3-Vlan-interface20]ip address 192.168.20.253 24

[SW3-Vlan-interface20]vrrp vrid 2 vi

[SW3-Vlan-interface20]vrrp vrid 2 virtual-ip 192.168.20.254

[SW3-Vlan-interface20]vrrp vrid 2 priority 120

[SW3-Vlan-interface20]vrrp vrid 2 preempt-mode

[SW3-Vlan-interface20]vrrp vrid 2 track 1 priority reduced 30

[SW3-Vlan-interface20]quit

[SW3]



[SW3]stp region-configuration

[SW3-mst-region]region-name weijianing.com

[SW3-mst-region]instance 1 vlan 10

[SW3-mst-region]instance 2 vlan 20

[SW3-mst-region]active region-configuration

[SW3-mst-region]quit

[SW3]stp instance 1 root secondary

[SW3]stp instance 2 root primary

[SW3]int LoopBack 0

[SW3-LoopBack0]ip add 2.2.2.2 32

[SW3-LoopBack0]undo shut

[SW3-LoopBack0]quit

[SW3]router id 2.2.2.2

[SW3]

[SW3]ospf 1

[SW3-ospf-1]silent-interface Vlan-interface 10

[SW3-ospf-1]silent-interface Vlan-interface 20

[SW3-ospf-1]area 0.0.0.0

[SW3-ospf-1-area-0.0.0.0]network 10.0.0.5 0.0.0.0

[SW3-ospf-1-area-0.0.0.0]network 2.2.2.2 0.0.0.0

[SW3-ospf-1-area-0.0.0.0]network 192.168.10.0 0.0.0.255

[SW3-ospf-1-area-0.0.0.0]network 192.168.20.0 0.0.0.255

[SW3-ospf-1-area-0.0.0.0]quit

[SW3-ospf-1]quit

[SW3]

[SW3]nqa schedule weijianing ninglihua start-time now lifetime forever/<code>
R1:
<code>[H3C]sysname R1

[R1]int lo 0

[R1-LoopBack0]ip add 3.3.3.3 32

[R1-LoopBack0]undo shut

[R1-LoopBack0]quit

[R1]router id 3.3.3.3

[R1]int gi 0/0

[R1-GigabitEthernet0/0]ip add 10.0.0.2 30

[R1-GigabitEthernet0/0]undo shut

[R1-GigabitEthernet0/0]quit

[R1]int gi 0/1

[R1-GigabitEthernet0/1]ip add 10.0.0.6 30

[R1-GigabitEthernet0/1]undo shutdown

[R1-GigabitEthernet0/1]quit

[R1]

[R1]ospf 1

[R1-ospf-1]ar

[R1-ospf-1]area 0.0.0.0

[R1-ospf-1-area-0.0.0.0]network 10.0.0.2 0.0.0.0

[R1-ospf-1-area-0.0.0.0]network 10.0.0.6 0.0.0.0

[R1-ospf-1-area-0.0.0.0]network 3.3.3.3 0.0.0.0

[R1-ospf-1-area-0.0.0.0]quit

[R1]/<code>

心得體會:

  1. 在擁有負載均衡和設備冗餘的網絡環境中,NQA的可選參數配置建議保持一致,特別是frequency檢測的頻率。
  2. 建議開啟NQA歷史記錄功能,這樣可以更好的確認NQA是否已經開始運行並監控。
  3. 在擁有路由冗餘、設備冗餘、VRRP的環境中,一定要開啟route-option bypass-route,這樣當路由發生故障時,也可以更好的觸發TRACK
  4. 在NQA配置指向目的地址時一定要正確區分description和destination這兩個單詞,由於這兩個單詞在配置時會優先出現description,可能會導致沒有配置目的地址而啟動NQA失敗
  5. 當主鏈路DOWN時,從主設備切換到備設備需要丟包13-14個才可恢復業務。
  6. 當主鏈路恢復時,業務可以從備用設備切換回到主設備(VRRP也可切換)且不丟包。
NQA與VRRP、MSTP配合聯動檢測


分享到:


相關文章: