3.1配置防火墙基本上网
# 外网接口G1/0/1配置运营商给的静态ip地址
interface GigabitEthernet1/0/1
ip address 198.76.28.30 255.255.255.252
nat outbound
# 外网接口G1/0/2配置运营商给的静态ip地址
interface GigabitEthernet1/0/2
ip address 198.77.28.30 255.255.255.252
nat outbound
# 内网接口G1/0/3配置自定义的内网静态ip地址
interface GigabitEthernet1/0/2
ip address 192.168.2.1 255.255.255.0
#将内网接口加入trust域
security-zone name trust
import
interface GigabitEthernet1/0/3
#将两个外网接口分别加入untrust1和untrust2域
security-zone name Untrust1
import
interface GigabitEthernet1/0/1
security-zone name Untrust2
import
interface GigabitEthernet1/0/2
#配置安全策略
security-policy ip
rule 0 name
trust-untrust (放通内网到外网的访问)
action pass
source-zone
trust
destination-zone untrust1
destination-zone untrust2
rule 1 name
per-nqa (放通local安全域到外网探测地址114.114.114.114的访问,如不配置则无法正常使用nqa探测外网地址)
action
pass
source-zone
local
destination-zone untrust1
destination-zone untrust2
destination-ip-host 114.114.114.114
3.2 配置链路检测
#创建管理员名为admin、操作标签为test的NQA测试组
[H3C]nqa entry admin test
#配置测试类型为ICMP-echo,ICMP-echo测试利用ICMP协议,根据是否接收到应答报文判断目的端设备的可达性。ICMP-echo测试的功能与ping命令类似,但ICMP-echo测试中可以指定测试的下一跳设备。在源端和目的端设备之间存在多条路径时,通过配置下一跳设备可以指定测试的路径
[H3C-nqa-admin-test-icmp-echo] type icmp-echo
配置监测公网的任意地址如114.114.114.114等,这样就可以规避掉运营商本身出现网络故障的风险
[H3C-nqa-admin-test-icmp-echo] destination ip
114.114.114.114
#配置测试组连续两次测试的时间间隔为3000ms
[H3C-nqa-admin-test-icmp-echo] frequency 3000
#配置探测报文的下一跳IP地址,这个一般在探测的目的地址不是网关地址的时候建议配置,本案例探测的目的地址是直连网关地址,可以不配置下一跳地址
[H3C-nqa-admin-test-icmp-echo] next-hop 198.76.28.29
#配置联动项1(连续失败3次触发联动)
[H3C-nqa-admin-test-icmp-echo] reaction 1
checked-element probe-fail threshold-type consecutive 3 action-type
trigger-only
[H3C-nqa-admin-test-icmp-echo]quit
#启动探测
[H3C] nqa schedule admin test start-time now lifetime
forever
#配置Track项1,关联NQA测试组(管理员为admin,操作标签为test)的联动项1
[H3C] track 1 nqa entry admin test reaction 1
3.3配置静态路由
# 进入系统视图,配置两条默认路由,并且修改G1.0.2线路的默认路由优先级为80(默认路由优先级为60,值越大优先级越低)。设备固定IP上网路由与Track项1关联,作为主用路由。实现正常情况下流量全部从WAN1出去,链路出现故障时可切换到WAN2。
[H3C]ip
route-static 0.0.0.0 0 198.76.28.29 track 1
[H3C]ip route-static 0.0.0.0 0 198.77.28.29 preference
80
[H3C]save force
# 两条链路都正常的时候track项状态为positive,路由也是走优先级为60的G1/0/1。
[H3C]display track all
Track ID: 1
State:
Positive
Duration: 0
days 0 hours 1 minutes 35 seconds
Tracked object
type: NQA
Notification
delay: Positive 0, Negative 0 (in seconds)
Tracked
object:
NQA entry:
admin test
Reaction: 1
Remote
IP/URL: 114.114.114.114
Local IP:
--
Interface:
--
[H3C]display ip
routing-table
Destinations : 17
Routes : 17
Destination/Mask Proto
Pre Cost NextHop Interface
0.0.0.0/0
Static 60 0
198.76.28.29 GE1/0/1
0.0.0.0/32
Direct 0
0 127.0.0.1 InLoop0
127.0.0.0/8
Direct 0 0
127.0.0.1 InLoop0
127.0.0.0/32
Direct 0 0
127.0.0.1 InLoop0
127.0.0.1/32
Direct 0 0
127.0.0.1 InLoop0
127.255.255.255/32 Direct 0
0 127.0.0.1 InLoop0
198.76.28.28/30
Direct 0 0
198.76.28.30 GE1/0/1
198.76.28.28/32
Direct 0 0
198.76.28.30 GE1/0/1
198.76.28.30/32
Direct 0 0
127.0.0.1 InLoop0
198.76.28.31/32
Direct 0 0
198.76.28.30 GE1/0/1
198.77.28.28/30
Direct 0 0
198.77.28.30 GE1/0/2
198.77.28.28/32
Direct 0 0
198.77.28.30 GE1/0/2
198.77.28.30/32
Direct 0 0
127.0.0.1 InLoop0
198.77.28.31/32
Direct 0 0
198.77.28.30 GE1/0/2
224.0.0.0/4
Direct 0 0
0.0.0.0 NULL0
224.0.0.0/24
Direct 0 0
0.0.0.0 NULL0
255.255.255.255/32 Direct 0
0 127.0.0.1 InLoop0
# 当G1/0/1侧运营商链路有问题时,设备上可以很快检测到,此时查看track项状态为Negative,查看路由发现走的是G1/0/2。
%Jan 24 15:38:01:238 2021 H3C
NQA/6/NQA_ENTRY_PROBE_RESULT: -Context=1; Reaction entry 1 of NQA entry
admin-name admin operation-tag test: probe-fail.
[H3C]display track all
Track ID: 1
State:
Negative
Duration: 0
days 0 hours 0 minutes 4 seconds
Tracked object
type: NQA
Notification
delay: Positive 0, Negative 0 (in seconds)
Tracked
object:
NQA entry:
admin test
Reaction: 1
Remote
IP/URL: 114.114.114.114
Local IP:
--
Interface: --
[H3C]display ip routing-table
Destinations : 14
Routes : 14
Destination/Mask
Proto Pre Cost NextHop Interface
0.0.0.0/0 Static 80
0 198.77.28.29 GE1/0/2
0.0.0.0/32
Direct 0 0
127.0.0.1 InLoop0
127.0.0.0/8
Direct 0 0
127.0.0.1 InLoop0
127.0.0.0/32
Direct 0 0
127.0.0.1 InLoop0
127.0.0.1/32
Direct 0 0
127.0.0.1 InLoop0
127.255.255.255/32 Direct 0
0 127.0.0.1 InLoop0
198.76.28.30/32
Direct 1 0
0.0.0.0 NULL0
198.77.28.28/30
Direct 0 0
198.77.28.30 GE1/0/2
198.77.28.28/32
Direct 0 0
198.77.28.30 GE1/0/2
198.77.28.30/32
Direct 0 0
127.0.0.1 InLoop0
198.77.28.31/32
Direct 0 0
198.77.28.30 GE1/0/2
224.0.0.0/4
Direct 0 0
0.0.0.0 NULL0
224.0.0.0/24
Direct 0 0
0.0.0.0 NULL0
255.255.255.255/32 Direct 0
0 127.0.0.1 InLoop0
# 当G1/0/1运营商链路恢复时设备也能很快检测到并切换为主链路。
%Jan 24 15:38:16:834 2021 H3C
NQA/6/NQA_ENTRY_PROBE_RESULT: -Context=1; Reaction entry 1 of NQA entry
admin-name admin operation-tag test: probe-pass.
[H3C]display track all
Track ID: 1
State:
Positive
Duration: 0
days 0 hours 0 minutes 2 seconds
Tracked object
type: NQA
Notification
delay: Positive 0, Negative 0 (in seconds)
Tracked
object:
NQA entry:
admin test
Reaction: 1
Remote
IP/URL: 114.114.114.114
Local IP:
--
Interface:
--
[H3C]display ip routing-table
Destinations : 17
Routes : 17
Destination/Mask
Proto Pre Cost NextHop Interface
0.0.0.0/0 Static 60
0 198.76.28.29 GE1/0/1
0.0.0.0/32
Direct 0 0
127.0.0.1 InLoop0
127.0.0.0/8
Direct 0 0
127.0.0.1 InLoop0
127.0.0.0/32
Direct 0 0
127.0.0.1 InLoop0
127.0.0.1/32
Direct 0 0
127.0.0.1 InLoop0
127.255.255.255/32 Direct 0
0 127.0.0.1 InLoop0
198.76.28.28/30
Direct 0 0
198.76.28.30 GE1/0/1
198.76.28.28/32
Direct 0 0
198.76.28.30 GE1/0/1
198.76.28.30/32
Direct 0 0 127.0.0.1 InLoop0
198.76.28.31/32
Direct 0 0
198.76.28.30 GE1/0/1
198.77.28.28/30
Direct 0 0
198.77.28.30 GE1/0/2
198.77.28.28/32
Direct 0 0
198.77.28.30 GE1/0/2
198.77.28.30/32
Direct 0 0
127.0.0.1 InLoop0
198.77.28.31/32
Direct 0 0
198.77.28.30 GE1/0/2
224.0.0.0/4
Direct 0 0
0.0.0.0 NULL0
224.0.0.0/24
Direct 0 0
0.0.0.0 NULL0
255.255.255.255/32 Direct 0
0 127.0.0.1 InLoop0
该案例暂时没有网友评论
✖
案例意见反馈
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作