帮助我们改善您的体验。

让我们了解您的想法。

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

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 仅提供英文版.

虚拟路由器中的安全隧道接口

date_range 18-Jan-25

安全隧道接口 (st0) 是基于路由的 VPN 用来将明文流量路由到 IPsec VPN 隧道的内部接口。

了解虚拟路由器对基于路由的 VPN 的支持

此功能包括对基于路由的 VPN 的路由实例支持。在以前的版本中,当 st0 接口放置在非默认路由实例中时,此接口上的 VPN 隧道无法正常工作。在 Junos OS 10.4 版本中,支持将 st0 接口放置在路由实例中,其中每个单元都配置为点对点模式或多点模式。因此,VPN 流量现在可以在非默认 VR 中正常工作。现在,您可以在不同的路由实例中配置 st0 接口的不同子单元。非默认路由实例支持以下函数:

  • 手动密钥管理

  • 过境交通

  • 自流量

  • VPN 监控

  • 中心辐射型 VPN

  • 封装安全有效负载 (ESP) 协议

  • 认证头 (AH) 协议

  • 积极模式或主模式

  • St0 锚定在环路 (LO0) 接口上

  • SRX 系列防火墙支持的最大虚拟路由器 (VR) 数量

  • 应用层网关 (ALG)、入侵检测和防御 (IDP) 以及内容安全等应用

  • 失效对等体检测 (DPD)

  • 机箱群集 主动/备份

  • 基于 st0 的开放最短路径优先 (OSPF)

  • 通过 st0 的路由信息协议 (RIP)

  • VR 中基于策略的 VPN

了解虚拟路由器限制

在 SRX 系列防火墙上配置 VPN 时,支持跨虚拟路由器的 IP 地址重叠,但存在以下限制:

  • IKE 外部接口地址不能与任何其他虚拟路由器重叠。

  • 内部或信任接口地址可以在任何其他虚拟路由器之间重叠。

  • st0 接口地址不能在点对多点隧道(如 NHTB)中基于路由的 VPN 中重叠。

  • 在点对点隧道中基于路由的 VPN 中,st0 接口地址可以重叠。

示例:在虚拟路由器中配置 st0 接口

此示例说明如何在虚拟路由器中配置 st0 接口。

要求

开始之前,请配置接口并将接口分配给安全区域。请参阅“安全区域概述”。

概述

在本示例中,您将执行以下操作:

  • 配置接口。

  • 配置 IKE 第 1 阶段提议。

  • 配置 IKE 策略并引用提议。

  • 配置 IKE 网关并引用策略。

  • 配置第 2 阶段提议。

  • 配置策略并引用提议。

  • 配置 AutoKey IKE,并引用策略和网关。

  • 配置安全策略。

  • 配置路由实例。

  • 配置 VPN 绑定到隧道接口。

  • 配置路由选项。

图 1 显示了此示例中使用的拓扑。

图 1: 虚拟路由器中的安全隧道接口

配置参数如下表所示。

表 1: SRX1 的接口、路由实例、静态路由和安全区域信息

功能

名称

配置参数

接口

ge-0/0/0.0

10.1.1.2/30

 

ge-0/0/1.0

10.2.2.2/30

 

st0.0(隧道接口)

10.3.3.2/30

路由实例(虚拟路由器)

VR1

ge-0/0/1.0

st0.0

静态路由

10.6.6.0/24

下一跃点为 st0.0。

安全区域

trust

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

 

untrust

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

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

表 2: IKE 配置参数

功能

名称

配置参数

提议

first_ikeprop

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

策略

first_ikepol

  • 模式:主

  • 提议参考:first_ikeprop

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

网关

第一

  • IKE 策略参考:first_ikepol

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

  • 网关地址:10.4.4.2

表 3: IPsec 配置参数

功能

名称

配置参数

提议

first_ipsecprop

  • 协议:esp

  • 验证算法:HMAC-MD5-96

  • 加密算法:3DES-CBC

策略

first_ipsecpol

  • IPsec 提议参考:first_ipsecprop

VPN

first_vpn

  • IKE 网关参考:第一

  • IPsec 策略参考:first_ipsecpol

  • 绑定到接口:st0.0

  • 立即建立隧道

配置

程序

CLI 快速配置

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

content_copy zoom_out_map
set interfaces ge-0/0/0 unit 0 family inet address 10.1.1.2/30
set interfaces ge-0/0/1 unit 0 family inet address 10.2.2.2/30
set interfaces st0 unit 0 family inet address 10.3.3.2/30
set security zones security-zone trust interfaces ge-0/0/1
set security zones security-zone untrust interfaces ge-0/0/0
set security zones security-zone untrust interfaces st0.0
set security ike proposal first_ikeprop authentication-method pre-shared-keys 
set security ike proposal first_ikeprop dh-group group2 
set security ike proposal first_ikeprop authentication-algorithm md5
set security ike proposal first_ikeprop encryption-algorithm 3des-cbc
set security ike policy first_ikepol mode main
set security ike policy first_ikepol proposals first_ikeprop
set security ike policy first_ikepol pre-shared-key ascii-text "$ABC123"
set security ike gateway first ike-policy first_ikepol
set security ike gateway first address 10.4.4.2
set security ike gateway first external-interface ge-0/0/0.0
set security ipsec proposal first_ipsecprop protocol esp
set security ipsec proposal first_ipsecprop authentication-algorithm hmac-md5-96
set security ipsec proposal first_ipsecprop encryption-algorithm 3des-cbc
set security ipsec policy first_ipsecpol perfect-forward-secrecy keys group1
set security ipsec policy first_ipsecpol proposals first_ipsecprop
set security ipsec vpn first_vpn bind-interface st0.0
set security ipsec vpn first_vpn ike gateway first
set security ipsec vpn first_vpn ike ipsec-policy first_ipsecpol
set security ipsec vpn first_vpn establish-tunnels immediately  
set security policies from-zone trust to-zone untrust policy p1 match source-address any
set security policies from-zone trust to-zone untrust policy p1 match destination-address any
set security policies from-zone trust to-zone untrust policy p1 match application any
set security policies from-zone trust to-zone untrust policy p1 then permit
set security policies from-zone untrust to-zone trust policy p2 match source-address any
set security policies from-zone untrust to-zone trust policy p2 match destination-address any
set security policies from-zone untrust to-zone trust policy p2 match application any
set security policies from-zone untrust to-zone trust policy p2 then permit
set routing-instances VR1 instance-type virtual-router
set routing-instances VR1 interface ge-0/0/1.0
set routing-instances VR1 interface st0.0  
set routing-instances VR1 routing-options static route 10.6.6.0/24 next-hop st0.0
分步过程

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

要在 VR 中配置 st0:

  1. 配置接口。

    content_copy zoom_out_map
    [edit]
    user@host# set interfaces ge-0/0/0 unit 0 family inet address 10.1.1.2/30
    user@host# set interfaces ge-0/0/1 unit 0 family inet address 10.2.2.2/30
    user@host# set interfaces st0 unit 0 family inet address 10.3.3.2/30
    
  2. 配置安全区域。

    content_copy zoom_out_map
    [edit]
    user@host# set security zones security-zone trust interfaces ge-0/0/1
    user@host# set security zones security-zone untrust interfaces ge-0/0/0
    user@host# set security zones security-zone untrust interfaces st0.0
    
  3. 配置 IPsec 隧道的第 1 阶段。

    content_copy zoom_out_map
    [edit security ike]
    user@host# set proposal first_ikeprop authentication-method pre-shared-keys
    user@host# set proposal first_ikeprop dh-group group2
    user@host# set proposal first_ikeprop authentication-algorithm md5
    user@host# set proposal first_ikeprop encryption-algorithm 3des-cbc
    
  4. 配置 IKE 策略并引用提议。

    content_copy zoom_out_map
    [edit security ike]
    user@host# set policy first_ikepol mode main
    user@host# set policy first_ikepol proposals first_ikeprop
    user@host# set policy first_ikepol pre-shared-key ascii-text "$ABC123"
    
  5. 配置 IKE 网关并引用策略。

    content_copy zoom_out_map
    [edit security ike]
    user@host# set gateway first ike-policy first_ikepol
    user@host# set gateway first address 10.4.4.2
    user@host# set gateway first external-interface ge-0/0/0.0
    
  6. 配置 IPsec 隧道的第 2 阶段。

    content_copy zoom_out_map
    [edit security ipsec]
    user@host# set proposal first_ipsecprop protocol esp
    user@host# set proposal first_ipsecprop authentication-algorithm hmac-md5-96
    user@host# set proposal first_ipsecprop encryption-algorithm 3des-cbc
    
  7. 配置策略并引用提议。

    content_copy zoom_out_map
    [edit security ipsec]
    user@host# set policy first_ipsecpol perfect-forward-secrecy keys group1
    user@host# set policy first_ipsecpol proposals first_ipsecprop
    
  8. 配置 AutoKey IKE,并引用策略和网关。

    content_copy zoom_out_map
    [edit security ipsec]
    user@host# set vpn first_vpn ike gateway first
    user@host# set vpn first_vpn ike ipsec-policy first_ipsecpol
    user@host# set vpn first_vpn establish-tunnels immediately
    
  9. 配置 VPN 绑定到隧道接口。

    content_copy zoom_out_map
    [edit security ipsec]
    user@host# set vpn first_vpn bind-interface st0.0
    
  10. 配置安全策略。

    content_copy zoom_out_map
    [edit security policies]
    user@host# set from-zone trust to-zone untrust policy p1 match source-address any
    user@host# set from-zone trust to-zone untrust policy p1 match destination-address any
    user@host# set from-zone trust to-zone untrust policy p1 match application any
    user@host# set from-zone trust to-zone untrust policy p1 then permit
    user@host# set from-zone untrust to-zone trust policy p2 match source-address any
    user@host# set from-zone untrust to-zone trust policy p2 match destination-address any
    user@host# set from-zone untrust to-zone trust policy p2 match application any
    user@host# set from-zone untrust to-zone trust policy p2 then permit
    
  11. 在路由实例中配置 st0。

    content_copy zoom_out_map
    [edit routing-instances]
    user@host# set VR1 instance-type virtual-router
    user@host# set VR1 interface ge-0/0/1.0
    user@host# set VR1 interface st0.0 
    
  12. 配置路由选项。

    content_copy zoom_out_map
    [edit routing-instances VR1 routing-options]
    user@host# set static route 10.6.6.0/24 next-hop st0.0
    
结果

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

content_copy zoom_out_map
user@host# show security
    ike {
    proposal first_ikeprop {
        authentication-method pre-shared-keys;
        dh-group group2;
        authentication-algorithm md5;
        encryption-algorithm 3des-cbc;
    }
    policy first_ikepol {
        mode main;
        proposals first_ikeprop;
        pre-shared-key ascii-text "$ABC123"; ## SECRET-DATA
    }
    gateway first {
        ike-policy first_ikepol;
        address 10.4.4.2;
        external-interface ge-0/0/0.0;
    }
}
    ipsec {
        proposal first_ipsecprop {
            protocol esp;
            authentication-algorithm hmac-md5-96;
            encryption-algorithm 3des-cbc;
        }
        policy first_ipsecpol {
            perfect-forward-secrecy {
                keys group1;
            }
            proposals first_ipsecprop;
        }
        vpn first_vpn {
            bind-interface st0.0;
            ike {
                gateway first;
                ipsec-policy first_ipsecpol;
            }
            establish-tunnels immediately;
        }
    }
policies {
    from-zone trust to-zone untrust {
        policy p1 {
            match {
                source-address any;
                destination-address any;
                application any;
            }
            then {
                permit;
            }
        }
    }
        from-zone untrust to-zone trust {
            policy p2 {
                match {
                    source-address any;
                    destination-address any;
                    application any;
                }
                then {
                    permit;
                }
            }
        }
zones {
    security-zone trust {
        interfaces {
            ge-0/0/1.0;
        }
    }
    security-zone untrust {
        interfaces {
            ge-0/0/0.0;
            st0.0;
        }
    }
}
    
user@host# show routing-instances
        VR1 {
            instance-type virtual-router;
            interface ge-0/0/1.0;
            interface st0.0; 
            routing-options {
            static {
            route 10.6.6.0/24 next-hop st0.0;
        }
    }
}

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

验证

要确认配置工作正常,请执行以下任务:

验证虚拟路由器中的 st0 接口

目的

验证虚拟路由器中的 st0 接口。

操作

在操作模式下,输入 show interfaces st0.0 detail 命令。为路由表列出的编号对应于路由表在命令中的 show route all 顺序。

footer-navigation