IPSec 使用附加 IP 时隧道无法建立
2026/3/16IPSec VPN排错7.X.X大约 2 分钟
IPSec 使用附加 IP 时隧道无法建立
问题现象
在本端 FortiGate 的接口 wan1(
202.1.1.2)上配置了附加 IP(Secondary IP)202.1.1.3。config system interface edit "wan1" set vdom "root" set ip 202.1.1.2 255.255.255.0 config secondaryip edit 1 set ip 202.1.1.3 255.255.255.0 next end next endIPSec 连接绑定接口为 wan1。
config vpn ipsec phase1-interface edit "IPSec_Dialup" set type dynamic set interface "wan1" set ike-version 2 ...... next end config vpn ipsec phase2-interface edit "IPSec_Dialup" set phase1name "IPSec_Dialup" set replay disable next end对端设备将 VPN 隧道的 Remote Gateway 配置为该附加 IP(
202.1.1.3)时,隧道无法正常建立,开启 IKE Debug 后出现no proposal chosen报错(即使对端发起的安全提议和本端配置的安全提议完全一致):comes 39.183.172.30:64916->202.1.1.3:500,ifindex=41,vrf=0,len=373.... ...... ike V=root:0:93bce19daab14410/0000000000000000:3056: incoming proposal: ike V=root:0:93bce19daab14410/0000000000000000:3056: proposal id = 1: ike V=root:0:93bce19daab14410/0000000000000000:3056: protocol = IKEv2: ike V=root:0:93bce19daab14410/0000000000000000:3056: encapsulation = IKEv2/none ike V=root:0:93bce19daab14410/0000000000000000:3056: type=ENCR, val=AES_CBC (key_len = 128) ike V=root:0:93bce19daab14410/0000000000000000:3056: type=INTEGR, val=AUTH_HMAC_SHA_96 ike V=root:0:93bce19daab14410/0000000000000000:3056: type=PRF, val=PRF_HMAC_SHA ike V=root:0:93bce19daab14410/0000000000000000:3056: type=DH_GROUP, val=ECP384. ...... ike V=root:0:93bce19daab14410/0000000000000000:3056: my proposal, gw IPSec_Dialup: ike V=root:0:93bce19daab14410/0000000000000000:3056: proposal id = 1: ike V=root:0:93bce19daab14410/0000000000000000:3056: protocol = IKEv2: ike V=root:0:93bce19daab14410/0000000000000000:3056: encapsulation = IKEv2/none ike V=root:0:93bce19daab14410/0000000000000000:3056: type=ENCR, val=AES_CBC (key_len = 128) ike V=root:0:93bce19daab14410/0000000000000000:3056: type=INTEGR, val=AUTH_HMAC_SHA_96 ike V=root:0:93bce19daab14410/0000000000000000:3056: type=PRF, val=PRF_HMAC_SHA ike V=root:0:93bce19daab14410/0000000000000000:3056: type=DH_GROUP, val=ECP384. ike V=root:0:93bce19daab14410/0000000000000000:3056: lifetime=86400 ...... ike V=root:0:93bce19daab14410/0000000000000000:3056: no proposal chosen
问题原因
- FortiGate 默认使用接口的主 IP 进行 IKE 协商,当需要使用附加 IP 建立 VPN 隧道时,必须在 Phase 1 配置中通过
local-gw参数显式指定。 - 当对端发起到附加 IP 的 VPN 连接时,本端 FortiGate 仍会尝试用主 IP 进行协商,导致 IP 地址不匹配,最终报
no proposal chosen错误。
解决方法
在 IPSec 一阶段配置中,通过
local-gw显式指定附加 IP,使 FortiGate 使用该 IP 进行 IKE 协商:重要
local-gw指定的 IP 必须已在对应接口上完成配置(主 IP 或附加 IP 均可)。
config vpn ipsec phase1-interface edit "IPSec_Dialup" set interface "wan1" set local-gw 202.1.1.3 next end配置完成后,对端与 FortiGate 建立 IPSec 时,IKE Debug 中显示协商成功:
...... ike V=root: SA proposal chosen, matched gateway IPSec_Dialup ike V=root:0:Tunnel1:Tunnel1: created connection: 0xb5be700 9 39.183.172.30->202.1.1.3:1012