As shown in Figure 1, SwitchA on a company network is connected to two egress routers (RouterA and RouterB) through two default static routes to implement load balancing. The company wants to deploy a link failure detection mechanism for the default static routes, so that traffic can be switched from a faulty link to the other functioning link promptly to prevent services from being interrupted.
In this scenario, ensure that all connected interfaces have STP disabled. If STP is enabled and VLANIF interfaces of switches are used to construct a Layer 3 ring network, an interface on the network will be blocked. As a result, Layer 3 services on the network cannot run normally.
Create ICMP NQA test instances to monitor the status of links.
ICMP NQA test instances need to be created on the NQA client SwitchA to detect the status of links between SwitchA and RouterA and between SwitchA and RouterB.
Configure default static routes and bind them to the NQA test instances.
Default static routes destined for RouterA and RouterB need to be configured on SwitchA and bound to NQA test instances. In this way, if an NQA test instance detects a link failure, traffic is switched to the other link.
<HUAWEI> system-view [HUAWEI] sysname SwitchA [SwitchA] vlan batch 100 200 300 [SwitchA] interface gigabitethernet 0/0/1 [SwitchA-GigabitEthernet0/0/1] port link-type trunk [SwitchA-GigabitEthernet0/0/1] port trunk allow-pass vlan 100 [SwitchA-GigabitEthernet0/0/1] quit [SwitchA] interface gigabitethernet 0/0/2 [SwitchA-GigabitEthernet0/0/2] port link-type trunk [SwitchA-GigabitEthernet0/0/2] port trunk allow-pass vlan 200 [SwitchA-GigabitEthernet0/0/2] quit [SwitchA] interface gigabitethernet 0/0/3 [SwitchA-GigabitEthernet0/0/3] port link-type trunk [SwitchA-GigabitEthernet0/0/3] port trunk allow-pass vlan 300 [SwitchA-GigabitEthernet0/0/3] quit
[SwitchA] interface vlanif 100 [SwitchA-Vlanif100] ip address 10.1.10.2 24 [SwitchA-Vlanif100] quit [SwitchA] interface vlanif 200 [SwitchA-Vlanif200] ip address 10.1.20.2 24 [SwitchA-Vlanif200] quit [SwitchA] interface vlanif 300 [SwitchA-Vlanif300] ip address 10.1.30.2 24 [SwitchA-Vlanif300] quit
[SwitchA] nqa test-instance user test1 [SwitchA-nqa-user-test1] test-type icmp [SwitchA-nqa-user-test1] destination-address ipv4 10.1.10.1 [SwitchA-nqa-user-test1] frequency 11 [SwitchA-nqa-user-test1] probe-count 2 [SwitchA-nqa-user-test1] interval seconds 5 [SwitchA-nqa-user-test1] timeout 4 [SwitchA-nqa-user-test1] start now [SwitchA-nqa-user-test1] quit [SwitchA] nqa test-instance user test2 [SwitchA-nqa-user-test2] test-type icmp [SwitchA-nqa-user-test2] destination-address ipv4 10.1.20.1 [SwitchA-nqa-user-test2] frequency 11 [SwitchA-nqa-user-test2] probe-count 2 [SwitchA-nqa-user-test2] interval seconds 5 [SwitchA-nqa-user-test2] timeout 4 [SwitchA-nqa-user-test2] start now [SwitchA-nqa-user-test2] quit
[SwitchA] ip route-static 0.0.0.0 0.0.0.0 10.1.10.1 track nqa user test1 [SwitchA] ip route-static 0.0.0.0 0.0.0.0 10.1.20.1 track nqa user test2
# Check the configuration of NQA for default static routes. The command output shows that the default static routes have been bound to NQA test instances.
[SwitchA] display current-configuration | include nqa
ip route-static 0.0.0.0 0.0.0.0 10.1.10.1 track nqa user test1
ip route-static 0.0.0.0 0.0.0.0 10.1.20.1 track nqa user test2
nqa test-instance user test1
nqa test-instance user test2
# Check NQA test results.
[SwitchA] display nqa results test-instance user test1
NQA entry(user, test1) :testflag is active ,testtype is icmp
1 . Test 10 result The test is finished
Send operation times: 2 Receive response times: 2
Completion:success RTD OverThresholds number: 0
Attempts number:1 Drop operation number:0
Disconnect operation number:0 Operation timeout number:0
System busy operation number:0 Connection fail number:0
Operation sequence errors number:0 RTT Status errors number:0
Destination ip address:10.1.10.1
Min/Max/Average Completion Time: 30/30/30
Sum/Square-Sum Completion Time: 7/25
Last Good Probe Time: 2014-09-09 09:55:38.2
Lost packet ratio: 0 %
[SwitchA] display nqa results test-instance user test2
NQA entry(user, test2) :testflag is active ,testtype is icmp
1 . Test 11 result The test is finished
Send operation times: 2 Receive response times: 2
Completion:success RTD OverThresholds number: 0
Attempts number:1 Drop operation number:0
Disconnect operation number:0 Operation timeout number:0
System busy operation number:0 Connection fail number:0
Operation sequence errors number:0 RTT Status errors number:0
Destination ip address:10.1.20.1
Min/Max/Average Completion Time: 30/30/30
Sum/Square-Sum Completion Time: 7/25
Last Good Probe Time: 2014-09-09 09:56:38.2
Lost packet ratio: 0 %
Completion:success and Lost packet ratio: 0 % in the command output show that the links between SwitchA and RouterA and between SwitchA and RouterB are normal.
# Check the routing table. The command output shows that there are two default static routes destined for RouterA and RouterB, respectively.
[SwitchA] display ip routing-table Route Flags: R - relay, D - download to fib, T - to vpn-instance ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 9 Routes : 10 Destination/Mask Proto Pre Cost Flags NextHop Interface 0.0.0.0/0 Static 60 0 RD 10.1.10.1 Vlanif100 Static 60 0 RD 10.1.20.1 Vlanif200 10.1.10.0/24 Direct 0 0 D 10.1.10.2 Vlanif100 10.1.10.2/32 Direct 0 0 D 127.0.0.1 Vlanif100 10.1.20.0/24 Direct 0 0 D 10.1.20.2 Vlanif200 10.1.20.2/32 Direct 0 0 D 127.0.0.1 Vlanif200 10.1.30.0/24 Direct 0 0 D 10.1.30.2 Vlanif300 10.1.30.2/32 Direct 0 0 D 127.0.0.1 Vlanif300 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
# Shut down GigabitEthernet0/0/2 on SwitchA to simulate a link fault.
[SwitchA] interface GigabitEthernet0/0/2 [SwitchA-GigabitEthernet0/0/2] shutdown [SwitchA-GigabitEthernet0/0/2] quit
# Check NQA test results.
[SwitchA] display nqa results test-instance user test1
NQA entry(user, test1) :testflag is active ,testtype is icmp
1 . Test 12 result The test is finished
Send operation times: 2 Receive response times: 2
Completion:success RTD OverThresholds number: 0
Attempts number:1 Drop operation number:0
Disconnect operation number:0 Operation timeout number:0
System busy operation number:0 Connection fail number:0
Operation sequence errors number:0 RTT Status errors number:0
Destination ip address:10.1.10.1
Min/Max/Average Completion Time: 30/30/30
Sum/Square-Sum Completion Time: 7/25
Last Good Probe Time: 2014-09-09 09:57:38.2
Lost packet ratio: 0 %
[SwitchA] display nqa results test-instance user test2
NQA entry(user, test2) :testflag is active ,testtype is icmp
1 . Test 13 result The test is finished
Send operation times: 2 Receive response times: 0
Completion:failed RTD OverThresholds number: 0
Attempts number:1 Drop operation number:0
Disconnect operation number:0 Operation timeout number:2
System busy operation number:0 Connection fail number:0
Operation sequence errors number:0 RTT Status errors number:0
Destination ip address:10.1.20.1
Min/Max/Average Completion Time: 0/0/0
Sum/Square-Sum Completion Time: 0/0
Last Good Probe Time: 2014-09-09 09:58:38.2
Lost packet ratio: 100 %
Completion:failed and Lost packet ratio: 100 % in the command output show that the link between SwitchA and RouterB is faulty.
# Check the routing table. Only the default static route to RouterA is available.
[SwitchA] display ip routing-table Route Flags: R - relay, D - download to fib, T - to vpn-instance ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 7 Routes : 7 Destination/Mask Proto Pre Cost Flags NextHop Interface 0.0.0.0/0 Static 60 0 RD 10.1.10.1 Vlanif100 10.1.10.0/24 Direct 0 0 D 10.1.10.2 Vlanif100 10.1.10.2/32 Direct 0 0 D 127.0.0.1 Vlanif100 10.1.30.0/24 Direct 0 0 D 10.1.30.2 Vlanif300 10.1.30.2/32 Direct 0 0 D 127.0.0.1 Vlanif300 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
# sysname SwitchA # vlan batch 100 200 300 # interface Vlanif100 ip address 10.1.10.2 255.255.255.0 # interface Vlanif200 ip address 10.1.20.2 255.255.255.0 # interface Vlanif300 ip address 10.1.30.2 255.255.255.0 # interface GigabitEthernet0/0/1 port link-type trunk port trunk allow-pass vlan 100 # interface GigabitEthernet0/0/2 port link-type trunk port trunk allow-pass vlan 200 # interface GigabitEthernet0/0/3 port link-type trunk port trunk allow-pass vlan 300 # ip route-static 0.0.0.0 0.0.0.0 10.1.10.1 track nqa user test1 ip route-static 0.0.0.0 0.0.0.0 10.1.20.1 track nqa user test2 # nqa test-instance user test1 test-type icmp destination-address ipv4 10.1.10.1 frequency 11 interval seconds 5 timeout 4 probe-count 2 start now # nqa test-instance user test2 test-type icmp destination-address ipv4 10.1.20.1 frequency 11 interval seconds 5 timeout 4 probe-count 2 start no # return