华为QUIDWAY系列路由器的负载均衡配置

作者:邓聪聪

华为系列路由器的负载均衡NQA联动侦测配置案例:

华为QUIDWAY系列路由器的负载均衡配置

需求:该局域网,IP地址(末位奇数)走联通,IP地址(末位偶数)走电信当某个运营商不可达时,自动切换。通过NQA来确定运营商是否可达。,并与流行为、静态路由联动,实现自动切换。默认路由走联通,当联通不可达切至电信(配置的路由优先级,华为交换机静态路由默认优先级为60)

配置详情:

内网核心路由器配置;

<Huawei>dis cu
[V200R003C00]
#
snmp-agent local-engineid 800007DB03000000000000
snmp-agent
#
clock timezone China-Standard-Time minus ::
#
portal local-server load portalpage.zip
#
drop illegal-mac alarm
#
set cpu-usage threshold restore
#
bfd
#
acl number
description To-Unicom
rule permit source 192.168.0.0 0.0.0.255
acl number
description To-Telecom
rule permit source 192.168.1.0 0.0.0.255
#
acl number
description NAT
rule permit ip source 192.168.0.0 0.0.1.255
#
traffic classifier DX operator and
if-match acl
traffic classifier LT operator and
if-match acl
#
traffic behavior DX
redirect ip-nexthop 20.1.1.1 track nqa test DX
traffic behavior LT
redirect ip-nexthop 10.1.1.1 track nqa test LT
#
traffic policy load
classifier LT behavior LT
classifier DX behavior DX
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher %$%$K8m.Nt84DZ}e#<`8bmE3Uw}%$%$
local-user admin service-type http
#
firewall zone Local
priority
#
interface GigabitEthernet0//
ip address 10.1.1.2 255.255.255.252
nat outbound
#
interface GigabitEthernet0//
ip address 20.1.1.2 255.255.255.252
nat outbound
#
interface GigabitEthernet0//
ip address 10.16.0.1 255.255.255.252
traffic-policy load inbound
#
interface NULL0
#
bfd lt bind peer-ip 10.1.1.1 interface GigabitEthernet0// source-ip 10.1.1.2 o
ne-arm-echo
discriminator local
min-echo-rx-interval
commit
#
ip route-static 0.0.0.0 0.0.0.0 20.1.1.1 preference
ip route-static 0.0.0.0 0.0.0.0 10.1.1.1 track nqa test LT
ip route-static 192.168.0.0 255.255.254.0 10.16.0.2
ip route-static 202.106.0.30 255.255.255.255 10.1.1.1
ip route-static 219.141.140.10 255.255.255.255 20.1.1.1
#
nqa test-instance test DX
test-type icmp
destination-address ipv4 219.141.140.10
frequency
probe-count
start now
nqa test-instance test LT
test-type icmp
destination-address ipv4 202.106.0.30
frequency
probe-count
start now
#
user-interface con
authentication-mode password
user-interface vty
user-interface vty
#
wlan ac
#
return
<Huawei>

内网汇聚设备配置;

[Huawei]dis cu
#
sysname Huawei
#
vlan batch
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
diffserv domain default
#
drop-profile default
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password simple admin
local-user admin service-type http
#
interface Vlanif1
ip address 192.168.0.1 255.255.254.0
#
interface Vlanif10
ip address 10.16.0.2 255.255.255.252
#
interface MEth0//
#
interface GigabitEthernet0//
#
interface GigabitEthernet0//
#
interface GigabitEthernet0//
port link-type access
port default vlan
#
interface GigabitEthernet0//
#
interface GigabitEthernet0//
#
interface GigabitEthernet0//
#
interface GigabitEthernet0//
#
interface GigabitEthernet0//
#
interface GigabitEthernet0//
#
interface GigabitEthernet0//
#
interface GigabitEthernet0//
#
interface GigabitEthernet0//
#
interface GigabitEthernet0//
#
interface GigabitEthernet0//
#
interface GigabitEthernet0//
#
interface GigabitEthernet0//
#
interface GigabitEthernet0//
#
interface GigabitEthernet0//
#
interface GigabitEthernet0//
#
interface GigabitEthernet0//
#
interface GigabitEthernet0//
#
interface GigabitEthernet0//
#
interface GigabitEthernet0//
#
interface GigabitEthernet0//
#
interface NULL0
#
ip route-static 0.0.0.0 0.0.0.0 10.16.0.1
#
user-interface con
user-interface vty
#
return
[Huawei]

模拟运营商配置 unicom;

<Huawei>dis cu
#
sysname Huawei
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher OOCM4m($F4ajUn1vMEIBNUw#
local-user admin service-type http
#
firewall zone Local
priority
#
interface Ethernet0//
#
interface Ethernet0//
#
interface Serial0//
link-protocol ppp
#
interface Serial0//
link-protocol ppp
#
interface Serial0//
link-protocol ppp
#
interface Serial0//
link-protocol ppp
#
interface GigabitEthernet0//
ip address 1.1.1.1 255.255.255.252
#
interface GigabitEthernet0//
ip address 10.1.1.1 255.255.255.252
#
interface GigabitEthernet0//
#
interface GigabitEthernet0//
#
wlan
#
interface NULL0
#
interface LoopBack1
ip address 202.106.0.30 255.255.255.255
#
interface LoopBack12
ip address 202.106.0.100 255.255.255.255
#
ospf
import-route direct
area 0.0.0.0
network 1.1.1.0 0.0.0.3
network 202.106.0.0 0.0.0.255
#
user-interface con
user-interface vty
user-interface vty
#
return
<Huawei>

模拟运营商配置 telecom;

<Huawei>dis cu
#
sysname Huawei
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password cipher OOCM4m($F4ajUn1vMEIBNUw#
local-user admin service-type http
#
firewall zone Local
priority
#
interface Ethernet0//
#
interface Ethernet0//
#
interface Serial0//
link-protocol ppp
#
interface Serial0//
link-protocol ppp
#
interface Serial0//
link-protocol ppp
#
interface Serial0//
link-protocol ppp
#
interface GigabitEthernet0//
ip address 1.1.1.2 255.255.255.252
#
interface GigabitEthernet0//
#
interface GigabitEthernet0//
ip address 20.1.1.1 255.255.255.252
#
interface GigabitEthernet0//
#
wlan
#
interface NULL0
#
interface LoopBack1
ip address 219.141.140.10 255.255.255.255
#
ospf
import-route direct
area 0.0.0.0
network 1.1.1.0 0.0.0.3
#
nqa test-instance test
test-type icmp
destination-address ipv4 1.1.1.1
frequency
probe-count
start now
#
user-interface con
user-interface vty
user-interface vty
#
return
<Huawei>

模拟故障;修改unicom的 interface GigabitEthernet0/0/1端口配置,使其互联不可达,但链路状态依然up。

故障前路由表状态;

        0.0.0.0/0   Static  60   0          RD   10.1.1.1        GigabitEthernet
//
10.1.1.0/ Direct D 10.1.1.2 GigabitEthernet
//
10.1.1.2/ Direct D 127.0.0.1 GigabitEthernet
//
10.1.1.3/ Direct D 127.0.0.1 GigabitEthernet
//
10.16.0.0/ Direct D 10.16.0.1 GigabitEthernet
//
10.16.0.1/ Direct D 127.0.0.1 GigabitEthernet
//
10.16.0.3/ Direct D 127.0.0.1 GigabitEthernet
//
20.1.1.0/ Direct D 20.1.1.2 GigabitEthernet
//
20.1.1.2/ Direct D 127.0.0.1 GigabitEthernet
//
20.1.1.3/ Direct D 127.0.0.1 GigabitEthernet
//
127.0.0.0/ Direct D 127.0.0.1 InLoopBack0
127.0.0.1/ Direct D 127.0.0.1 InLoopBack0
127.255.255.255/ Direct D 127.0.0.1 InLoopBack0
192.168.0.0/ Static RD 10.16.0.2 GigabitEthernet
//
202.106.0.30/ Static RD 10.1.1.1 GigabitEthernet
//
219.141.140.10/ Static RD 20.1.1.1 GigabitEthernet
//
255.255.255.255/ Direct D 127.0.0.1 InLoopBack0

故障后路由表状态;

        0.0.0.0/0   Static  150  0          RD   20.1.1.1        GigabitEthernet
//
10.1.1.0/ Direct D 10.1.1.2 GigabitEthernet
//
10.1.1.2/ Direct D 127.0.0.1 GigabitEthernet
//
10.1.1.3/ Direct D 127.0.0.1 GigabitEthernet
//
10.16.0.0/ Direct D 10.16.0.1 GigabitEthernet
//
10.16.0.1/ Direct D 127.0.0.1 GigabitEthernet
//
10.16.0.3/ Direct D 127.0.0.1 GigabitEthernet
//
20.1.1.0/ Direct D 20.1.1.2 GigabitEthernet
//
20.1.1.2/ Direct D 127.0.0.1 GigabitEthernet
//
20.1.1.3/ Direct D 127.0.0.1 GigabitEthernet
//
127.0.0.0/ Direct D 127.0.0.1 InLoopBack0
127.0.0.1/ Direct D 127.0.0.1 InLoopBack0
127.255.255.255/ Direct D 127.0.0.1 InLoopBack0
192.168.0.0/ Static RD 10.16.0.2 GigabitEthernet
//
202.106.0.30/ Static RD 10.1.1.1 GigabitEthernet
//
219.141.140.10/ Static RD 20.1.1.1 GigabitEthernet
//
255.255.255.255/ Direct D 127.0.0.1 InLoopBack0

配置验证:

display ip routing-table   #用于查看当前设备的路由表状态

display nqa results test-instance test LT   #用于验证NQA的状态

上一篇:lua 怎样输出树状结构的table?


下一篇:OSPF与Vlan间通信综合实验小结与端口隔离