帮助我们改善您的体验。

让我们了解您的想法。

您是否能抽出两分钟的时间完成一份问卷调查?

header-navigation
keyboard_arrow_up
close
keyboard_arrow_left
IPsec VPN 用户指南
Table of Contents Expand all
list Table of Contents

机器翻译对您有帮助吗?

starstarstarstarstar
Go to English page
免责声明:

我们将使用第三方机器翻译软件翻译本页面。瞻博网络虽已做出相当大的努力提供高质量译文,但无法保证其准确性。如果对译文信息的准确性有任何疑问,请参阅英文版本. 可下载的 PDF 仅提供英文版.

使用 IKEv2 的基于路由的 VPN

date_range 18-Jan-25

互联网密钥交换版本 2 (IKEv2) 是一种基于 IPsec 的隧道协议,可在对等 VPN 设备之间提供安全的 VPN 通信通道,并以受保护的方式定义 IPsec 安全关联 (SA) 的协商和身份验证。

表 1 介绍了 IPsec 半径 xAuth 或 CP 值。

表 1: IPsec 半径 xAuth 或 CP 值
半径属性 属性 ID 属性名称 供应商 ID(字典) 供应商属性 ID 属性值 类型
标准 8 成帧 IP 地址 NA NA IP 地址 IPv4 地址
标准 9 成帧 IP 网络掩码 NA NA IP 地址 IPv4 地址
标准 88 框架泳池 NA NA 名称 发短信
标准 100 成帧 IPv6 池 NA NA 名称 发短信
供应商 26 主 DNS 4874(瞻博网络 ERX) 4 IP 地址 IPv4 地址
供应商 26 辅助 DNS 4874(瞻博网络 ERX) 5 IP 地址 IPv4 地址
供应商 26 主赢 (NBNS) 4874(瞻博网络 ERX) 6 IP 地址 IPv4 地址
供应商 26 辅助赢家 (NBNS) 4874(瞻博网络 ERX) 7 IP 地址 IPv4 地址
供应商 26 IPv6 主 DNS 4874(瞻博网络 ERX) 47 IP 地址 十六进制字符串或八位字节
供应商 26 IPv6 辅助 DNS 4874(瞻博网络 ERX) 48 IP 地址 十六进制字符串或八位字节

示例:为 IKEv2 配置基于路由的 VPN

此示例说明如何配置基于路由的 IPsec VPN,以允许在分支机构和公司办公室之间安全地传输数据。

要求

此示例使用以下硬件:

  • SRX240 设备

  • SSG140 设备

开始之前,请阅读 IPsec 概述

概述

在此示例中,您为伊利诺伊州芝加哥的分支机构配置基于路由的 VPN,因为您希望节省隧道资源,但仍会对 VPN 流量进行精细限制。芝加哥办事处的用户将使用 VPN 连接到位于加利福尼亚桑尼维尔的公司总部。

在此示例中,您将配置接口、IPv4 默认路由、安全区域和地址簿。然后配置 IKE 阶段 1、IPsec 阶段 2、安全策略和 TCP-MSS 参数。有关此示例中使用的特定配置参数,请参阅表 2表 6

表 2: 接口、静态路由、安全区域和地址簿信息

功能

名称

配置参数

接口

ge-0/0/0.0

192.168.10.1/24

ge-0/0/3.0

10.1.1.2/30

st0.0(隧道接口)

10.11.11.10/24

静态路由

0.0.0.0/0(默认路由)

下一跃点是 10.1.1.1。

192.168.168.0/24

下一跃点为 st0.0。

安全区域

trust

  • 允许所有系统服务。

  • ge-0/0/0.0 接口绑定到此区域。

untrust

  • IKE 是唯一允许的系统服务。

  • ge-0/0/3.0 接口绑定到此区域。

VPN-芝加哥

st0.0 接口绑定到此区域。

通讯簿条目

森尼韦尔

  • 此地址用于信任区域的地址簿。

  • 此通讯簿条目的地址是 192.168.10.0/24。

芝加哥

  • 此地址用于不信任区域的地址簿。

  • 此通讯簿条目的地址是 192.168.168.0/24。

表 3: IKE 第 1 阶段配置参数

功能

名称

配置参数

提议

IKE 第 1 阶段提案

  • 身份验证方法:预共享密钥

  • Diffie-Hellman 组:group2

  • 身份验证算法:sha1

  • 加密算法:AES-128-CBC

策略

IKE-Phase 1-策略

  • 模式:主

  • 提议参考:IKE 第 1 阶段提案

  • IKE 第 1 阶段策略身份验证方法:预共享密钥 ASCII 文本

网关

GW-芝加哥

  • IKE 策略参考:IKE-Phase 1-策略

  • 外部接口:ge-0/0/3.0

  • 网关地址:10.2.2.2

表 4: IPsec 第 2 阶段配置参数

功能

名称

配置参数

提议

IPSec 第 2 阶段提案

  • 协议:esp

  • 身份验证算法:HMAC-SHA1-96

  • 加密算法:AES-128-CBC

策略

ipsec-phase2-policy

  • 提议参考:IPSec 第 2 阶段提案

  • PFS:Diffie-Hellman 组 2

VPN

ipsec-vpn-chicago

  • IKE 网关参考:GW-芝加哥

  • IPsec 策略参考:ipsec-phase2-policy

  • 绑定到接口:st0.0

表 5: 安全策略配置参数

目的

名称

配置参数

安全策略允许从信任区域到 vpn-chicago 区域的流量。

VPN-TR-CHI

  • 匹配标准:

    • source-address sunnyvale

    • destination-address chicago

    • application any

  • 操作:permit

安全策略允许从 vpn-chicago 区域到信任区域的流量。

VPN-CHI-TR

  • 匹配标准:

    • source-address chicago

    • destination-address sunnyvale

    • application any

  • 操作:permit

表 6: TCP-MSS 配置参数

目的

配置参数

TCP-MSS 作为 TCP 三次握手的一部分进行协商,并限制 TCP 分段的最大大小,以便更好地适应网络上的 MTU 限制。对于 VPN 流量,IPsec 封装开销以及 IP 和帧开销会导致生成的 ESP 数据包超过物理接口的 MTU,从而导致分段。分段会增加带宽和设备资源。

建议将 1350 作为大多数基于以太网且 MTU 为 1500 或更高的网络的起点值。您可能需要试验不同的 TCP-MSS 值,以获得最佳性能。例如,如果路径中任何设备的 MTU 较低,或者存在任何额外开销(如 PPP 或帧中继),则可能需要更改该值。

MSS 值:1350

配置

配置接口、静态路由、安全区域和地址簿信息

CLI 快速配置

要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到 [edit] 层级的 CLI 中,然后从配置模式进入 commit

content_copy zoom_out_map
set interfaces ge-0/0/0 unit 0 family inet address 192.168.10.1/24
set interfaces ge-0/0/3 unit 0 family inet address 10.1.1.2/30
set interfaces st0 unit 0 family inet address 10.11.11.10/24 
set routing-options static route 0.0.0.0/0 next-hop 10.1.1.1
set routing-options static route 192.168.168.0/24 next-hop st0.0
set security zones security-zone untrust interfaces ge-0/0/3.0
set security zones security-zone untrust host-inbound-traffic system-services ike 
set security zones security-zone trust interfaces ge-0/0/0.0
set security zones security-zone trust host-inbound-traffic system-services all 
set security zones security-zone trust address-book address sunnyvale 192.168.10.0/24
set security zones security-zone vpn-chicago interfaces st0.0
set security zones security-zone vpn-chicago address-book address chicago 192.168.168.0/24
分步过程

下面的示例要求您在各个配置层级中进行导航。有关操作说明,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器

要配置接口、静态路由、安全区域和地址簿信息:

  1. 配置以太网接口信息。

    content_copy zoom_out_map
    [edit]
    user@host# set interfaces ge-0/0/0 unit 0 family inet address 192.168.10.1/24
    user@host# set interfaces ge-0/0/3 unit 0 family inet address 10.1.1.2/30
    user@host# set interfaces st0 unit 0 family inet address 10.11.11.10/24
    
  2. 配置静态路由信息。

    content_copy zoom_out_map
    [edit]
    user@host# set routing-options static route 0.0.0.0/0 next-hop 10.1.1.1
    user@host# set routing-options static route 192.168.168.0/24 next-hop st0.0
    
  3. 配置不信任安全区域。

    content_copy zoom_out_map
    [edit ]
    user@host# edit security zones security-zone untrust
    
  4. 为安全区域分配接口。

    content_copy zoom_out_map
    [edit security zones security-zone untrust]
    user@host# set interfaces ge-0/0/3.0
    
  5. 为安全区域指定允许的系统服务。

    content_copy zoom_out_map
    [edit security zones security-zone untrust]
    user@host# set host-inbound-traffic system-services ike
    
  6. 配置信任安全区域。

    content_copy zoom_out_map
    [edit]
    user@host# edit security zones security-zone trust
    
  7. 为信任安全区域分配接口。

    content_copy zoom_out_map
    [edit security zones security-zone trust]
    user@host# set interfaces ge-0/0/0.0
    
  8. 为信任安全区域指定允许的系统服务。

    content_copy zoom_out_map
    [edit security zones security-zone trust]
    user@host# set host-inbound-traffic system-services all
    
  9. 配置信任安全区域的通讯簿条目。

    content_copy zoom_out_map
    [edit security zones security-zone trust]
    user@host# set address-book address sunnyvale 192.168.10.0/24
    
  10. 配置 vpn-chicago 安全区域。

    content_copy zoom_out_map
    [edit]
    user@host# edit security zones security-zone vpn-chicago
    
  11. 为安全区域分配接口。

    content_copy zoom_out_map
    [edit security zones security-zone vpn-chicago]
    user@host# set interfaces st0.0
    
  12. 配置 vpn-chicago 区域的通讯簿条目。

    content_copy zoom_out_map
    [edit security zones security-zone vpn-chicago]
    user@host# set address-book address chicago 192.168.168.0/24
    
结果

在配置模式下,输入 show interfacesshow routing-optionsshow security zones 命令确认您的配置。如果输出未显示预期的配置,请重复此示例中的配置说明,以便进行更正。

content_copy zoom_out_map
[edit]
user@host# show interfaces
ge-0/0/0 {
    unit 0 {
        family inet {
            address 192.168.10.1/24;
        }
    }
}
ge-0/0/3 {
    unit 0 {
        family inet {
            address 10.1.1.2/30 
        }
    }
}
st0{
    unit 0 {
        family inet {
            address 10.11.11.10/24
        }
    }
}
content_copy zoom_out_map
[edit]
user@host# show routing-options
static {
    route 0.0.0.0/0 next-hop 10.1.1.1;
    route 192.168.168.0/24 next-hop st0.0;
}
content_copy zoom_out_map
[edit]
user@host# show security zones
security-zone untrust {
    host-inbound-traffic {
        system-services {
            ike;
        }
    }
    interfaces {
        ge-0/0/3.0;
    }
}
security-zone trust {
    address-book {
        address sunnyvale 192.168.10.0/24;
    }
    host-inbound-traffic {
        system-services {
            all;
        }
    }
    interfaces {
        ge-0/0/0.0;
    }
}
security-zone vpn-chicago {
    host-inbound-traffic {
        address-book {
            address chicago 192.168.168.0/24;
        }
    }
    interfaces {
        st0.0;
    }
}

如果完成设备配置,请从配置模式输入 commit

配置 IKE

CLI 快速配置

要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到 [edit] 层级的 CLI 中,然后从配置模式进入 commit

content_copy zoom_out_map
set security ike proposal ike-phase1-proposal authentication-method pre-shared-keys
set security ike proposal ike-phase1-proposal dh-group group2 
set security ike proposal ike-phase1-proposal authentication-algorithm sha1 
set security ike proposal ike-phase1-proposal encryption-algorithm aes-128-cbc 
set security ike policy ike-phase1-policy proposals ike-phase1-proposal 
set security ike policy ike-phase1-policy pre-shared-key ascii-text “$ABC123” 
set security ike gateway gw-chicago external-interface ge-0/0/3.0 
set security ike gateway gw-chicago ike-policy ike-phase1-policy 
set security ike gateway gw-chicago address 10.2.2.2 
set security ike gateway gw-chicago version v2-only 
分步过程

下面的示例要求您在各个配置层级中进行导航。有关操作说明,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器

要配置 IKE:

  1. 创建 IKE 第 1 阶段提议。

    content_copy zoom_out_map
    [edit security ike]
    user@host# set proposal ike-phase1-proposal
    
  2. 定义 IKE 提议身份验证方法。

    content_copy zoom_out_map
    [edit security ike proposal ike-phase1-proposal]
    user@host# set authentication-method pre-shared-keys
    
  3. 定义 IKE 提议 Diffie-Hellman 组。

    content_copy zoom_out_map
    [edit security ike proposal ike-phase1-proposal]
    user@host# set dh-group group2
    
  4. 定义 IKE 提议身份验证算法。

    content_copy zoom_out_map
    [edit security ike proposal ike-phase1-proposal]
    user@host# set authentication-algorithm sha1
    
  5. 定义 IKE 提议加密算法。

    content_copy zoom_out_map
    [edit security ike proposal ike-phase1-proposal]
    user@host# set encryption-algorithm aes-128-cbc
    
  6. 创建 IKE 第 1 阶段策略。

    content_copy zoom_out_map
    [edit security ike]
    user@host# set policy ike-phase1-policy
    
  7. 指定对 IKE 提议的参考。

    content_copy zoom_out_map
    [edit security ike policy ike-phase1-policy]
    user@host# set proposals ike-phase1-proposal
    
  8. 定义 IKE 第 1 阶段策略身份验证方法。

    content_copy zoom_out_map
    [edit security ike policy ike-phase1-policy]
    user@host# set pre-shared-key ascii-text “$ABC123”
    
  9. 创建 IKE 第 1 阶段网关并定义其外部接口。

    content_copy zoom_out_map
    [edit security ike]
    user@host# set gateway gw-chicago external-interface ge-0/0/3.0
    
  10. 定义 IKE 第 1 阶段策略参考。

    content_copy zoom_out_map
    [edit security ike gateway gw-chicago]
    user@host# set ike-policy ike-phase1-policy
    
  11. 定义 IKE 第 1 阶段网关地址。

    content_copy zoom_out_map
    [edit security ike gateway gw-chicago]
    user@host# set address 10.2.2.2
    
  12. 定义 IKE 第 1 阶段网关版本。

    content_copy zoom_out_map
    [edit security ike gateway gw-chicago]
    user@host# set version v2-only
    
结果

在配置模式下,输入 show security ike 命令以确认您的配置。如果输出未显示预期的配置,请重复此示例中的配置说明,以便进行更正。

content_copy zoom_out_map
[edit]
user@host# show security ike
proposal ike-phase1-proposal {
    authentication-method pre-shared-keys;
    dh-group group2;
    authentication-algorithm sha1;
    encryption-algorithm aes-128-cbc;
}
policy ike-phase1-policy {
    proposals ike-phase1-proposal;
    pre-shared-key ascii-text "$ABC123"; ## SECRET-DATA
}
gateway gw-chicago {
    ike-policy ike-phase1-policy;
    address 10.2.2.2;
    external-interface ge-0/0/3.0;
    version v2-only;
}

如果完成设备配置,请从配置模式输入 commit

配置 IPsec

CLI 快速配置

要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到 [edit] 层级的 CLI 中,然后从配置模式进入 commit

content_copy zoom_out_map
set security ipsec proposal ipsec-phase2-proposal protocol esp
set security ipsec proposal ipsec-phase2-proposal authentication-algorithm hmac-sha1-96 
set security ipsec proposal ipsec-phase2-proposal encryption-algorithm aes-128-cbc 
set security ipsec policy ipsec-phase2-policy proposals ipsec-phase2-proposal
set security ipsec policy ipsec-phase2-policy perfect-forward-secrecy keys group2
set security ipsec vpn ipsec-vpn-chicago ike gateway gw-chicago
set security ipsec vpn ipsec-vpn-chicago ike ipsec-policy ipsec-phase2-policy
set security ipsec vpn ipsec-vpn-chicago bind-interface st0.0
分步过程

下面的示例要求您在各个配置层级中进行导航。有关操作说明,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器

要配置 IPsec:

  1. 创建 IPsec 第 2 阶段提议。

    content_copy zoom_out_map
    [edit]
    user@host# set security ipsec proposal ipsec-phase2-proposal
    
  2. 指定 IPsec 第 2 阶段提议协议。

    content_copy zoom_out_map
    [edit security ipsec proposal ipsec-phase2-proposal]
    user@host# set protocol esp
    
  3. 指定 IPsec 第 2 阶段提议身份验证算法。

    content_copy zoom_out_map
    [edit security ipsec proposal ipsec-phase2-proposal]
    user@host# set authentication-algorithm hmac-sha1-96
    
  4. 指定 IPsec 第 2 阶段提议加密算法。

    content_copy zoom_out_map
    [edit security ipsec proposal ipsec-phase2-proposal]
    user@host# set encryption-algorithm aes-128-cbc
    
  5. 创建 IPsec 第 2 阶段策略。

    content_copy zoom_out_map
    [edit security ipsec]
    user@host# set policy ipsec-phase2-policy
    
  6. 指定 IPsec 第 2 阶段提议参考。

    content_copy zoom_out_map
    [edit security ipsec policy ipsec-phase2-policy]
    user@host# set proposals ipsec-phase2-proposal
    
  7. 指定 IPsec 第 2 阶段 PFS 以使用 Diffie-Hellman 组 2。

    content_copy zoom_out_map
    [edit security ipsec policy ipsec-phase2-policy]
    user@host# set perfect-forward-secrecy keys group2
    
  8. 指定 IKE 网关。

    content_copy zoom_out_map
    [edit security ipsec]
    user@host# set vpn ipsec-vpn-chicago ike gateway gw-chicago
    
  9. 指定 IPsec 第 2 阶段策略。

    content_copy zoom_out_map
    [edit security ipsec]
    user@host# set vpn ipsec-vpn-chicago ike ipsec-policy ipsec-phase2-policy
    
  10. 指定要绑定的接口。

    content_copy zoom_out_map
    [edit security ipsec]
    user@host# set vpn ipsec-vpn-chicago bind-interface st0.0
    
结果

在配置模式下,输入 show security ipsec 命令以确认您的配置。如果输出未显示预期的配置,请重复此示例中的配置说明,以便进行更正。

content_copy zoom_out_map
[edit]
user@host# show security ipsec
proposal ipsec-phase2-proposal {
    protocol esp;
    authentication-algorithm hmac-sha1-96;
    encryption-algorithm aes-128-cbc;
}
policy ipsec-phase2-policy {
    perfect-forward-secrecy {
        keys group2;
    }
    proposals ipsec-phase2-proposal;
}
vpn ipsec-vpn-chicago {
    bind-interface st0.0;
    ike {
        gateway gw-chicago;
        ipsec-policy ipsec-phase2-policy;
    }
}

如果完成设备配置,请从配置模式输入 commit

配置安全策略

CLI 快速配置

要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到 [edit] 层级的 CLI 中,然后从配置模式进入 commit

content_copy zoom_out_map
set security policies from-zone trust to-zone vpn-chicago policy vpn-tr-chi match source-address sunnyvale
set security policies from-zone trust to-zone vpn-chicago policy vpn-tr-chi match destination-address chicago 
set security policies from-zone trust to-zone vpn-chicago policy vpn-tr-chi match application any 
set security policies from-zone trust to-zone vpn-chicago policy vpn-tr-chi then permit 
set security policies from-zone vpn-chicago to-zone trust policy vpn-chi-tr match source-address chicago
set security policies from-zone vpn-chicago to-zone trust policy vpn-chi-tr match destination-address sunnyvale 
set security policies from-zone vpn-chicago to-zone trust policy vpn-chi-tr match application any 
set security policies from-zone vpn-chicago to-zone trust policy vpn-chi-tr then permit 
分步过程

下面的示例要求您在各个配置层级中进行导航。有关操作说明,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器

要配置安全策略:

  1. 创建安全策略以允许从信任区域到 vpn-chicago 区域的流量。

    content_copy zoom_out_map
    [edit security policies from-zone trust to-zone vpn-chicago]
    user@host# set policy vpn-tr-chi match source-address sunnyvale
    user@host# set policy vpn-tr-chi match destination-address chicago
    user@host# set policy vpn-tr-chi match application any
    user@host# set policy vpn-tr-chi then permit 
    
  2. 创建安全策略以允许从 vpn-chicago 区域到信任区域的流量。

    content_copy zoom_out_map
    [edit security policies from-zone vpn-chicago to-zone trust]
    user@host# set policy vpn-chi-tr match source-address sunnyvale
    user@host# set policy vpn-chi-tr match destination-address chicago
    user@host# set policy vpn-chi-tr match application any
    user@host# set policy vpn-chi-tr then permit 
    
结果

在配置模式下,输入 show security policies 命令以确认您的配置。如果输出未显示预期的配置,请重复此示例中的配置说明,以便进行更正。

content_copy zoom_out_map
[edit]
user@host# show security policies
from-zone trust to-zone vpn-chicago {
    policy vpn-tr-vpn {
        match {
            source-address sunnyvale; 
            destination-address chicago;
            application any;
        }
        then {
            permit;
        }
    }
}
from-zone vpn-chicago to-zone trust {
    policy vpn-tr-vpn {
        match {
            source-address chicago;
            destination-address sunnyvale;
            application any;
        }
        then {
            permit;
        }
    }
}

如果完成设备配置,请从配置模式输入 commit

配置 TCP-MSS

CLI 快速配置

要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到 [edit] 层级的 CLI 中,然后从配置模式进入 commit

content_copy zoom_out_map
set security flow tcp-mss ipsec-vpn mss 1350
分步过程

下面的示例要求您在各个配置层级中进行导航。有关操作说明,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器

要配置 TCP-MSS 信息:

  1. 配置 TCP-MSS 信息。

    content_copy zoom_out_map
    [edit]
    user@host# set security flow tcp-mss ipsec-vpn mss 1350
    
结果

在配置模式下,输入 show security flow 命令以确认您的配置。如果输出未显示预期的配置,请重复此示例中的配置说明,以便进行更正。

content_copy zoom_out_map
[edit]
user@host# show security flow
tcp-mss {
    ipsec-vpn {
        mss 1350;
    }
}

如果完成设备配置,请从配置模式输入 commit

配置 SSG 系列设备

CLI 快速配置

为了参考,提供了 SSG 系列设备的配置。有关配置 SSG 系列设备的信息,请参见 Concepts & Examples ScreenOS Reference Guide位于 https://www.juniper.net/documentation 的 。

要快速配置示例的此部分,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到 [edit] 层级的 CLI 中,然后从配置模式进入 commit

content_copy zoom_out_map
set zone name vpn-chicago
set interface ethernet0/6 zone Trust
set interface ethernet0/0 zone Untrust
set interface tunnel.1 zone vpn-chicago
set interface ethernet0/6 ip 192.168.168.1/24
set interface ethernet0/6 route
set interface ethernet0/0 ip 10.2.2.2/30
set interface ethernet0/0 route
set interface tunnel.1 ip 10.11.11.11/24
set flow tcp-mss 1350
set address Trust “192.168.168-net” 192.168.168.0 255.255.255.0
set address vpn-chicago "192.168.10-net" 192.168.10.0 255.255.255.0
set ike gateway corp-ike address 10.1.1.2 IKEv2 outgoing-interface ethernet0/0 preshare 395psksecr3t sec-level standard
set vpn corp-vpn gateway corp-ike replay tunnel idletime 0 sec-level standard
set vpn corp-vpn monitor optimized rekey
set vpn corp-vpn bind interface tunnel.1
set policy from Trust to Untrust “ANY” “ANY” “ANY” nat src permit
set policy from Trust to vpn-chicago “192.168.168-net” “192.168.10-net” “ANY” permit
set policy from vpn-chicago to Trust “192.168.10-net” “192.168.168-net” “ANY” permit
set route 192.168.10.0/24 interface tunnel.1
set route 0.0.0.0/0 interface ethernet0/0 gateway 10.2.2.1

验证

确认配置工作正常。

验证 IKE 第 1 阶段状态

目的

验证 IKE 第 1 阶段状态。

操作

在开始验证过程之前,您需要将流量从 192.168.10/24 网络中的主机发送到 192.168.168/24 网络中的主机。对于基于路由的 VPN,流量可由 SRX 系列防火墙通过隧道启动。建议在测试 IPsec 隧道时,将测试流量从 VPN 一端的单独设备发送到 VPN 另一端的另一台设备。例如,发起从 192.168.10.10 到 192.168.168.10 的 ping。

在操作模式下,输入 show security ike security-associations 命令。从命令获取索引号之后,请使用 show security ike security-associations index index_number detail 命令。

content_copy zoom_out_map
user@host> show security ike security-associations
Index   Remote Address  State  Initiator cookie  Responder cookie  Mode
1       10.2.2.2         UP     744a594d957dd513  1e1307db82f58387  IKEv2
content_copy zoom_out_map
user@host> show security ike security-associations index 1 detail
IKE peer 10.2.2.2, Index 1,
  Role: Responder, State: UP
  Initiator cookie: 744a594d957dd513, Responder cookie: 1e1307db82f58387
  Exchange type: IKEv2, Authentication method: Pre-shared-keys
  Local: 10.1.1.2:500, Remote: 10.2.2.2:500
  Lifetime: Expires in 28570 seconds
  Algorithms:
   Authentication        : sha1
   Encryption            : aes-cbc (128 bits)
   Pseudo random function: hmac-sha1
  Traffic statistics:
   Input bytes    :                 852
   Output bytes   :                 940
   Input packets  :                   5
   Output packets :                   5
  Flags: Caller notification sent
  IPSec security associations: 1 created, 0 deleted
  
意义

show security ike security-associations 命令会列出所有活动的 IKE 第 1 阶段 SA。如果未列出任何 SA,则第 1 阶段建立存在问题。检查配置中的 IKE 策略参数和外部接口设置。

如果列出了 SA,请查看以下信息:

  • 索引 - 此值对于每个 IKE SA 都是唯一的,您可以在命令中 show security ike security-associations index detail 使用它来获取有关 SA 的更多信息。

  • 远程地址 - 验证远程 IP 地址是否正确。

  • State

    • UP—已建立第 1 阶段 SA。

    • DOWN — 建立第 1 阶段 SA 时出现问题。

  • 模式 - 验证是否使用了正确的模式。

验证配置中的以下各项是否正确:

  • 外部接口(接口必须是接收 IKE 数据包的接口)。

  • IKE 策略参数。

  • 预共享密钥信息。

  • 第 1 阶段提议参数(必须在两个对等方上匹配)。

show security ike security-associations index 1 detail 命令会列出有关索引号为 1 的 SA 的其他信息:

  • 使用的身份验证和加密算法

  • 第 1 阶段生存期

  • 流量统计(可用于验证流量是否在两个方向上正常流动)

  • 角色信息

    最好使用响应方角色在对等方上执行故障排除。

  • 发起方和响应方信息

  • 创建的 IPsec SA 数

验证 IPsec 第 2 阶段状态

目的

验证 IPsec 第 2 阶段状态。

操作

在操作模式下,输入 show security ipsec security-associations 命令。从命令获取索引号之后,请使用 show security ipsec security-associations index index_number detail 命令。

content_copy zoom_out_map
user@host> show security ipsec security-associations
  total configured sa: 2
  ID    Gateway     Port  Algorithm       SPI      Life:sec/kb  Mon vsys	
  <16384 10.2.2.2    500   ESP:aes-128/sha1   76d64d1d 3363/ unlim   -   0	   
  >16384 10.2.2.2    500   ESP:aes-128/sha1   a1024ee2 3363/ unlim   -   0   
content_copy zoom_out_map
user@host> show security ipsec security-associations index 16384 detail
  Virtual-system: Root
  Local Gateway: 10.1.1.2, Remote Gateway: 10.2.2.2
  Local Identity: ipv4_subnet(any:0,[0..7]=192.168.10.0/24)
  Remote Identity: ipv4_subnet(any:0,[0..7]=192.168.168.0/24)
  Version: IKEv2

    DF-bit: clear

    Direction: inbound, SPI: 1993755933, AUX-SPI: 0
    Hard lifetime: Expires in 3352 seconds
    Lifesize Remaining: Unlimited
    Soft lifetime: Expires in 2775 seconds
    Mode: tunnel, Type: dynamic, State: installed, VPN Monitoring: -
    Protocol: ESP, Authentication: hmac-sha1-96, Encryption: aes-cbc (128 bits)    
    Anti-replay service: enabled, Replay window size: 32

    Direction: outbound, SPI: 2701283042, AUX-SPI: 0
    Hard lifetime: Expires in 3352 seconds
    Lifesize Remaining: Unlimited
    Soft lifetime: Expires in 2775 seconds
    Mode: tunnel, Type: dynamic, State: installed, VPN Monitoring: -
    Protocol: ESP, Authentication: hmac-sha1-96, Encryption: aes-cbc
 (128 bits)    
    Anti-replay service: enabled, Replay window size: 32
意义

show security ipsec security-associations 命令输出列出以下信息:

  • ID 号为 16384。将此值用于 show security ipsec security-associations index 命令,可获取有关此特定 SA 的更多信息。

  • 有一个 IPsec SA 对使用端口 500。

  • 两个方向都会显示 SPI、生存期(以秒为单位)和使用限制(或生存大小,以 KB 为单位)。3363/unlim 值表示第 2 阶段生存期将在 3363 秒后过期,并且未指定生存大小,表示它是无限的。第 2 阶段生存期可能与第 1 阶段生存期不同,因为在 VPN 启动后,第 2 阶段不依赖于第 1 阶段。

  • vsys 是根系统,始终列为 0。

  • IKEv2 允许来自版本 2 对等方的连接,并将启动版本 2 协商。

show security ipsec security-associations index 16384 detail 命令输出列出以下信息:

  • 本地身份和远程身份组成 SA 的代理 ID。

    代理 ID 不匹配是第 2 阶段故障的最常见原因之一。如果未列出 IPsec SA,请确认第 2 阶段提议(包括代理 ID 设置)对于两个对等方都是正确的。对于基于路由的 VPN,默认代理 ID 为本地 = 0.0.0.0/0,远程 = 0.0.0.0/0,服务 = any。来自相同对等方 IP 的多个基于路由的 VPN 可能会出现问题。在这种情况下,必须为每个 IPsec SA 指定唯一的代理 ID。对于某些第三方供应商,必须手动输入代理 ID 以进行匹配。

  • 第 2 阶段失败的另一个常见原因是未指定 ST 接口绑定。如果 IPsec 无法完成,请检查 kmd 日志或设置追踪选项。

查看 IPsec 安全关联的统计信息和错误

目的

查看 IPsec SA 的 ESP 和身份验证标头计数器和错误。

操作

在操作模式下,输入 show security ipsec statistics index index_number 命令,其中使用要查看其统计信息的 VPN 的索引号。

content_copy zoom_out_map
user@host> show security ipsec statistics index 16384
ESP Statistics:
  Encrypted bytes:              920
  Decrypted bytes:             6208
  Encrypted packets:              5
  Decrypted packets:             87
AH Statistics:
  Input bytes:                    0
  Output bytes:                   0
  Input packets:                  0
  Output packets:                 0
Errors:
  AH authentication failures: 0, Replay errors: 0
  ESP authentication failures: 0, ESP decryption failures: 0
  Bad headers: 0, Bad trailers: 0

也可以使用 show security ipsec statistics 命令来查看所有 SA 的统计信息和错误。

要清除所有 IPsec 统计信息,请使用 clear security ipsec statistics 命令。

意义

如果看到 VPN 中有数据包丢失的问题,可以多次运行 show security ipsec statisticsshow security ipsec statistics detail 命令以确认加密和解密数据包计数器是否在递增。还应检查其他错误计数器是否在递增。

测试通过 VPN 的流量

目的

验证通过 VPN 的流量。

操作

您可以使用 SRX 系列防火墙中的命令测试 ping 流向远程主机 PC 的流量。请确保指定源接口,以便路由查找是正确的,并且在策略查找过程中引用相应的安全区域。

在操作模式下,输入 ping 命令。

content_copy zoom_out_map
ssg-> ping 192.168.168.10 interface ge-0/0/0 count 5
PING 192.168.168.10 (192.168.168.10): 56 data bytes
64 bytes from 192.168.168.10: icmp_seq=0 ttl=127 time=8.287 ms
64 bytes from 192.168.168.10: icmp_seq=1 ttl=127 time=4.119 ms
64 bytes from 192.168.168.10: icmp_seq=2 ttl=127 time=5.399 ms
64 bytes from 192.168.168.10: icmp_seq=3 ttl=127 time=4.361 ms
64 bytes from 192.168.168.10: icmp_seq=4 ttl=127 time=5.137 ms

--- 192.168.168.10 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max/stddev = 4.119/5.461/8.287/1.490 ms

也可以从 SSG 系列设备使用 ping 命令。

content_copy zoom_out_map
user@host> ping 192.168.10.10 from ethernet0/6
Type escape sequence to abort
Sending 5, 100-byte ICMP Echos to 192.168.10.10, timeout is 1 seconds from ethernet0/6
!!!!!
Success Rate is 100 percent (5/5), round-trip time min/avg/max=4/4/5 ms

意义

如果 ping 命令在 SRX 系列或 SSG 系列设备上不起作用,则可能是路由、安全策略、终端主机或 ESP 数据包的加密和解密存在问题。

示例:使用 IKEv2 配置有效负载配置 SRX 系列以进行微型单元调配

在部署了许多设备的网络中,网络管理需要简单。IKEv2 配置有效负载功能支持调配这些设备,而无需接触设备配置或 SRX 系列配置。此示例说明如何使用 IKEv2 配置有效负载功能配置 SRX 系列以支持微微信元调配。

要求

此示例使用以下硬件和软件组件:

  • 机箱群集中配置的两个 SRX 系列防火墙

  • 一个配置为中间路由器的 SRX 系列防火墙

  • 两个微微蜂窝客户端

  • 一台配置了微微蜂窝客户端调配信息的 RADIUS 服务器

  • Junos OS 版本 12.1X46-D10 或更高版本,支持 IKEv2 配置有效负载

概述

在此示例中,SRX 系列使用 IKEv2 配置有效负载功能将调配信息传播到一系列微型信元。微微信元出厂时采用标准配置,允许它们连接到 SRX 系列,但微微信元调配信息存储在外部 RADIUS 服务器上。在与受保护网络中的设置服务器建立安全连接后,微微单元会收到完整的配置信息。 IPv4 和 IPV6 都支持 IKEv2 配置有效负载。此示例介绍 IPv4 的 IKEv2 配置有效负载,但您也可以使用 IPv6 地址进行配置。

从 Junos OS 20.3R1 版开始,我们支持 IKEv2 IPv6 配置有效负载,用于在运行 iked 进程SRX5000线路 上分配 IPv6 地址。从 Junos OS 21.1R1 版开始运行 iked 进程的 vSRX 虚拟防火墙中也包含相同的支持。

图 1 显示了 SRX 系列支持使用 IKEv2 配置有效负载功能进行微型信元调配的拓扑。

图 1: SRX 系列支持具有 IKEv2 配置有效负载的微型信元调配SRX 系列支持具有 IKEv2 配置有效负载的微型信元调配

此拓扑中的每个微微信元启动两个 IPsec VPN:一个用于管理,一个用于数据。在此示例中,管理流量使用标记为 OAM 隧道的隧道,而数据流量流经标记为 3GPP 隧道的隧道。每个隧道都支持在单独的可配置网络上与 OAM 和 3GPP 配置服务器连接,这需要单独的路由实例和 VPN。此示例提供用于建立 OAM 和 3GPP VPN 的 IKE 第 1 阶段和第 2 阶段选项。

在此示例中,SRX 系列充当 IKEv2 配置有效负载服务器,从 RADIUS 服务器获取调配信息,并将该信息提供给微微单元客户端。在隧道协商期间,SRX 系列返回 IKEv2 配置有效负载中每个授权客户端的调配信息。SRX 系列不能用作客户端设备。

此外,SRX 系列使用 IKEv2 配置有效负载信息来更新在隧道协商期间与客户端交换的流量选择器发起方 (TSi) 和流量选择器响应器 (TSr) 值。配置有效负载使用 SRX 系列上通过 [edit security ipsec vpn vpn-name ike] 层次结构级别的语句配置proxy-identity的 TSi 和 TSr 值。TSi 和 TSr 值定义每个 VPN 的网络流量。

中间路由器将微微信元流量路由到 SRX 系列上的相应接口。

以下过程描述了连接顺序:

  1. 微微信元使用出厂配置启动与 SRX 系列的 IPsec 隧道。

  2. SRX 系列使用在 SRX 系列中注册的 CA 的客户端证书信息和根证书对客户端进行身份验证。身份验证后,SRX 系列会在授权请求中将 IKE 身份信息从客户端证书传递到 RADIUS 服务器。

  3. 授权客户端后,RADIUS 服务器将使用客户端置备信息响应 SRX 系列:

    • IP 地址(TSi 值)

    • IP 子网掩码(可选;默认值为 32 位)

    • DNS 地址(可选)

  4. SRX 系列在 IKEv2 配置有效负载中为每个客户端连接返回调配信息,并与微微单元交换最终的 TSi 和 TSr 值。在此示例中,SRX 系列为每个 VPN 提供以下 TSi 和 TSr 信息:

    VPN 连接

    SRX 提供的 TSi/TSr 值

    笔克 1 OAM

    TSi:1 0.12.1.201/32,TSr:192.168.2.0/24

    笔克 1 3GPP

    TSi:1 0.13.1.201/32,TSr:192.168.3.0/24, TSr:10.13.0.0/16

    笔克 2 OAM

    TSi:1 0.12.1.205/32,TSr:192.168.2.0/24

    笔克 2 3GPP

    TSi:1 0.13.1.205/32,TSr:192.168.3.0/24, TSr:10.13.0.0/16

    如果 RADIUS 服务器提供的调配信息包括子网掩码,则 SRX 系列将为包含 IP 子网的客户端连接返回第二个 TSr 值。这将为该子网上的设备启用对等内通信。在此示例中,为与 3GPP VPN (13.13.0.0/16) 关联的子网启用了对等内通信。

    点对多点安全隧道 (st0) 接口和点对点接口均支持 IKEv2 配置有效负载功能。对于点对多点接口,接口必须编号,并且配置有效负载中提供的地址必须在关联的点对多点接口的子网范围内。

    从 Junos OS 20.1R1 版开始,我们支持 IKEv2 配置有效负载功能,并在运行 iked 的 SRX5000 系列和vSRX 虚拟防火墙 上使用点对点接口。

    多节点高可用性支持 IKEv2 配置有效负载功能,并通过点对点接口实现安全隧道 (st0)。

表 7 显示了在 SRX 系列上配置的第 1 阶段和第 2 阶段选项,包括有关建立 OAM 和 3GPP 隧道的信息。

表 7: SRX 系列的第 1 阶段和第 2 阶段选项

选项

value

IKE 提案:

提议名称

IKE_PROP

身份验证方法

RSA 数字证书

Diffie-Hellman (DH) 组

group5

身份验证算法

SHA-1

加密算法

AES 256 全血细胞计数

IKE 策略:

IKE 策略名称

IKE_POL

本地证书

Example_SRX

IKE 网关 (OAM):

IKE 策略

IKE_POL

远程 IP 地址

动态

IKE 用户类型

组 ike-ID

本地 IKE ID

主机名 srx_series.example.net

远程 IKE ID

主机名 .pico_cell.net

外部接口

reth0.0

访问配置文件

radius_pico

IKE 版本

仅 v2

IKE 网关 (3GPP):

IKE 策略

IKE_POL

远程 IP 地址

动态

IKE 用户类型

组 ike-ID

本地 IKE ID

可分辨名称通配符 OU=srx_series

远程 IKE ID

可分辨名称通配符 OU=pico_cell

外部接口

RETH1

访问配置文件

radius_pico

IKE 版本

仅 v2

IPsec 提议:

提议名称

IPSEC_PROP

协议

ESP

身份验证算法

HMAC SHA-1 96

加密算法

AES 256 全血细胞计数

IPsec 策略:

策略名称

IPSEC_POL

完全向前保密 (PFS) 密钥

group5

IPsec 提议

IPSEC_PROP

IPsec VPN (OAM):

绑定接口

st0.0

IKE 网关

OAM_GW

本地代理标识

192.168.2.0/24

远程代理身份

0.0.0.0/0

IPsec 策略

IPSEC_POL

IPsec VPN (3GPP):

绑定接口

st0.1

IKE 网关

3GPP_GW

本地代理标识

192.168.24/3.0

远程代理身份

0.0.0.0/0

IPsec 策略

IPSEC_POL

证书存储在微微单元和 SRX 系列上。

在此示例中,允许所有流量的默认安全策略用于所有设备。应为生产环境配置更严格的安全策略。请参阅 安全策略概述

配置

配置 SRX 系列

CLI 快速配置

要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到 [edit] 层级的 CLI 中,然后从配置模式进入 commit

content_copy zoom_out_map
set chassis cluster reth-count 5
set chassis cluster node 0
set chassis cluster node 1
set chassis cluster redundancy-group 0 node 0 priority 250
set chassis cluster redundancy-group 0 node 1 priority 150
set chassis cluster redundancy-group 1 node 0 priority 220
set chassis cluster redundancy-group 1 node 1 priority 149
set chassis cluster redundancy-group 1 interface-monitor ge-3/0/0 weight 255
set chassis cluster redundancy-group 1 interface-monitor ge-8/0/0 weight 255
set chassis cluster redundancy-group 1 interface-monitor ge-3/0/1 weight 255
set chassis cluster redundancy-group 1 interface-monitor ge-8/0/1 weight 255
set chassis cluster redundancy-group 1 interface-monitor ge-3/2/0 weight 255
set chassis cluster redundancy-group 1 interface-monitor ge-8/2/0 weight 255
set chassis cluster redundancy-group 1 interface-monitor ge-3/2/1 weight 255
set chassis cluster redundancy-group 1 interface-monitor ge-8/2/1 weight 255
set interfaces ge-3/0/0 gigether-options redundant-parent reth0
set interfaces ge-3/0/1 gigether-options redundant-parent reth1
set interfaces ge-3/2/0 gigether-options redundant-parent reth2
set interfaces ge-3/2/1 gigether-options redundant-parent reth3
set interfaces ge-8/0/0 gigether-options redundant-parent reth0
set interfaces ge-8/0/1 gigether-options redundant-parent reth1
set interfaces ge-8/2/0 gigether-options redundant-parent reth2
set interfaces ge-8/2/1 gigether-options redundant-parent reth3
set interfaces reth0 redundant-ether-options redundancy-group 1
set interfaces reth0 unit 0 family inet address 10.2.2.1/24
set interfaces reth1 redundant-ether-options redundancy-group 1
set interfaces reth1 unit 0 family inet address 10.3.3.1/24
set interfaces reth2 redundant-ether-options redundancy-group 1
set interfaces reth2 unit 0 family inet address 192.168.2.20/24
set interfaces reth3 redundant-ether-options redundancy-group 1
set interfaces reth3 unit 0 family inet address 192.168.3.20/24
set interfaces st0 unit 0 multipoint
set interfaces st0 unit 0 family inet address 10.12.1.20/24
set interfaces st0 unit 1 multipoint
set interfaces st0 unit 1 family inet address 10.13.1.20/24
set routing-options static route 10.1.0.0/16 next-hop 10.2.2.253
set routing-options static route 10.5.0.0/16 next-hop 10.2.2.253
set security zones security-zone untrust host-inbound-traffic system-services all
set security zones security-zone untrust host-inbound-traffic protocols all
set security zones security-zone untrust interfaces reth0.0
set security zones security-zone untrust interfaces reth1.0
set security zones security-zone oam-trust host-inbound-traffic system-services all
set security zones security-zone oam-trust host-inbound-traffic protocols all
set security zones security-zone oam-trust interfaces reth2.0
set security zones security-zone oam-trust interfaces st0.0
set security zones security-zone 3gpp-trust host-inbound-traffic system-services all
set security zones security-zone 3gpp-trust host-inbound-traffic protocols all
set security zones security-zone 3gpp-trust interfaces reth3.0
set security zones security-zone 3gpp-trust interfaces st0.1
set access profile radius_pico authentication-order radius
set access profile radius_pico radius-server 192.168.2.22 secret "$ABC123"
set access profile radius_pico radius-server 192.168.2.22 routing-instance VR-OAM
set security ike proposal IKE_PROP authentication-method rsa-signatures
set security ike proposal IKE_PROP dh-group group5
set security ike proposal IKE_PROP authentication-algorithm sha1
set security ike proposal IKE_PROP encryption-algorithm aes-256-cbc
set security ike policy IKE_POL proposals IKE_PROP
set security ike policy IKE_POL certificate local-certificate example_SRX
set security ike gateway OAM_GW ike-policy IKE_POL
set security ike gateway OAM_GW dynamic hostname .pico_cell.net
set security ike gateway OAM_GW dynamic ike-user-type group-ike-id
set security ike gateway OAM_GW local-identity hostname srx_series.example.net
set security ike gateway OAM_GW external-interface reth0.0
set security ike gateway OAM_GW aaa access-profile radius_pico
set security ike gateway OAM_GW version v2-only
set security ike gateway 3GPP_GW ike-policy IKE_POL
set security ike gateway 3GPP_GW dynamic distinguished-name wildcard OU=pico_cell
set security ike gateway 3GPP_GW dynamic ike-user-type group-ike-id
set security ike gateway 3GPP_GW local-identity distinguished-name wildcard OU=srx_series
set security ike gateway 3GPP_GW external-interface reth1.0
set security ike gateway 3GPP_GW aaa access-profile radius_pico
set security ike gateway 3GPP_GW version v2-only
set security ipsec proposal IPSEC_PROP protocol esp
set security ipsec proposal IPSEC_PROP authentication-algorithm hmac-sha1-96
set security ipsec proposal IPSEC_PROP encryption-algorithm aes-256-cbc
set security ipsec proposal IPSEC_PROP lifetime-seconds 300
set security ipsec policy IPSEC_POL perfect-forward-secrecy keys group5
set security ipsec policy IPSEC_POL proposals IPSEC_PROP
set security ipsec vpn OAM_VPN bind-interface st0.0
set security ipsec vpn OAM_VPN ike gateway OAM_GW
set security ipsec vpn OAM_VPN ike proxy-identity local 192.168.2.0/24
set security ipsec vpn OAM_VPN ike proxy-identity remote 0.0.0.0/0
set security ipsec vpn OAM_VPN ike ipsec-policy IPSEC_POL
set security ipsec vpn 3GPP_VPN bind-interface st0.1
set security ipsec vpn 3GPP_VPN ike gateway 3GPP_GW
set security ipsec vpn 3GPP_VPN ike proxy-identity local 192.168.3.0/24
set security ipsec vpn 3GPP_VPN ike proxy-identity remote 0.0.0.0/0
set security ipsec vpn 3GPP_VPN ike ipsec-policy IPSEC_POL
set routing-instances VR-OAM instance-type virtual-router
set routing-instances VR-OAM interface reth2.0
set routing-instances VR-OAM interface st0.0
set routing-instances VR-3GPP instance-type virtual-router
set routing-instances VR-3GPP interface reth3.0
set routing-instances VR-3GPP interface st0.1
set security policies default-policy permit-all
分步过程

下面的示例要求您在各个配置层级中进行导航。有关操作说明,请参阅在配置模式下使用 CLI 编辑器

要配置 SRX 系列:

  1. 配置机箱群集。

    content_copy zoom_out_map
    [edit chassis cluster]
    user@host# set reth-count 5
    user@host# set node 0
    user@host# set node 1
    user@host#set redundancy-group 0 node 0 priority 250 
    user@host#set redundancy-group 0 node 1 priority 150 
    user@host#set redundancy-group 1 node 0 priority 220 
    user@host#set redundancy-group 1 node 1 priority 149 
    user@host# set redundancy-group 1 interface-monitor ge-3/0/0 weight 255
    user@host# set redundancy-group 1 interface-monitor ge-8/0/0 weight 255
    user@host# set redundancy-group 1 interface-monitor ge-3/0/1 weight 255
    user@host# set redundancy-group 1 interface-monitor ge-8/0/1 weight 255
    user@host# set redundancy-group 1 interface-monitor ge-3/2/0 weight 255
    user@host# set redundancy-group 1 interface-monitor ge-8/2/0 weight 255
    user@host# set redundancy-group 1 interface-monitor ge-3/2/1 weight 255
    user@host# set redundancy-group 1 interface-monitor ge-8/2/1 weight 255
    
  2. 配置接口。

    content_copy zoom_out_map
    [edit interfaces]
    user@host# set ge-3/0/0 gigether-options redundant-parent reth0
    user@host# set ge-3/0/1 gigether-options redundant-parent reth1
    user@host# set ge-3/2/0 gigether-options redundant-parent reth2
    user@host# set ge-3/2/1 gigether-options redundant-parent reth3
    user@host# set ge-8/0/0 gigether-options redundant-parent reth0
    user@host# set ge-8/0/1 gigether-options redundant-parent reth1
    user@host# set ge-8/2/0 gigether-options redundant-parent reth2
    user@host# set ge-8/2/1 gigether-options redundant-parent reth3
    user@host# set reth0 redundant-ether-options redundancy-group 1
    user@host# set reth0 unit 0 family inet address 10.2.2.1/24
    user@host# set reth1 redundant-ether-options redundancy-group 1
    user@host# set reth1 unit 0 family inet address 10.3.3.1/24
    user@host# set reth2 redundant-ether-options redundancy-group 1
    user@host# set reth2 unit 0 family inet address 192.168.2.20/24
    user@host# set reth3 redundant-ether-options redundancy-group 1
    user@host# set reth3 unit 0 family inet address 192.169.3.20/24
    user@host# set st0 unit 0 multipoint
    user@host# set st0 unit 0 family inet address 10.12.1.20/24 
    user@host# set st0 unit 1 multipoint 
    user@host# set st0 unit 1 family inet address 10.13.1.20/24
    
  3. 配置路由选项。

    content_copy zoom_out_map
    [edit routing-options]
    user@host# set static route 10.1.0.0/16 next-hop 10.2.2.253
    user@host# set static route 10.5.0.0/16 next-hop 10.2.2.253
    
  4. 指定安全区域。

    content_copy zoom_out_map
    [edit security zones security-zone untrust]
    user@host# set host-inbound-traffic protocols all
    user@host# set host-inbound-traffic system-services all 
    user@host# set interfaces reth0.0
    user@host# set interfaces reth1.0
    [edit security zones security-zone oam-trust]
    user@host# set host-inbound-traffic system-services all
    user@host# set host-inbound-traffic protocols all
    user@host# set interfaces reth2.0
    user@host# set interfaces st0.0
    [edit security zones security-zone 3gpp-trust]
    user@host# set host-inbound-traffic system-services all
    user@host# set host-inbound-traffic protocols all
    user@host# set interfaces reth3.0
    user@host# set interfaces st0.1
    
  5. 创建 RADIUS 配置文件。

    content_copy zoom_out_map
    [edit access profile radius_pico]
    user@host# set authentication-order radius
    user@host# set radius-server 192.168.2.22 secret “$ABC123”
    user@host# set radius-server 192.168.2.22 routing-instance VR-OAM
    
  6. 配置第 1 阶段选项。

    content_copy zoom_out_map
    [edit security ike proposal IKE_PROP]
    user@host# set authentication-method rsa-signatures 
    user@host# set dh-group group5
    user@host# set authentication-algorithm sha1
    user@host# set encryption-algorithm aes-256-cbc
    [edit security ike policy IKE_POL]
    user@host# set proposals IKE_PROP 
    user@host# set certificate local-certificate example_SRX
    [edit security ike gateway OAM_GW]
    user@host# set ike-policy IKE_POL
    user@host# set dynamic hostname .pico_cell.net 
    user@host# set dynamic ike-user-type group-ike-id
    user@host# set local-identity hostname srx.example.net 
    user@host# set external-interface reth0.0
    user@host# set aaa access-profile radius_pico
    user@host# set version v2-only 
    [edit security ike gateway 3GPP_GW]
    user@host# set ike-policy IKE_POL
    user@host# set dynamic distinguished-name wildcard OU=pico_cell
    user@host# set dynamic ike-user-type group-ike-id
    user@host# set local-identity distinguished-name wildcard OU=srx_series
    user@host# set external-interface reth1.0
    user@host# set aaa access-profile radius_pico
    user@host# set version v2-only 
    
  7. 指定第 2 阶段选项。

    content_copy zoom_out_map
    [edit set security ipsec proposal IPSEC_PROP]
    user@host# set protocol esp 
    user@host# set authentication-algorithm hmac-sha1-96 
    user@host# set encryption-algorithm aes-256-cbc 
    user@host# set lifetime-seconds 300
    [edit security ipsec policy IPSEC_POL]
    user@host# set perfect-forward-secrecy keys group5 
    user@host# set proposals IPSEC_PROP
    [edit security ipsec vpn OAM_VPN]
    user@host# set bind-interface st0.0 
    user@host# set ike gateway OAM_GW
    user@host# set ike proxy-identity local 192.168.2.0/24
    user@host# set ike proxy-identity remote 0.0.0.0/0
    user@host# set ike ipsec-policy IPSEC_POL
    [edit security ipsec vpn 3GPP_VPN]
    user@host# set bind-interface st0.1
    user@host# set ike gateway 3GPP_GW
    user@host# set ike proxy-identity local 192.168.3.0/24
    user@host# set ike proxy-identity remote 0.0.0.0/0
    user@host# set ike ipsec-policy IPSEC_POL
    
  8. 指定路由实例。

    content_copy zoom_out_map
    [edit routing-instances VR-OAM]
    user@host# set instance-type virtual router
    user@host# set interface reth2.0
    user@host# set interface st0.0
    [edit routing-instances VR-3GPP]
    user@host# set instance-type virtual router
    user@host# set interface reth3.0
    user@host# set interface st0.1
    
  9. 指定安全策略以允许站点到站点流量。

    content_copy zoom_out_map
    [edit security policies]
    user@host# set default-policy permit-all
    
结果

在配置模式下,输入 show chassis clustershow interfacesshow security zonesshow access profile radius_picoshow security ikeshow security ipsec、 和show routing-instancesshow security policies命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的配置说明,以便进行更正。

content_copy zoom_out_map
[edit]
user@host# show chassis cluster
reth-count 5
node 0
node 1
redundancy-group 0{
    node 0 priority 250;
    node 1 priority 150;
    redundancy-group 1 {
    node 0 priority 220;
    node 1 priority 149;
    interface-monitor {
        ge-3/0/0 weight 255;
        ge-8/0/0 weight 255;
        ge-3/0/1 weight 255;
        ge-8/0/1 weight 255;
        ge-3/2/0 weight 255;
        ge-8/2/0 weight 255;
        ge-3/2/1 weight 255;
        ge-8/2/1 weight 255;
    }
}
[edit]
user@host# show interfaces
ge-3/0/0 {
    gigether-options {
        redundant-parent reth0;
    }
}
ge-3/0/1 {
    gigether-options {
        redundant-parent reth1;
    }
}
ge-3/2/0 {
    gigether-options {
        redundant-parent reth2;
    }
}
ge-3/2/1 {
    gigether-options {
        redundant-parent reth3;
    }
}
ge-8/0/0 {
    gigether-options {
        redundant-parent reth0;
    }
}
ge-8/0/1 {
    gigether-options {
        redundant-parent reth1;
    }
}
ge-8/2/0 {
    gigether-options {
        redundant-parent reth2;
    }
}
ge-8/2/1 {
    gigether-options {
        redundant-parent reth3;
    }
}
reth0 {
    redundant-ether-options {
        redundancy-group 1;
    }
    unit 0 {
        family inet {
            address 10.2.2.1/24;
        }
    }
}
reth1 {
    redundant-ether-options {
        redundancy-group 1;
    }
    unit 0 {
        family inet {
            address 10.3.3.1/24;
        }
    }
}
reth2 {
    redundant-ether-options {
        redundancy-group 1;
    }
    unit 0 {
        family inet {
            address 192.168.2.20/24;
        }
    }
}
reth3 {
    redundant-ether-options {
        redundancy-group 1;
    }
    unit 0 {
        family inet {
            address 192.168.3.20/24;
        }
    }
}
st0 {
    unit 0{
        multipoint;
        family inet {
            address 12.12.1.20/24;
        }
    }
    unit 1{
        multipoint;
        family inet {
            address 13.13.1.20/24;
        }
    }
}
[edit]
user@host# show routing-options
static {
    route 10.1.0.0/16 next-hop 10.2.2.253;
    route 10.5.0.0/16 next-hop 10.2.2.253;
}
[edit]
user@host# show security zones
security-zone untrust {
    host-inbound-traffic {
        system-services {
            all;
        }
        protocols {
            all;
        }
    }
    interfaces {
        reth1.0;
        reth0.0;
    }
}
security-zone oam-trust {
    host-inbound-traffic {
        system-services {
            all;
        }
        protocols {
            all;
        }
    }
    interfaces {
        reth2.0;
        st0.0;
    }
}
security-zone 3gpp-trust {
    host-inbound-traffic {
        system-services {
            all;
        }
        protocols {
            all;
        }
    }
    interfaces {
        reth3.0;
        st0.1;
    }
}
[edit]
user@host# show access profile radius_pico
authentication-order radius;
radius-server {
    192.168.2.22 {
        secret "$ABC123";
        routing-instance VR-OAM;
    }
}
[edit]
user@host# show security ike
proposal IKE_PROP {
    authentication-method rsa-signatures;
    dh-group group5;
    authentication-algorithm sha1;
    encryption-algorithm aes-256-cbc;
}
policy IKE_POL {
    proposals IKE_PROP;
    certificate {
        local-certificate example_SRX;
    }
}
gateway OAM_GW {
    ike-policy IKE_POL;
    dynamic {
        hostname .pico_cell.net;
        ike-user-type group-ike-id;
    }
    local-identity hostname srx_series.example.net;
    external-interface reth0.0;
    aaa access-profile radius_pico;
    version v2-only;
}
gateway 3GPP_GW {
    ike-policy IKE_POL;
    dynamic {
        distinguished-name {
            wildcard OU=pico_cell;
        }
        ike-user-type group-ike-id;
    }
    local-identity distinguished-name; 
    external-interface reth1.0;
    aaa access-profile radius_pico;
    version v2-only;
}
[edit]
user@host# show security ipsec
proposal IPSEC_PROP {
    protocol esp;
    authentication-algorithm hmac-sha1-96;
    encryption-algorithm aes-256-cbc;
    lifetime-seconds 300;
}
policy IPSEC_POL {
    perfect-forward-secrecy {
        keys group5;
    }
    proposals IPSEC_PROP;
}
vpn OAM_VPN {
    bind-interface st0.0;
    ike {
        gateway OAM_GW;
        proxy-identity {
            local 192.168.2.0/24;
            remote 0.0.0.0/0;
        }
        ipsec-policy IPSEC_POL;
    }
}
vpn 3GPP_VPN {
    bind-interface st0.1;
    ike {
        gateway 3GPP_GW;
        proxy-identity {
            local 192.168.3.0/24;
            remote 0.0.0.0/0;
        }
        ipsec-policy IPSEC_POL;
    }
}
[edit]
user@host# show routing-instances
VR-OAM {
    instance-type virtual-router;
    interface reth2.0;
    interface st0.0; 
}
VR-3GPP {
    instance-type virtual-router;
    interface reth3.0;
    interface st0.1;
}
[edit]
user@host# show security policies
default-policy {
    permit-all;
}

如果完成设备配置,请从配置模式输入 commit

配置中间路由器

CLI 快速配置

要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到 [edit] 层级的 CLI 中,然后从配置模式进入 commit

content_copy zoom_out_map
set interfaces ge-0/0/1 unit 0 family inet address 10.1.1.253/24
set interfaces ge-0/0/2 unit 0 family inet address 10.5.5.253/24
set interfaces ge-0/0/14 unit 0 family inet address 10.3.3.253/24
set interfaces ge-0/0/15 unit 0 family inet address 10.2.2.253/24
set routing-options static route 192.168.3.0/24 next-hop 10.2.2.1
set security zones security-zone trust host-inbound-traffic system-services all
set security zones security-zone trust host-inbound-traffic protocols all
set security zones security-zone trust interfaces ge-0/0/14.0
set security zones security-zone trust interfaces ge-0/0/15.0
set security zones security-zone untrust host-inbound-traffic system-services all
set security zones security-zone untrust host-inbound-traffic protocols all
set security zones security-zone untrust interfaces ge-0/0/1.0
set security zones security-zone untrust interfaces ge-0/0/2.0
set security policies default-policy permit-all
分步过程

下面的示例要求您在各个配置层级中进行导航。有关操作说明,请参阅在配置模式下使用 CLI 编辑器

要配置中间路由器:

  1. 配置接口。

    content_copy zoom_out_map
    [edit interfaces]
    user@host# set ge-0/0/1 unit 0 family inet address 10.1.1.253/24
    user@host# set ge-0/0/2 unit 0 family inet address 10.5.5.253/24
    user@host# set ge-0/0/14 unit 0 family inet address 10.3.3.253/24
    user@host# set ge-0/0/15 unit 0 family inet address 10.2.2.253/24
    
  2. 配置路由选项。

    content_copy zoom_out_map
    [edit routing-options]
    user@host# set static route 192.168.3.0/24  next-hop 10.2.2.1
    
  3. 指定安全区域。

    content_copy zoom_out_map
    [edit security zones security-zone trust]
    user@host# set host-inbound-traffic protocols all
    user@host# set host-inbound-traffic system-services all 
    user@host# set interfaces ge-0/0/14.0
    user@host# set interfaces ge-0/0/15.0
    [edit security zones security-zone untrust]
    user@host# set host-inbound-traffic system-services all
    user@host# set host-inbound-traffic protocols all
    user@host# set interfaces ge-0/0/1.0
    user@host# set interfaces ge-0/0/2.0
    
  4. 指定安全策略。

    content_copy zoom_out_map
    [edit security policies]
    user@host# set default-policy permit-all
    
结果

在配置模式下,输入 show interfacesshow routing-optionsshow security zonesshow security policies 命令,以确认您的配置。如果输出未显示预期的配置,请重复此示例中的配置说明,以便进行更正。

content_copy zoom_out_map
[edit]
user@host# show interfaces
ge-0/0/1 {
    unit 0 {
        family inet {
            address 10.1.1.253/24;
        }
    }
}
ge-0/0/2 {
    unit 0 {
        family inet {
            address 10.5.5.253/24;
        }
    }
}
ge-0/0/14 {
    unit 0 {
        family inet {
            address 10.3.3.253/24;
        }
    }
}
ge-0/0/15 {
    unit 0 {
        family inet {
            address 10.2.2.253/24;
        }
    }
}
[edit]
user@host# show routing-options
static {
    route 192.168.3.0/24 next-hop 10.2.2.1;
}
[edit]
user@host# show security zones
security-zone trust {
    host-inbound-traffic {
        system-services {
            all;
        }
        protocols {
            all;
        }
    }
    interfaces {
        ge-0/0/14.0;
        ge-0/0/15.0;
    }
}
security-zone untrust {
    host-inbound-traffic {
        system-services {
            all;
        }
        protocols {
            all;
        }
    }
    interfaces {
        ge-0/0/1.0;
        ge-0/0/2.0;
    }
}
}
[edit]
user@host# show security policies
default-policy {
    permit-all;
}

如果完成设备配置,请从配置模式输入 commit

配置微单元(示例配置)

分步过程

此示例中的 pico 单元格信息仅供参考。详细的微微单元配置信息超出了本文档的范围。微微蜂窝出厂配置必须包含以下信息:

  • 本地证书 (X.509v3) 和 IKE 身份信息

  • 流量选择器 (TSi、TSr) 值设置为任意/任意 (0.0.0.0/0)

  • SRX 系列 IKE 身份信息和公有 IP 地址

  • 与 SRX 系列配置匹配的第 1 阶段和第 2 阶段提议

此示例中的微微单元使用 strongSwan 开源软件进行基于 IPsec 的 VPN 连接。SRX 系列使用 IKEv2 配置有效负载功能将此信息用于微微信元调配。在部署了许多设备的网络中,除了证书(leftcert)和身份(leftid)信息外,微微信元配置可以相同。以下示例配置说明了出厂设置。

  1. 查看 Pico 1 配置:

    微微 1:示例配置

    content_copy zoom_out_map
    conn %default
            ikelifetime=8h
            keylife=1h
            rekeymargin=1m
            keyingtries=1
            keyexchange=ikev2
            authby=pubkey
            mobike=no
    
    conn oam
            left=%any 
            leftsourceip=%config
            leftcert=/usr/local/etc/ipsec.d/certs/<cert_name>
            leftid=pico1.pico_cell.net
            leftfirewall=yes
            reauth=yes
            right=10.2.2.1/24
            rightid=srx_series.example.net
            rightsubnet=0.0.0.0/0 #peer net for proxy id
            ike=aes256-sha-modp1536!
            esp=aes256-sha-modp1536!
            auto=add
    
    conn 3gpp
            left=%any
            leftsourceip=%config
            leftcert=/usr/local/etc/ipsec.d/certs/<cert_name>
            leftid=”C=US, ST=CA, L=Sunnyvale, O=org, OU=pico_cell, CN=pico1”
            leftfirewall=yes
            reauth=yes
            right=10.3.3.1/24
            rightid=”OU=srx_series”
            rightsubnet=0.0.0.0/0 #peer net for proxy id
            ike=aes256-sha-modp1536!
            esp=aes256-sha-modp1536!
            auto=add
    
  2. 查看 Pico 2 配置:

    Pico 2 配置示例

    content_copy zoom_out_map
    conn %default
            ikelifetime=8h
            keylife=1h
            rekeymargin=1m
            keyingtries=1
            keyexchange=ikev2
            authby=pubkey
            mobike=no
    
    conn oam
            left=%any
            leftsourceip=%config
            leftcert=/usr/local/etc/ipsec.d/certs/<cert_name>
            leftid=pico2.pico_cell.net
            leftfirewall=yes
            #reauth=no
            right=10.2.2.1/24
            rightid=srx_series.example.net
            rightsubnet=0.0.0.0/0 #peer net for proxy id
            ike=aes256-sha-modp1536!
            esp=aes256-sha-modp1536!
            auto=add
    
    conn 3gpp
            left=%any
            leftsourceip=%config
            leftcert=/usr/local/etc/ipsec.d/certs/<cert_name>
            leftid=”C=US, ST=CA, L=Sunnyvale, O=org, OU=pico_cell, CN=pico2”
            leftfirewall=yes
            #reauth=no
            right=10.3.3.1/24
            rightid=”OU=srx_series”
            rightsubnet=0.0.0.0/0 #peer net for proxy id
            ike=aes256-sha-modp1536!
            esp=aes256-sha-modp1536!
            auto=add
    

配置 RADIUS 服务器(使用 FreeRADIUS 的示例配置)

分步过程

此示例中的 RADIUS 服务器信息仅供参考。完整的 RADIUS 服务器配置信息超出了本文档的范围。RADIUS 服务器将以下信息返回到 SRX 系列:

  • 帧 IP 地址

  • 帧 IP 网络掩码(可选)

  • 主 DNS 和辅助 DNS(可选)

在此示例中,RADIUS 服务器为 OAM 和 3GPP 连接提供了单独的预配信息。用户名取自 SRX 系列授权请求中提供的客户端证书信息。

如果 RADIUS 服务器从 DHCP 服务器获取客户端调配信息,则 RADIUS 服务器中继到 DHCP 服务器的客户端身份信息必须与 SRX 系列防火墙中继到 RADIUS 服务器的客户端 IKE 身份信息一致。这确保了客户端标识跨各种协议的连续性。

SRX 系列防火墙与 RADIUS 服务器之间的通信通道受 RADIUS 共享密钥保护。

  1. 查看 Pico 1 OAM VPN 的 RADIUS 配置。RADIUS 服务器具有以下信息:

    Junos OS 12.3X48 版本和 15.1X49-D160、17.3R3、17.4R2、18.1R3、18.2R2、18.3R1 和 18.1R3-S2 之前的 Junos OS 版本 12.3X48 和 Junos OS 版本中的 RADIUS 配置示例:

    FreeRADIUS 配置示例:

    content_copy zoom_out_map
    DEFAULT User-Name =~ "device@example.net", Cleartext-Password := "juniper"
            Service-Type = Framed-User,
            Framed-IP-Address = 10.12.1.201,
            Framed-IP-Netmask = 255.255.255.255,
            Primary-Dns = 192.168.2.104,
            Secondary-Dns = 192.168.2.106,
    

    从 Junos OS 版本 15.X49-D161、15.1X49-D170、17.3R3、17.4R2、18.1R3、18.2R2、18.3R1 和 18.1R3-S2 开始的 RADIUS 配置示例:

    FreeRADIUS 配置示例:

    content_copy zoom_out_map
    DEFAULT User-Name =~ "device@example.net", Auth-Type := "Accept"
            Service-Type = Framed-User,
            Framed-IP-Address = 10.12.1.201,
            Framed-IP-Netmask = 255.255.255.255,
            Primary-Dns = 192.168.2.104,
            Secondary-Dns = 192.168.2.106,
    

    在这种情况下,RADIUS 服务器提供默认子网掩码 (255.255.255.255),用于阻止对等内流量。

  2. 查看 Pico 1 3GPP VPN 的 RADIUS 配置。RADIUS 服务器具有以下信息:

    Junos OS 12.3X48 版本和 15.1X49-D160、17.3R3、17.4R2、18.1R3、18.2R2、18.3R1 和 18.1R3-S2 之前的 Junos OS 版本 12.3X48 和 Junos OS 版本中的 RADIUS 配置示例:

    FreeRADIUS 配置示例:

    content_copy zoom_out_map
    DEFAULT User-Name =~ "device@example.net", Cleartext-Password := "juniper"
           Service-Type = Framed-User,
            Framed-IP-Address = 10.13.1.201.10,
            Framed-IP-Netmask = 255.255.0.0, 
            Primary-Dns = 192.168.2.104,
            Secondary-Dns = 192.168.2.106,
    

    从 Junos OS 版本 15.X49-D161、15.1X49-D170、17.3R3、17.4R2、18.1R3、18.2R2、18.3R1 和 18.1R3-S2 开始的 RADIUS 配置示例:

    FreeRADIUS 配置示例:

    content_copy zoom_out_map
    DEFAULT User-Name =~ "device@example.net", Auth-Type := "Accept"
           Service-Type = Framed-User,
            Framed-IP-Address = 10.13.1.201.10,
            Framed-IP-Netmask = 255.255.0.0, 
            Primary-Dns = 192.168.2.104,
            Secondary-Dns = 192.168.2.106,
    

    在这种情况下,RADIUS 服务器提供子网掩码值 (255.255.0.0),用于启用对等内流量。

    从 Junos OS 20.1R1 版开始,您可以为 IKE 网关配置的 IKEv2 配置有效负载请求配置通用密码。1 到 128 个字符范围内的通用密码允许管理员定义通用密码。当 SRX 系列防火墙使用 IKEv2 配置有效负载代表远程 IPsec 对等方请求 IP 地址时,将在 SRX 系列防火墙和 RADIUS 服务器之间使用此密码。RADIUS 服务器先验证凭据,然后再向 SRX 系列防火墙提供配置有效负载请求的任何 IP 信息。您可以使用层次结构级别的配置语句[edit security ike gateway gateway-name aaa access-profile access-profile-name]配置config-payload-password configured-password通用密码。此外,此示例通过将证书的不同部分用于用户名 (IKE 标识) 信息,从同一客户端证书创建两个隧道。

验证

确认配置工作正常。

验证 SRX 系列的 IKE 第 1 阶段状态

目的

验证 IKE 第 1 阶段状态。

操作

在节点 0 上的操作模式下,输入 show security ike security-associations 命令。从命令获取索引号之后,请使用 show security ike security-associations detail 命令。

content_copy zoom_out_map
user@host# show security ike security-associations 
node0:
--------------------------------------------------------------------------
Index      State  Initiator cookie  Responder cookie  Mode  Remote Address
553329718  UP     99919a471d1a5278  3be7c5a49172e6c2  IKEv2 10.1.1.1
1643848758 UP     9e31d4323195a195  4d142438106d4273  IKEv2 10.1.1.1
content_copy zoom_out_map
user@host# show security ike security-associations index 553329718 detail
node0:
--------------------------------------------------------------------------
IKE peer 10.1.1.1, Index 553329718, Gateway Name: OAM_GW
  Location: FPC 2, PIC 0, KMD-Instance 1
  Role: Responder, State: UP
  Initiator cookie: 99919a471d1a5278, Responder cookie: 3be7c5a49172e6c2
  Exchange type: IKEv2, Authentication method: RSA-signatures
  Local: 10.2.2.1:500, Remote: 10.1.1.1:500
  Lifetime: Expires in 28738 seconds
  Peer ike-id: C=US, ST=CA, L=Sunnyvale, O=org, OU=pico_cell, CN=pico1
  aaa assigned IP: 10.12.1.201
  Algorithms:
   Authentication        : hmac-sha1-96
   Encryption            : aes256-cbc
   Pseudo random function: hmac-sha1
   Diffie-Hellman group  : DH-group-5
  Traffic statistics:
   Input  bytes  :                 2104
   Output bytes  :                  425
  Input  packets:                    2
   Output packets:                    1
  IPSec security associations: 0 created, 0 deleted
  Phase 2 negotiations in progress: 1
意义

show security ike security-associations 命令将列出所有带有微微单元设备的活动 IKE 第 1 阶段 SA。如果未列出任何 SA,则第 1 阶段建立存在问题。检查配置中的 IKE 策略参数和外部接口设置。此示例仅显示 OAM VPN 的 IKE 第 1 阶段 SA;但是,将显示单独的 IKE 第 1 阶段 SA,显示 3GPP VPN 的 IKE 第 1 阶段参数。

如果列出了 SA,请查看以下信息:

  • 索引 - 此值对于每个 IKE SA 都是唯一的:您可以使用命令 show security ike security-associations index detail 获取有关 SA 的更多信息。

  • 远程地址 — 验证本地 IP 地址是否正确,以及端口 500 是否用于对等通信。

  • 角色响应程序状态:

    • Up — 第 1 阶段 SA 已建立。

    • 关闭 — 建立第 1 阶段 SA 时出现问题。

  • 对等(远程)IKE ID — 验证证书信息是否正确。

  • 本地身份和远程身份 - 验证这些地址是否正确。

  • 模式 - 验证是否使用了正确的模式。

验证配置中的以下各项是否正确:

  • 外部接口(接口必须是发送 IKE 数据包的接口)

  • IKE 策略参数

  • 第 1 阶段提议参数(对等方之间必须匹配)

show security ike security-associations 命令将列出以下有关安全关联的附加信息:

  • 使用的身份验证和加密算法

  • 第 1 阶段生存期

  • 流量统计(可用于验证流量是否在两个方向上正常流动)

  • 角色信息

    最好使用响应方角色在对等方上执行故障排除。

  • 发起方和响应方信息

  • 创建的 IPsec SA 数

  • 正在进行的第 2 阶段协商数

验证 SRX 系列的 IPsec 安全关联

目的

验证 IPsec 状态。

操作

在节点 0 上的操作模式下,输入 show security ipsec security-associations 命令。从命令获取索引号之后,请使用 show security ipsec security-associations detail 命令。

content_copy zoom_out_map
user@host# show security ipsec security-associations
node0:
--------------------------------------------------------------------------
  Total active tunnels: 2
  ID         Algorithm             SPI     Life:sec/kb Mon lsys Port Gateway
  <214171651 ESP:aes-cbc-256/sha1 cc2869e2 3529/        -  root 500  10.1.1.1
  >214171651 ESP:aes-cbc-256/sha1 c0a54936 3529/        -  root 500  10.1.1.1
  <205520899 ESP:aes-cbc-256/sha1 84e49026 3521/        -  root 500  10.1.1.1
  >205520899 ESP:aes-cbc-256/sha1 c4ed1849 3521/        -  root 500  10.1.1.1
content_copy zoom_out_map
user@host# show security ipsec security-associations detail
node0:
--------------------------------------------------------------------------
Port: 500, Nego#: 0, Fail#: 0, Def-Del#: 0 Flag: 0x604a29
Last Tunnel Down Reason: SA not initiated
  ID: 214171651 Virtual-system: root, VPN Name: 3GPP_VPN
  Local Gateway: 10.3.3.1, Remote Gateway: 10.1.1.1
  Local Identity: list(any:0,ipv4_subnet(any:0-65535,[0..7]=192.168.3.0/24), ipv4_subnet(any:0-65535,[0..7]=10.13.0.0/16))
  Remote Identity: ipv4(any:0,[0..3]=10.13.1.201)
    DF-bit: clear
    Bind-interface: st0.1

  Port: 500, Nego#: 0, Fail#: 0, Def-Del#: 0 Flag: 0x608a29
  Last Tunnel Down Reason: SA not initiated
    Location: FPC 6, PIC 0, KMD-Instance 2
    Direction: inbound, SPI: cc2869e2, AUX-SPI: 0
                              , VPN Monitoring: -
    Hard lifetime: Expires in 3523 seconds
    Lifesize Remaining:  
    Soft lifetime: Expires in 2965 seconds
    Mode: Tunnel(0 0), Type: dynamic, State: installed
    Protocol: ESP, Authentication: hmac-sha1-96, Encryption: aes-cbc (256 bits)
    Anti-replay service: counter-based enabled, Replay window size: 64

    Location: FPC 6, PIC 0, KMD-Instance 2
    Direction: outbound, SPI: c0a54936, AUX-SPI: 0
                              , VPN Monitoring: -
    Hard lifetime: Expires in 3523 seconds
    Lifesize Remaining:  
    Soft lifetime: Expires in 2965 seconds
    Mode: Tunnel(0 0), Type: dynamic, State: installed
    Protocol: ESP, Authentication: hmac-sha1-96, Encryption: aes-cbc (256 bits)
    Anti-replay service: counter-based enabled, Replay window size: 64

  ID: 205520899 Virtual-system: root, VPN Name: OAM_VPN
  Local Gateway: 10.2.2.1, Remote Gateway: 10.1.1.1
  Local Identity: ipv4_subnet(any:0-65535,[0..7]=192.168.2.0/24)
  Remote Identity: ipv4(any:0,[0..3]=10.12.1.201)
  Version: IKEv2
    DF-bit: clear
    Bind-interface: st0.0

  Port: 500, Nego#: 0, Fail#: 0, Def-Del#: 0 Flag: 0x608a29
  Last Tunnel Down Reason: SA not initiated
    Location: FPC 2, PIC 0, KMD-Instance 1
    Direction: inbound, SPI: 84e49026, AUX-SPI: 0
                              , VPN Monitoring: -
    Hard lifetime: Expires in 3515 seconds
    Lifesize Remaining:  
    Soft lifetime: Expires in 2933 seconds
    Mode: Tunnel(0 0), Type: dynamic, State: installed
    Protocol: ESP, Authentication: hmac-sha1-96, Encryption: aes-cbc (256 bits)
    Anti-replay service: counter-based enabled, Replay window size: 64

    Location: FPC 2, PIC 0, KMD-Instance 1
    Direction: outbound, SPI: c4ed1849, AUX-SPI: 0
                              , VPN Monitoring: -
    Hard lifetime: Expires in 3515 seconds
    Lifesize Remaining:  
    Soft lifetime: Expires in 2933 seconds
    Mode: Tunnel(0 0), Type: dynamic, State: installed
    Protocol: ESP, Authentication: hmac-sha1-96, Encryption: aes-cbc (256 bits)
    Anti-replay service: counter-based enabled, Replay window size: 64
意义

此示例显示了 Pico 1 的活动 IKE 第 2 阶段 SA。如果未列出任何 SA,则第 2 阶段建立存在问题。检查配置中的 IPsec 策略参数。对于每个第 2 阶段 SA(OAM 和 3GPP),都会在入站和舷外方向上提供信息。show security ipsec security-associations 命令输出列出以下信息:

  • 远程网关的 IP 地址为 10.1.1.1。

  • 两个方向都会显示 SPI、生存期(以秒为单位)和使用限制(或生存大小,以 KB 为单位)。3529/ 值表示第 2 阶段生存期将在 3529 秒后过期,并且未指定生存大小,表示它是无限的。第 2 阶段生存期可能与第 1 阶段生存期不同,因为在 VPN 启动后,第 2 阶段不依赖于第 1 阶段。

  • 如 Mon 列中的连字符所示,没有为此 SA 启用 VPN 监控。如果启用 VPN 监控,U 表示监控已开启,而 D 表示监控已关闭。

  • 虚拟系统 (vsys) 是根系统,始终列出 0。

命令 show security ipsec security-associations index index_id detail 的上述输出列出了以下信息:

  • 本地身份和远程身份组成 SA 的代理 ID。

    代理 ID 不匹配是第 2 阶段故障的最常见原因之一。如果未列出 IPsec SA,请确认第 2 阶段提议(包括代理 ID 设置)对于两个对等方都是正确的。对于基于路由的 VPN,默认代理 ID 为本地 = 0.0.0.0/0,远程 = 0.0.0.0/0,服务 = any。来自相同对等方 IP 的多个基于路由的 VPN 可能会出现问题。在这种情况下,必须为每个 IPsec SA 指定唯一的代理 ID。对于某些第三方供应商,必须手动输入代理 ID 以进行匹配。

  • 使用的身份验证和加密算法。

  • 第 2 阶段提议参数(对等方之间必须匹配)。

  • 与 OAM 和 3GPP 网关的安全隧道(st0.0 和 st0.1)绑定。

具有可信 CA 的 IKE 策略

此示例说明如何将受信任的 CA 服务器绑定到对等方的 IKE 策略。

在开始之前,您必须具有要与对等方的 IKE 策略关联的所有可信 CA 的列表。

您可以将 IKE 策略关联到单个受信任的 CA 配置文件或受信任的 CA 组。为了建立安全连接,IKE 网关使用 IKE 策略在验证证书时将自身限制为已配置的 CA 组(CA 配置文件)。不会验证由受信任的 CA 或受信任的 CA 组以外的任何源颁发的证书。如果存在来自 IKE 策略的证书验证请求,则 IKE 策略的关联 CA 配置文件将验证证书。如果 IKE 策略未与任何 CA 关联,则默认情况下,证书将由任何一个已配置的 CA 配置文件进行验证。

在此示例中,将创建名为的 root-ca CA 配置文件,并将 与 root-ca-identity 该配置文件关联。

您最多可以配置要添加到受信任 CA 组的 20 个 CA 配置文件。如果在受信任的 CA 组中配置 20 个以上的 CA 配置文件,则无法提交配置。

  1. 创建 CA 配置文件并将 CA 标识符关联到该配置文件。
    content_copy zoom_out_map
    [edit]
    user@host# set security pki ca-profile root-ca ca-identity root-ca
    
  2. 定义 IKE 提议和 IKE 提议身份验证方法。
    content_copy zoom_out_map
    [edit]
    user@host# set security ike proposal ike_prop authentication-method rsa-signatures 
    
  3. 定义 Diffie-Hellman 组、身份验证算法、IKE 提议的加密算法。
    content_copy zoom_out_map
    [edit]
    user@host# set security ike proposal ike_prop dh-group group2
    user@host# set security ike proposal ike_prop authentication-algorithm sha-256
    user@host# set security ike proposal ike_prop encryption-algorithm aes-256-cbc
    
  4. 配置 IKE 策略并将该策略与 IKE 提议相关联。
    content_copy zoom_out_map
    [edit]
    user@host# set security ike policy ike_policy proposals ike_prop
    
  5. 为 IKE 策略配置本地证书标识符。
    content_copy zoom_out_map
    [edit]
    user@host# set security ike policy ike_policy certificate local-certificate SPOKE
    
  6. 定义要用于 IKE 策略的 CA。
    content_copy zoom_out_map
    [edit]
    user@host# set security ike policy ike_policy certificate trusted-ca ca-profile root-ca
    

要查看设备上配置的 CA 配置文件和受信任的 CA 组,请运行 show security pki 命令。

content_copy zoom_out_map
user@host# show security ike 
    proposal ike_prop {
    authentication-method rsa-signatures;
    dh-group group2;
    authentication-algorithm sha-256;
    encryption-algorithm aes-256-cbc;
}
policy ike_policy {
    proposals ike_prop;
    certificate {
        local-certificate SPOKE;
        trusted-ca ca-profile root-ca;
    }
}

该命令在 show security ike 名为的 ike_policy IKE 策略下显示 CA 配置文件组以及与 IKE 策略关联的证书。

footer-navigation