分支 F1020 + 总部 F1060 IPSec VPN(分支流量走总部统一上网)完整配置
组网逻辑
分支内网 → 分支 F1020 → IPSec 隧道 → 总部 F1060 → 总部 NAT 上网 → 互联网
隧道承载:分支全部内网流量(全流量 VPN,包括上网流量)
网段规划示例(可替换为现场实际网段)
分支内网:192.168.2.0/24
总部内网:192.168.1.0/24
分支公网接口 G0:203.0.113.10(F1020 公网 IP)
总部公网接口 G0:203.0.113.1(F1060 公网 IP)
一、总部防火墙 F1060 完整配置
1. 基础接口与安全域
bash
运行
system-view
# 公网接口(对接运营商)
interface GigabitEthernet 0
port link-mode route
nat outbound
ip address 203.0.113.1 255.255.255.0
security-zone Internet
# 内网接口(总部局域网)
interface GigabitEthernet 1
port link-mode route
ip address 192.168.1.1 255.255.255.0
security-zone Trust
# 安全域放行基础策略
security-zone Trust
import route-static
security-zone Internet
import route-static
2. IKE 协商(预共享密钥认证)
bash
运行
# 1. 创建IKE提议
ike proposal 10
encryption-algorithm aes-256
authentication-algorithm sha2-256
dh group14
# 2. IKE对等体(对端分支公网IP)
ike peer branch pre-shared-key simple Test@123456
ike-proposal 10
remote-ip 203.0.113.10
# 3. IPSec提议
ipsec proposal 10
esp encryption-algorithm aes-256
esp authentication-algorithm sha2-256
# 4. IPSec策略模板(接收分支主动发起隧道)
ipsec policy-template temp1 10
proposal 10
remote-peer ike-peer branch
security acl 3000
# 5. IPSec策略绑定模板
ipsec policy map1 10 isakmp template temp1
# 6. 公网接口绑定IPSec策略
interface GigabitEthernet 0
ipsec apply policy map1
3. ACL:定义隧道流量(分支所有网段)
bash
运行
acl number 3000
rule permit ip source any destination any
# 含义:匹配分支所有流量(内网互访+上网流量全部进隧道)
4. 核心:分支流量总部 NAT 上网(VPN 流量出公网做源地址转换)
bash
运行
# 地址池,总部出口公网地址池
nat address-group 1 203.0.113.1 203.0.113.1
# 策略:隧道过来的分支流量访问互联网时做NAT
acl number 3001
rule permit ip source 192.168.2.0 0.0.0.255 destination any
nat policy
create rule 10 permit source 192.168.2.0 0.0.0.255 destination any nat address-group 1
5. 安全策略放行
bash
运行
security-policy
# 1. 允许VPN隧道流量访问互联网
rule 10 permit source 192.168.2.0 0.0.0.255 destination any zone Internet
# 2. 允许总部内网与分支内网互访(按需)
rule 20 permit source 192.168.1.0 0.0.0.255 destination 192.168.2.0 0.0.0.255 zone Trust
# 3. 放行IKE/ESP VPN协议(公网接口)
rule 99 permit protocol udp destination-port 500 zone Internet local
rule 100 permit protocol udp destination-port 4500 zone Internet local
rule 101 permit protocol esp zone Internet local
6. 静态路由:分支网段路由指向隧道
bash
运行
ip route-static 192.168.2.0 255.255.255.0 ipsec-map map1
二、分支机构防火墙 F1020 完整配置
1. 接口与安全域
bash
运行
system-view
# 公网接口
interface GigabitEthernet 0
port link-mode route
ip address 203.0.113.10 255.255.255.0
security-zone Internet
# 内网接口(分支局域网)
interface GigabitEthernet 1
port link-mode route
ip address 192.168.2.1 255.255.255.0
security-zone Trust
2. IKE + IPSec 协商配置(主动发起隧道)
bash
运行
# IKE提议(和总部一致)
ike proposal 10
encryption-algorithm aes-256
authentication-algorithm sha2-256
dh group14
# IKE对等体,指定总部公网IP
ike peer headquarters pre-shared-key simple Test@123456
ike-proposal 10
remote-ip 203.0.113.1
# IPSec提议(和总部一致)
ipsec proposal 10
esp encryption-algorithm aes-256
esp authentication-algorithm sha2-256
# IPSec策略
ipsec policy map1 10 isakmp
proposal 10
remote-peer ike-peer headquarters
security acl 3000
# 公网接口绑定策略
interface GigabitEthernet 0
ipsec apply policy map1
3. ACL:匹配分支全部内网流量进入 VPN 隧道
bash
运行
acl number 3000
rule permit ip source 192.168.2.0 0.0.0.255 destination any
# 所有分支流量(访问总部内网、访问互联网)全部封装进IPSec隧道
4. 路由:全流量转发至 VPN 隧道(关键实现总部统一出口)
bash
运行
# 默认路由全部走IPSec隧道,所有流量发给总部处理
ip route-static 0.0.0.0 0 ipsec-map map1
5. 安全策略放行
bash
运行
security-policy
# 内网所有流量允许进入VPN隧道
rule 10 permit source 192.168.2.0 0.0.0.255 destination any zone Internet
# 放行VPN协商协议
rule 99 permit protocol udp destination-port 500 zone Internet local
rule 100 permit protocol udp destination-port 4500 zone Internet local
rule 101 permit protocol esp zone Internet local
6. 分支本地无需 NAT!
所有上网流量封装到隧道后,在总部防火墙统一做 NAT 转换,分支不需要配置互联网 NAT 策略。
三、验证与排错命令
1. 隧道状态查看
bash
运行
display ike sa
display ipsec sa
成功建立会显示 ESTABLISHED 状态。
2. 路由验证
bash
运行
display ip routing-table
# 分支存在默认路由指向ipsec-map;总部存在分支明细路由指向ipsec-map
3. 流量抓包排查
bash
运行
debugging ipsec packet
debugging ike packet
terminal debugging
terminal monitor
四、关键注意点
密钥、加密算法、DH 组两端必须完全一致,否则 IKE 协商失败;
分支默认路由指向 IPSec 隧道是实现「总部统一出口上网」的核心;
总部必须对分支网段配置 NAT 地址池,否则分支流量出互联网无公网地址;
两端公网防火墙 / 运营商不得拦截 UDP500、UDP4500、ESP 协议;
若分支公网为 DHCP 动态 IP:总部 IPSec 策略模板无需写固定 remote-ip,适配动态分支。
参考案例:

功能需求:
1、分支通过ipsec vpn访问内网资源
2、分支通过ipsec vpn到总部来访问外网
(1) 总部配置
#
interface GigabitEthernet0/0
port link-mode route
combo enable copper
ip address 1.1.1.1 255.255.255.0
nat outbound 3001
ipsec apply policy map1
#
interface GigabitEthernet0/2
port link-mode route
combo enable copper
ip address 192.168.1.1 255.255.255.0
#
ip route-static 0.0.0.0 0 1.1.1.2
#
acl advanced 3000
rule 0 permit ip destination 192.168.2.0 0.0.0.255
#
acl advanced 3001
rule 0 deny ip destination 192.168.2.0 0.0.0.255
rule 10 permit ip
#
ipsec transform-set tran1
esp encryption-algorithm aes-cbc-128
esp authentication-algorithm sha1
#
ipsec policy map1 10 isakmp
transform-set tran1
security acl 3000
local-address 1.1.1.1
remote-address 2.2.2.2
ike-profile profile1
#
ike profile profile1
keychain keychain1
match remote identity address 2.2.2.2 255.255.255.0
#
ike keychain keychain1
pre-shared-key address 2.2.2.2 255.255.255.0 key cipher $c$3$OZlydjTJAKne46C3JSeRRzaQBQODJw==
#
return
(2)分支配置
#
interface GigabitEthernet0/1
port link-mode route
combo enable copper
ip address 2.2.2.2 255.255.255.0
ipsec apply policy use1
#
interface GigabitEthernet0/2
port link-mode route
combo enable copper
ip address 192.168.2.1 255.255.255.0
#
ip route-static 0.0.0.0 0 2.2.2.1
#
acl advanced 3000
rule 0 permit ip source 192.168.2.0 0.0.0.255
#
ipsec transform-set tran1
esp encryption-algorithm aes-cbc-128
esp authentication-algorithm sha1
#
ipsec policy use1 10 isakmp
transform-set tran1
security acl 3000
local-address 2.2.2.2
remote-address 1.1.1.1
ike-profile profile1
#
ike profile profile1
keychain keychain1
match remote identity address 1.1.1.1 255.255.255.0
#
ike keychain keychain1
pre-shared-key address 1.1.1.1 255.255.255.0 key cipher $c$3$P/Rehq/mlfZ30RSn8GlrWYPY7EM9LA==
#
return
(1)分支感兴趣流只匹配源地址为本端私网地址,目的地址为any;总部感兴趣流只匹配目的地址为对端私网地址,源地址为any;
(2)总部nat中调用的acl注意先把ipsec感兴趣流deny掉。
你好,我现在是遇到省市县三层机构集中到省级机关同意一个互联网出口的情况,省级是F1060,市级是F1020,县级是华为的USG 6525E防火墙,目前按照你的方法实现了市级到省级的统一出口,但是未能实现县级到省级的统一。
你好,我现在是遇到省市县三层机构集中到省级机关同意一个互联网出口的情况,省级是F1060,市级是F1020,县级是华为的USG 6525E防火墙,目前按照你的方法实现了市级到省级的统一出口,但是未能实现县级到省级的统一。
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作
举报
×
侵犯我的权益
×
侵犯了我企业的权益
×
抄袭了我的内容
×
原文链接或出处
诽谤我
×
对根叔社区有害的内容
×
不规范转载
×
举报说明