IPsec 分两个阶段:IKE 协商加密、认证和密钥,ESP 保护实际数据。IKEv1 与 IKEv2 的配置结构和报文不同,新部署优先 IKEv2;IKEv2 常用 UDP 500,检测到 NAT 后转 UDP 4500,ESP 是 IP 协议号 50。感兴趣流(interesting traffic)由 ACL、路由或策略指定,两端必须对称。
修改 crypto map、IPsec policy、profile 或感兴趣流会重建或拆除现有隧道,业务会中断。变更前备份配置并确认对端可配合,回滚是恢复原配置并清理旧 SA;clear crypto sa / reset ipsec sa 会主动拆除 SA,属于破坏性操作,避开业务高峰。Cisco 示例假设已定义 IKEv2 policy、keyring KR 和 transform-set TS。以设备版本为准。
Cisco IOS/IOS-XE(IKEv2 + tunnel protection)
crypto ikev2 proposal P1
encryption aes-cbc-256
integrity sha256
group 14
crypto ikev2 profile PROF
match identity remote address 198.51.100.2 255.255.255.255
authentication remote pre-share
authentication local pre-share
keyring local KR
crypto ipsec profile IPSEC-PROF
set transform-set TS
set ikev2-profile PROF
interface Tunnel0
tunnel protection ipsec profile IPSEC-PROF
show crypto ikev2 sa
Huawei VRP
ike proposal 1
encryption-algorithm aes-256
authentication-algorithm sha2-256
dh group14
ike peer PEER1
remote-address 198.51.100.2
pre-shared-key cipher <placeholder>
ike-proposal 1
ipsec proposal IPSEC1
esp encryption-algorithm aes-256
esp authentication-algorithm sha2-256
ipsec policy POLICY1 10 isakmp
security acl 3000
ike-peer PEER1
proposal IPSEC1
interface GigabitEthernet0/0/0
ipsec policy POLICY1
display ike sa
H3C Comware 用 ike proposal、ike keychain、ike profile、ipsec transform-set 和 ipsec policy;Junos 用 security ike、security ipsec vpn 与 st0 接口。两端算法、DH 组、认证方式和身份标识必须匹配,以设备版本为准。
192.0.2.0/24,另一端写成 /32 也会失败。合上页面,先回答,再展开对照。
小程序版
微信扫码,随时查命令