• 全部
  • 经验案例
  • 典型配置
  • 技术公告
  • FAQ
  • 漏洞说明
  • 全部
  • 全部
  • 大数据引擎
  • 知了引擎
产品线
搜索
取消
案例类型
发布者
是否解决
是否官方
时间
搜索引擎
匹配模式
高级搜索

WX2520 与wx2540 ipsec Ike 隧道模式vpn的配置问题。

2025-07-31提问
  • 0关注
  • 0收藏,209浏览
粉丝:0人 关注:0人

问题描述:

 

ipsec ike 隧道模式 vpn 的配置问题。

 

组网及组网描述:

 

我这里一台H3c WX2520x-li 与一台H3c WX2540x-Li 设备, 2520 是固定公网ip, 2540 拨号上网获取ip, 目前两台机器都能正常上网。 现在想在两台机器之间,配置 ipsec ike 隧道模式的vpn。 参照

https://www.h3c.com/cn/pub/Document_Center/2024/07/WebHelp_%20SecPath_FHQCP_DXPZALJ_V7_F9900_6W100/default_auto.htm?CHID=1160410

里的这一篇,CLI方式:基于路由建立IKE方式的IPsec隧道典型配置(网关之间存在NAT设备)做了配置。

2520 的配置如下:

ipsec transform-set transform20 

esp encryption-algorithm 3des-cbc 

esp authentication-algorithm md5 

#

 ipsec profile ipsec-profile20 isakmp 

transform-set transform20 

ike-profile ike-profile20 

#

 ike profile ike-profile20

 keychain ike-keychain20

 exchange-mode aggressive

 local-identity fqdn 2520.aa.bb

match remote identity fqdn 2540.aa.bb

#

 ike keychain ike-keychain20 pre-shared-key address 0.0.0.0 0.0.0.0 key cipher $c$3$aRWV2neeaIzKgiBEs4HfXxDFzJqHRAqXnA==

interface Tunnel1 mode ipsec 

ip address 7.7.7.20 255.255.255.0 

source 116.7.248.211 

tunnel protection ipsec profile ipsec-profile20

#

2540 的配置如下:

 

ipsec transform-set transform40

 esp encryption-algorithm 3des-cbc

 esp authentication-algorithm md5

#

ipsec profile ipsec-profile40 isakmp

 transform-set transform40

 ike-profile ike-profile40

#

ike profile ike-profile40

 keychain ike-keychian40

 exchange-mode aggressive

local-identity fqdn 2540.aa.bb

match remote identity fqdn 2520.aa.bb

#

ike keychain ike-keychain40

 pre-shared-key address 116.7.248.211 255.255.255.248 key cipher $c$3$PVonOoxDdOHtKP6tUY36ekiu4IR27zrACQ==

 

interface Tunnel1 mode ipsec

 ip address 7.7.7.40 255.255.255.0

 source Smartrate-Ethernet1/0/11

 destination 116.7.248.211

 tunnel protection ipsec profile ipsec-profile40

#

 

现在 的情况是:

ike sa 正常。  ipsec sa 没有显示, tunnel 1 一直是down的状态。 我现在不知道是哪里缺少配置, 还是哪里配错了。 

请抽空给予指点。 

 

2 个回答
zhl188 六段
粉丝:2人 关注:3人

缺 ipsec policy 和ACL


1.22.6  基于IPsec隧道接口建立保护IPv4报文的IPsec隧道

1. 组网需求

图1-16所示,某企业分支和总部均使用固定的IP地址接入Internet。现有如下组网要求:

·     企业分支与企业总部之间的所有流量通过IPsec安全隧道进行传送;

·     当企业分支的私网IP地址段调整时,不需要改变企业总部网关的IPsec配置。

为实现如上组网需求,可采用如下配置思路实现:

·     在Router A和Router B之间使用IPsec隧道接口建立IPsec连接,将发送给对端私网的数据流路由到IPsec虚拟隧道接口上,由IPsec虚拟隧道接口上动态协商建立的IPsec安全隧道对分支子网(10.1.1.0/24)与总部子网(10.1.2.0/24)之间的所有数据流进行安全保护。

2. 组网图

图1-16 基于IPsec隧道建立保护IPv4报文的IPsec隧道组网图

3. 配置Router A

说明

在开始下面的配置之前,请确保Router A的GE1/0/2接口和Router B的GE1/0/2接口之间IPv4报文路由可达。

 

(1)     请根据组网图中标识的接口IP地址,配置各接口的IP地址,具体配置步骤略

(2)     配置IPsec安全框架

# 创建IKE keychain abc并进入IKE keychain视图。

<RouterA> system-view

[RouterA] ike keychain abc

# 配置与地址为2.2.3.1的对端使用的预共享密钥为明文的123456TESTplat&!。

[RouterA-ike-keychain-abc] pre-shared-key address 2.2.3.1 255.255.255.0 key simple 123456TESTplat&!

[RouterA-ike-keychain-abc] quit

# 创建IKE profile abc,并进入其视图。

[RouterA] ike profile abc

# 在IKE profile abc中指定名称为abc的配置的IKE keychain。

[RouterA-ike-profile-abc] keychain abc

# 指定使用IP地址2.2.2.1标识本端身份。

[RouterA-ike-profile-abc] local-identity address 2.2.2.1

# 指定需要匹配对端身份类型为IP地址,取值为2.2.3.1。

[RouterA-ike-profile-abc] match remote identity address 2.2.3.1 24

# 配置IKE第一阶段协商使用野蛮模式。

[RouterA-ike-profile-abc] exchange-mode aggressive

[RouterA-ike-profile-abc] quit

# 创建名为abc的IPsec安全提议,并进入IPsec安全提议视图。

[RouterA] ipsec transform-set abc

# 在IPsec安全提议中配置ESP加密算法为CBC模式的AES算法,密钥长度为128比特。

[RouterA-ipsec-transform-set-abc] esp encryption-algorithm aes-cbc-128

# 在IPsec安全提议中配置ESP认证算法为HMAC-SHA1算法,密钥长度为160比特。

[RouterA-ipsec-transform-set-abc] esp authentication-algorithm sha1

[RouterA-ipsec-transform-set-abc] quit

# 配置名称为abc的IPsec安全框架,通过IKE协商建立安全联盟。

[RouterA] ipsec profile abc isakmp

# 配置IPsec安全框架引用名称为abc的IPsec安全提议。

[RouterA-ipsec-profile-isakmp-abc] transform-set abc

# 配置IPsec安全框架引用名称为abc的IKE profile。

[RouterA-ipsec-profile-isakmp-abc] ike-profile abc

[RouterA-ipsec-profile-isakmp-abc] quit

(3)     配置IPsec隧道接口

# 创建模式为IPsec隧道的接口Tunnel1。

[RouterA] interface tunnel 1 mode ipsec

# 配置Tunnel1接口的IP地址。

[RouterA-Tunnel1] ip address 3.3.3.1 255.255.255.0

# 配置Tunnel1接口的源端地址(GE1/0/2接口的IP地址)。

[RouterA-Tunnel1] source 2.2.2.1

# 配置Tunnel1接口的目的端地址(RouterB的GE1/0/2接口的IP地址)。

[RouterA-Tunnel1] destination 2.2.3.1

# 在IPsec隧道接口上应用IPsec安全框架

[RouterA-Tunnel1] tunnel protection ipsec profile abc

[RouterA-Tunnel1] quit

(4)     配置Router A到Router B的静态路由。

[RouterA] ip route-static 10.1.2.0 255.255.255.0 tunnel 1

4. 配置Router B

(1)     请根据组网图中标识的接口IP地址,配置各接口的IP地址,具体配置步骤略

(2)     配置IPsec安全框架

# 创建IKE keychain abc并进入IKE keychain视图。

<RouterB> system-view

[RouterB] ike keychain abc

# 配置与地址为2.2.2.1的对端使用的预共享密钥为明文的123456TESTplat&!。

[RouterB-ike-keychain-abc] pre-shared-key address 2.2.2.1 255.255.255.0 key simple 123456TESTplat&!

[RouterB-ike-keychain-abc] quit

# 创建IKE profile abc,并进入其视图。

[RouterB] ike profile abc

# 在IKE profile abc中指定名称为abc的配置的IKE keychain。

[RouterB-ike-profile-abc] keychain abc

# 指定使用IP地址2.2.3.1标识本端身份。

[RouterB-ike-profile-abc] local-identity address 2.2.3.1

# 指定需要匹配对端身份类型为IP地址,取值为2.2.2.1。

[RouterB-ike-profile-abc] match remote identity address 2.2.2.1 24

# 配置IKE第一阶段协商使用野蛮模式。

[RouterB-ike-profile-abc] exchange-mode aggressive

[RouterB-ike-profile-abc] quit

# 创建名为abc的IPsec安全提议,并进入IPsec安全提议视图。

[RouterB] ipsec transform-set abc

# 在IPsec安全提议中配置ESP加密算法为CBC模式的AES算法,密钥长度为128比特。

[RouterB-ipsec-transform-set-abc] esp encryption-algorithm aes-cbc-128

# 在IPsec安全提议中配置ESP认证算法为HMAC-SHA1算法,密钥长度为160比特。

[RouterB-ipsec-transform-set-abc] esp authentication-algorithm sha1

[RouterB-ipsec-transform-set-abc] quit

# 配置名称为abc的IPsec安全框架,通过IKE协商建立安全联盟。

[RouterB] ipsec profile abc isakmp

# 配置IPsec安全框架引用名称为abc的IPsec安全提议。

[RouterB-ipsec-profile-isakmp-abc] transform-set abc

# 配置IPsec安全框架引用名称为abc的IKE profile。

[RouterB-ipsec-profile-isakmp-abc] ike-profile abc

[RouterB-ipsec-profile-isakmp-abc] quit

(3)     配置IPsec隧道接口

# 创建模式为IPsec隧道的接口Tunnel1。

[RouterB] interface tunnel 1 mode ipsec

# 配置Tunnel1接口的IP地址。

[RouterB-Tunnel1] ip address 3.3.3.2 255.255.255.0

# 配置Tunnel1接口的源端地址(GE1/0/2接口的IP地址)。

[RouterB-Tunnel1] source 2.2.3.1

# 配置Tunnel1接口的目的端地址(RouterB的GE1/0/2接口的IP地址)。

[RouterB-Tunnel1] destination 2.2.2.1

# 在IPsec隧道接口上应用IPsec安全框架。

[RouterB-Tunnel1] tunnel protection ipsec profile abc

[RouterB-Tunnel1] quit

(4)     配置Router B到Router A的静态路由

[RouterB] ip route-static 10.1.1.0 255.255.255.0 tunnel 1

5. 验证配置结果

以上配置完成后,Router A会自动与Router B进行IKE协商。当IKE协商完成后,Router A和Router B上的IPsec 虚拟隧道接口都将up,即可以满足上述组网需求,对总部和分支的数据流进行安全保护。

# 通过display ip interface brief命令可查看接口状态如下:

<RouterA> display ip interface brief

*down: administratively down

(s): spoofing  (l): loopback

Interface           Physical Protocol IP address/Mask    VPN instance Description

GE1/0/1             up       up       10.1.1.1/24        --           --

GE1/0/2             up       up       2.2.2.1/24         --           --

Tun1                up       up       3.3.3.1/24         --           --

# 通过display interface tunnel命令可查看隧道状态如下:

<RouterA> display interface Tunnel 1

Tunnel1

Current state: UP

Line protocol state: UP

Description: Tunnel1 Interface

Bandwidth: 64 kbps

Maximum transmission unit: 1444

Internet address: 3.3.3.1/24 (primary)

Tunnel source 2.2.2.1, destination 2.2.3.1

Tunnel TTL 255

Tunnel protocol/transport IPsec/IP

Output queue - Urgent queuing: Size/Length/Discards 0/100/0

Output queue - Protocol queuing: Size/Length/Discards 0/500/0

Output queue - FIFO queuing: Size/Length/Discards 0/75/0

Last clearing of counters: Never

Last 300 seconds input rate: 0 bytes/sec, 0 bits/sec, 0 packets/sec

Last 300 seconds output rate: 0 bytes/sec, 0 bits/sec, 0 packets/sec

Input: 0 packets, 0 bytes, 0 drops

Output: 0 packets, 0 bytes, 0 drops

# 通过display ipsec sa命令查看协商生成的IPsec SA:

<RouterA> display ipsec sa

-------------------------------

Interface: Tunnel1

-------------------------------

 

  -----------------------------

  IPsec profile: abc

  Alias: profile-abc

  Mode: ISAKMP

  -----------------------------

    Tunnel id: 0

    Encapsulation mode: tunnel

    Perfect Forward Secrecy:

    Transmitting entity: Initiator

    Path MTU: 1388

    Tunnel:

        local  address/port: 2.2.2.1/500

        remote address/port: 2.2.3.1/500

    Flow:

        sour addr: 0.0.0.0/0.0.0.0  port: 0  protocol: ip

        dest addr: 0.0.0.0/0.0.0.0  port: 0  protocol: ip

 

    [Inbound ESP SAs]

      SPI: 2701952073 (0xa10c8449)

      Connection ID: 4294967296

      Transform set: ESP-ENCRYPT-AES-CBC-128 ESP-AUTH-SHA1

      SA duration (kilobytes/sec): 1843200/3600

      SA remaining duration (kilobytes/sec): 1843200/3180

      Max received sequence-number: 0

      Anti-replay check enable: Y

      Anti-replay window size: 64

      UDP encapsulation used for NAT traversal: N

      Status: Active

 

    [Outbound ESP SAs]

      SPI: 3607077598 (0xd6ffa2de)

      Connection ID: 12884901889

      Transform set: ESP-ENCRYPT-AES-CBC-128 ESP-AUTH-SHA1

      SA duration (kilobytes/sec): 1843200/3600

      SA remaining duration (kilobytes/sec): 1843200/3180

      Max sent sequence-number: 0

      UDP encapsulation used for NAT traversal: N

      Status: Active

 

# 在Router A上用私网地址可以Ping通Router B连接的私网地址:

<RouterA> ping -a 10.1.1.1 10.1.2.1

Ping 10.1.2.1 (10.1.2.1) from 10.1.1.1: 56 data bytes, press CTRL_C to break

56 bytes from 10.1.2.1: icmp_seq=0 ttl=255 time=1.000 ms

56 bytes from 10.1.2.1: icmp_seq=1 ttl=255 time=1.000 ms

56 bytes from 10.1.2.1: icmp_seq=2 ttl=255 time=0.000 ms

56 bytes from 10.1.2.1: icmp_seq=3 ttl=255 time=1.000 ms

56 bytes from 10.1.2.1: icmp_seq=4 ttl=255 time=0.000 ms

 

--- Ping statistics for 10.1.2.1 ---

5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss

round-trip min/avg/max/std-dev = 0.000/0.600/1.000/0.490 ms

配置缺 ipsec policy 和ACL,

zhl188 发表时间:2025-07-31 更多>>

两边私网的静态路由早就加了, 你这个两端固定ip的, 不适合我现在的状态啊。 我还特意找了一个带nat的, 但是nat之后, 还是固定ip,所以我的配置与案例还是有点差异。

zhiliao_aQEvqY 发表时间:2025-07-31

配置缺 ipsec policy 和ACL,

zhl188 发表时间:2025-07-31

编辑答案

你正在编辑答案

如果你要对问题或其他回答进行点评或询问,请使用评论功能。

分享扩散:

提出建议

    +

亲~登录后才可以操作哦!

确定

亲~检测到您登陆的账号未在http://hclhub.h3c.com进行注册

注册后可访问此模块

跳转hclhub

你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作

举报

×

侵犯我的权益 >
对根叔社区有害的内容 >
辱骂、歧视、挑衅等(不友善)

侵犯我的权益

×

泄露了我的隐私 >
侵犯了我企业的权益 >
抄袭了我的内容 >
诽谤我 >
辱骂、歧视、挑衅等(不友善)
骚扰我

泄露了我的隐私

×

您好,当您发现根叔知了上有泄漏您隐私的内容时,您可以向根叔知了进行举报。 请您把以下内容通过邮件发送到pub.zhiliao@h3c.com 邮箱,我们会尽快处理。
  • 1. 您认为哪些内容泄露了您的隐私?(请在邮件中列出您举报的内容、链接地址,并给出简短的说明)
  • 2. 您是谁?(身份证明材料,可以是身份证或护照等证件)

侵犯了我企业的权益

×

您好,当您发现根叔知了上有关于您企业的造谣与诽谤、商业侵权等内容时,您可以向根叔知了进行举报。 请您把以下内容通过邮件发送到 pub.zhiliao@h3c.com 邮箱,我们会在审核后尽快给您答复。
  • 1. 您举报的内容是什么?(请在邮件中列出您举报的内容和链接地址)
  • 2. 您是谁?(身份证明材料,可以是身份证或护照等证件)
  • 3. 是哪家企业?(营业执照,单位登记证明等证件)
  • 4. 您与该企业的关系是?(您是企业法人或被授权人,需提供企业委托授权书)
我们认为知名企业应该坦然接受公众讨论,对于答案中不准确的部分,我们欢迎您以正式或非正式身份在根叔知了上进行澄清。

抄袭了我的内容

×

原文链接或出处

诽谤我

×

您好,当您发现根叔知了上有诽谤您的内容时,您可以向根叔知了进行举报。 请您把以下内容通过邮件发送到pub.zhiliao@h3c.com 邮箱,我们会尽快处理。
  • 1. 您举报的内容以及侵犯了您什么权益?(请在邮件中列出您举报的内容、链接地址,并给出简短的说明)
  • 2. 您是谁?(身份证明材料,可以是身份证或护照等证件)
我们认为知名企业应该坦然接受公众讨论,对于答案中不准确的部分,我们欢迎您以正式或非正式身份在根叔知了上进行澄清。

对根叔社区有害的内容

×

垃圾广告信息
色情、暴力、血腥等违反法律法规的内容
政治敏感
不规范转载 >
辱骂、歧视、挑衅等(不友善)
骚扰我
诱导投票

不规范转载

×

举报说明