Configuring VPN on a Device Running Junos OS
This section describes sample configurations of an IPsec VPN on a Junos OS device using the following IKE authentication methods:
Configuring VPN on a Device Running Junos OS Overview
This section describes sample configurations of an IPsec VPN on a Junos OS device using the following IKE authentication methods:
-
Configuring an IPsec VPN with an RSA Signature for IKE Authentication
-
Configuring an IPsec VPN with an ECDSA Signature for IKE Authentication
Figure 1 illustrates the VPN topology used in all the examples described in this section. Here, H0 and H1 are the host PCs, R0 and R2 are the two endpoints of the IPsec VPN tunnel, and R1 is a router to route traffic between the two different networks.
The router R1 can be a Linux-based router, a Juniper Networks device, or any other vendor router.
Table 1 provides a complete list of the supported IKE protocols, tunnel modes, Phase 1 negotiation mode, authentication method or algorithm, encryption algorithm, DH groups supported for the IKE authentication and encryption (Phase1, IKE Proposal), and for IPsec authentication and encryption (Phase2, IPsec Proposal). The listed protocols, modes, and algorithms are supported and required for 23.4R1 Common Criteria.
|
IKE Protocol |
Tunnel Mode |
Phase1 Negotiation Mode |
Phase 1 Proposal (P1, IKE) |
|||
|---|---|---|---|---|---|---|
|
Authentication Method |
Authentication Algorithm |
DH Group |
Encryption Algorithm |
|||
|
IKEv1 |
Main |
Route |
rsa-signatures (with RSA key sizes 2048 or 4096) ecdsa-signatures-256 ecdsa-signatures-384 |
sha-256 sha-384 |
group14 group19 group20 |
aes-128-cbc aes-128-gcm aes-192-cbc aes-256-cbc aes-256-gcm |
|
IKEv2 |
||||||
|
IKE Protocol |
Tunnel Mode |
Phase1 Negotiation Mode |
Phase 2 Proposal (P2, IPsec) |
|||
|---|---|---|---|---|---|---|
|
Authentication Algorithm |
DH Group (PFS) |
Encryption Method |
Encryption Algorithm |
|||
|
IKEv1 |
Main |
Route |
hmac-sha1-96 hmac-sha-256-128 |
group14 group19 group20 |
ESP |
aes-128-cbc aes-128-gcm aes-192-cbc aes-256-cbc aes-256-gcm |
|
IKEv2 |
||||||
Network Address Translation-Traversal (NAT-T) is not supported in IPsec VPN.
Juniper Networks devices always operate in tunnel mode for IPsec tunnels. No additional configuration is required for the TOE to operate in tunnel mode.
The following sections provide sample configurations of IKEv1 IPsec VPN examples for selected
algorithms. Authentication and encryption algorithms can be replaced in the configurations to
accomplish the user’s desired configurations. Use set security ike gateway
<gw-name> version v1-only command for IKEv1 IPsec VPN and set security
ike gateway <gw-name> version v2-only command for IKEv2 IPsec VPN.
The TOE supports the use of an IP address, Fully Qualified Domain Name (FQDN) or user FQDN in the SAN field of the certificate as reference identifiers, along with the Distinguished Name (DN). CN reference identifiers are not supported and contents of the field are disregarded, unless the DN reference identifier is being used. The TOE validates reference identifiers by comparing the configured identifier against the SAN or DN field of the presented peer certificate depending on the configured identifier. The connection is only accepted on an exact match between the two.
- Configuring the Lifetime for an IPsec SA
- Configuring an IPsec VPN with an RSA Signature for IKE Authentication
- Configuring an IPsec VPN with an ECDSA Signature for IKE Authentication
Configuring the Lifetime for an IPsec SA
In the evaluated configuration, the TOE permits configuration of the:
-
IKEv1 Phase 1 and IKEv2 SA lifetimes in terms of length of time (180 to 86,400 seconds i.e. 0.05 to 24 hours),
-
IKEv1 Phase 2 SA in terms of length of time (180 to 28,800 seconds i.e. 0.05 to 8 hours)
-
IKEv2 Child SA lifetimes in terms of kilobytes (64 to 4,294,967,294) and length of time (180 to 28,800 seconds i.e. 0.05 to 8 hours).
The TOE implements the following CLI commands to configure the Phase 1 lifetime in seconds:
set security ike proposal <name>
lifetime-seconds <seconds>
A lifetime value of 23 hour 40 mins or less must be configured as the Phase 1 lifetime to ensure the rekey happening before the 24 hour mark.
Phase 2/Child SA lifetime is configured in seconds using the following command:
set security ipsec proposal <name> lifetime-seconds <seconds>
When configured with a Phase 2 lifetime of 8 hours (28800 seconds), the device initiates a rekey before reaching the lifetime to ensure continuous VPN connectivity. Instead of rekeying exactly at the lifetime expiration, the device triggers a rekey at around 98% of the configured value.
For example: when configured with a lifetime value of 8 hours (28800 seconds) the actual rekey happens at around the 7 hour 50 mins mark (28200 seconds).
To ensure rekeying happens on time, administrators should configure the Phase 2 lifetime values accordingly, knowing that the device will initiate rekeying before the full duration is reached.
Child SA lifetime is configured in kilobytes using the following command:
set security ipsec proposal <name>
lifetime-kilobytes
<kb>Configuring an IPsec VPN with an RSA Signature for IKE Authentication
The following section provides an example to configure Junos OS devices for IPsec VPN using RSA Signature as IKE Authentication method, whereas, the algorithms used in IKE/IPsec authentication/encryption is as shown in the following table. In this section, the administrator can configure devices running Junos OS for IPsec VPN using an RSA signature as the IKE authentication method. The algorithms used in IKE or IPsec authentication or encryption is shown in Table 2.
|
IKE Protocol |
Tunnel Mode |
Phase1 Negotiation Mode |
Phase 1 Proposal (P1, IKE) |
|||
|---|---|---|---|---|---|---|
|
Authentication Method |
Authentication Algorithm |
DH Group |
Encryption Algorithm |
|||
|
IKEv1 |
Main |
Route |
rsa-signatures (with RSA key size 2048) |
sha-256 |
group19 |
aes-128-cbc |
|
IKE Protocol |
Tunnel Mode |
Phase1 Negotiation Mode |
Phase 2 Proposal (P2, IPsec) |
|||
|---|---|---|---|---|---|---|
|
Authentication Algorithm |
DH Group (PFS) |
Encryption Method |
Encryption Algorithm |
|||
|
IKEv1 |
Main |
Route |
hmac-sha-256-128 |
group19 |
ESP |
aes-128-cbc |
- Generating or Deleting key-pair for IKE Endpoint Authentication
- Configuring IPsec VPN with RSA Signature as IKE Authentication on the Initiator or Responder
Generating or Deleting key-pair for IKE Endpoint Authentication
To generate a key-pair for IKE endpoint authentication, enter the following command:
For RSA:
request security pki generate-key-pair certificate-id 1 type rsa size [2048|4096]
For ECDSA:
request security pki generate-key-pair certificate-id 1 type ecdsa size [256|384]
Location of PKI Keys and Certificates:
-
Private Keys– Stored securely in the device’s internal key storage. The administrator don’t directly access the private key file; instead, they reference it by label or certificate name.
-
Public Keys / Certificates– Typically stored in the /var/db/certs/ directory or managed via the Junos configuration hierarchy under: /etc/ssl/certs/ /var/db/config/
CA Certificates– Loaded from external files and associated with a CA profile. These are referenced in the configuration, not manually browsed.
Format Details:
-
Key Format– RSA keys are most common, generated in PEM format.
-
Certificate Format– X.509 standard, also in PEM format.
-
CSR Format– PKCS#10, used when requesting certificates from a CA.
To delete a key-pair for IKE endpoint authentication, enter the following command:
clear security pki key-pair (all | certificate-id certificate-id-name)
Configuring IPsec VPN with RSA Signature as IKE Authentication on the Initiator or Responder
To configure the IPsec VPN with RSA signature IKE authentication on the initiator:
Configure the PKI, generate and load the CA certificate, local certificate and Certificate Revocation List (CRL). See Managing the Trust Store (Certificates and Authorities).
-
Generate the RSA key pair. See Generating or Deleting key-pair for IKE Endpoint Authentication.
Configure the local identity and remote identity parameters.
Syntax
remote-identity { distinguished-name { container container-string; wildcard wildcard-string; } hostname hostname; inet ip-address; user-at-hostname e-mail-address; }Hierarchy Level
[edit security ike gateway gateway-name]
Options
distinguished-name—Specify identity as the distinguished name (DN) from the certificate. If there is more than one certificate on the device, use thesecurityike gatewaygateway-namepolicypolicy-namecertificate local-certificatecertificate-id.Optional container and wildcard strings can be specified:
container container-string—Specify a string for the container.wildcard wildcard-string—Specify a string for the wildcard.
hostnamehostname—Specify identity as a fully qualified domain name (FQDN).inetip-address—Specify identity as an IPv4 address.user-at-hostnamee-mail-address—Specify identity as an e-mail address.
local-identity configuration options:
[edit] root@fipscc-nfx# set security ike gateway gw1 local-identity ? Possible completions: distinguished-name Use a distinguished name specified in local certificate > hostname Use a fully-qualified domain name > inet Use an IPv4 address > inet6 Use an IPv6 address > key-id Key ID identification values in ASCII string > user-at-hostname Use an e-mail address
IP-Address:
set security ike gateway gw1 local-identity inet 10.1.5.41
remote-identity configuration options:
[edit] root@fipscc-nfx# set security ike gateway gw1 remote-identity ? Possible completions: > distinguished-name Use a distinguished name: > hostname Use a fully-qualified domain name > inet Use an IPv4 address > inet6 Use an IPv6 address > key-id Key ID identification values in string > user-at-hostname Use an e-mail address
IP-Address:
FQDN:set security ike gateway gw1 remote-identity inet 10.1.5.42
User FQDN:set security ike gateway gw1 remote-identity hostname peer.acumensec.com
DN:set security ike gateway gw1 remote-identity user-at-hostname "peer@acumensec.com"
set security ike gateway gw1 remote-identity distinguished-name container "CN=NFXPEER, OU=CC, o=Acumen, C=US"
-
Configure the IKE proposal.
[edit security ike] user@host# set proposal ike-proposal1 authentication-method rsa-signatures user@host# set proposal ike-proposal1 dh-group group19 user@host# set proposal ike-proposal1 authentication-algorithm sha-256 user@host# set proposal ike-proposal1 encryption-algorithm aes-128-cbc
Note:Here,
ike-proposal1is the name given by the authorized administrator. -
Configure the IKE policy.
[edit security ike] user@host# set policy ike-policy1 mode main user@host# set policy ike-policy1 proposals ike-proposal1 user@host# set policy ike-policy1 certificate local-certificate cert1
Note:The mode can be configured as Aggressive, However, for Common Criteria compliance
main modemust be used. -
Configure the IPsec proposal.
[edit security ipsec] user@host# set proposal ipsec-proposal1 protocol esp user@host# set proposal ipsec-proposal1 authentication-algorithm hmac-sha-256-128 user@host# set proposal ipsec-proposal1 encryption-algorithm aes-128-cbc
Note:Here,
ipsec-proposal1is the name given by the authorized administrator. -
Configure the IPsec policy.
[edit security ipsec] user@host# set policy ipsec-policy1 perfect-forward-secrecy keys group19 user@host# set policy ipsec-policy1 proposals ipsec-proposal1
Note:Here,
ipsec-policy1is the name given by the authorized administrator. -
Configure the IKE.
[edit security ike] user@host# set gateway gw1 ike-policy ike-policy1 user@host# set gateway gw1 address 192.0.2.8 user@host# set gateway gw1 local-identity inet 192.0.2.5 user@host# set gateway gw1 external-interface fe-0/0/1
Note:Here,
192.0.2.8is the peer VPN endpoint IP,192.0.2.5is the local VPN endpoint IP, andfe-0/0/1is the local outbound interface as VPN endpoint. The following configuration is also needed for IKEv1.[edit security ike] user@host# set gateway gw1 version v1-only
-
Configure VPN.
[edit security ipsec] user@host# set vpn vpn1 ike gateway gw1 user@host# set vpn vpn1 ike ipsec-policy ipsec-policy1 user@host# set vpn vpn1 bind-interface st0.0
Note:Here,
vpn1is the VPN tunnel name given by the authorized administrator.[edit] user@host# set routing-options static route 192.0.2.10/24 qualified-next-hop st0.0 preference 1
-
Configure the outbound flow policies.
[edit security policies] user@host# set from-zone trustZone to-zone untrustZone policy policy1 match source-address trustLan user@host# set from-zone trustZone to-zone untrustZone policy policy1 match destination-address untrustLan user@host# set from-zone trustZone to-zone untrustZone policy policy1 match application any user@host# set from-zone trustZone to-zone untrustZone policy policy1 then permit user@host# set from-zone trustZone to-zone untrustZone policy policy1 then log session-init user@host# set from-zone trustZone to-zone untrustZone policy policy1 then log session-close
Note:Here,
trustZoneanduntrustZoneare preconfigured security zone andtrustLananduntrustLanare preconfigured network addresses. -
Configure the inbound flow policies.
[edit security policies] user@host# set from-zone untrustZone to-zone trustZone policy policy1 match source-address untrustLan user@host# set from-zone untrustZone to-zone trustZone policy policy1 match destination-address trustLan user@host# set from-zone untrustZone to-zone trustZone policy policy1 match application any user@host# set from-zone untrustZone to-zone trustZone policy policy1 then permit user@host# set from-zone untrustZone to-zone trustZone policy policy1 then log session-init user@host# set from-zone untrustZone to-zone trustZone policy policy1 then log session-close
Note:Here,
trustZoneanduntrustZoneare preconfigured security zones andtrustLananduntrustLanare preconfigured network addresses. -
Commit the configuration.
[edit] user@host# commit
Configuring an IPsec VPN with an ECDSA Signature for IKE Authentication
In this section, the administrator configure devices running Junos OS for IPsec VPN using an ECDSA signature as the IKE authentication method. The algorithms used in IKE or IPsec authentication or encryption are shown in Table 3.
|
IKE Protocol |
Tunnel Mode |
Phase1 Negotiation Mode |
Phase 1 Proposal (P1, IKE) |
|||
|---|---|---|---|---|---|---|
|
Authentication Method |
Authentication Algorithm |
DH Group |
Encryption Algorithm |
|||
|
IKEv1 |
Main |
Route |
ecdsa-signatures-256 |
sha-384 |
group14 |
aes-256-cbc |
|
IKE Protocol |
Tunnel Mode |
Phase1 Negotiation Mode |
Phase 2 Proposal (P2, IPsec) |
|||
|---|---|---|---|---|---|---|
|
Authentication Algorithm |
DH Group (PFS) |
Encryption Method |
Encryption Algorithm |
|||
|
IKEv1 |
Main |
Route |
No Algorithm |
group14 |
ESP |
aes-256-gcm |
- Configuring IPsec VPN with ECDSA signature IKE authentication on the Initiator
- Configuring IPsec VPN with ECDSA signature IKE authentication on the Responder
Configuring IPsec VPN with ECDSA signature IKE authentication on the Initiator
To configure the IPsec VPN with ECDSA signature IKE authentication on the initiator:
Configure the PKI, generate and load the CA certificate, local certificate and Certificate Revocation List (CRL). See Managing the Trust Store (Certificates and Authorities).
-
Generate the RSA key pair. See Generating or Deleting key-pair for IKE Endpoint Authentication.
Configure the local identity and remote identity parameters.
Syntax
remote-identity { distinguished-name { container container-string; wildcard wildcard-string; } hostname hostname; inet ip-address; user-at-hostname e-mail-address; }Hierarchy Level
[edit security ike gateway gateway-name]
Options
distinguished-name—Specify identity as the distinguished name (DN) from the certificate. If there is more than one certificate on the device, use thesecurityike gatewaygateway-namepolicypolicy-namecertificate local-certificatecertificate-id.Optional container and wildcard strings can be specified:
container container-string—Specify a string for the container.wildcard wildcard-string—Specify a string for the wildcard.
hostnamehostname—Specify identity as a fully qualified domain name (FQDN).inetip-address—Specify identity as an IPv4 address.user-at-hostnamee-mail-address—Specify identity as an e-mail address.
local-identity configuration options:
[edit] root@fipscc-nfx# set security ike gateway gw1 local-identity ? Possible completions: distinguished-name Use a distinguished name specified in local certificate > hostname Use a fully-qualified domain name > inet Use an IPv4 address > inet6 Use an IPv6 address > key-id Key ID identification values in ASCII string > user-at-hostname Use an e-mail address
IP-Address:
set security ike gateway gw1 local-identity inet 10.1.5.41
remote-identity configuration options:
[edit] root@fipscc-nfx# set security ike gateway gw1 remote-identity ? Possible completions: > distinguished-name Use a distinguished name: > hostname Use a fully-qualified domain name > inet Use an IPv4 address > inet6 Use an IPv6 address > key-id Key ID identification values in string > user-at-hostname Use an e-mail address
IP-Address:
FQDN:set security ike gateway gw1 remote-identity inet 10.1.5.42
User FQDN:set security ike gateway gw1 remote-identity hostname peer.acumensec.com
DN:set security ike gateway gw1 remote-identity user-at-hostname "peer@acumensec.com"
set security ike gateway gw1 remote-identity distinguished-name container "CN=NFXPEER, OU=CC, o=Acumen, C=US"
-
Configure the IKE proposal.
[edit security ike] user@host# set proposal ike-proposal1 authentication-method ecdsa-signatures-256 user@host# set proposal ike-proposal1 dh-group group14 user@host# set proposal ike-proposal1 authentication-algorithm sha-384 user@host# set proposal ike-proposal1 encryption-algorithm aes-256-cbc
Note:Here,
ike-proposal1is the IKE proposal name given by the authorized administrator. -
Configure the IKE policy.
[edit security ike] user@host# set policy ike-policy1 mode main user@host# set policy ike-policy1 proposals ike-proposal1 user@host# set policy ike-policy1 certificate local-certificate cert1
The mode can be configured as Aggressive. However, for Common Criteria compliance
main modemust be used. -
Configure the IPsec proposal.
[edit security ipsec] user@host# set proposal ipsec-proposal1 protocol esp user@host# set proposal ipsec-proposal1 encryption-algorithm aes-256-gcm
Note:Here,
ipsec-proposal1is the IPsec proposal name given by the authorized administrator. -
Configure the IPsec policy.
[edit security ipsec] user@host# set policy ipsec-policy1 perfect-forward-secrecy keys group14 user@host# set policy ipsec-policy1 proposals ipsec-proposal1
Note:Here,
ipsec-policy1is the IPsec policy name andipsec-proposal1is the IPsec proposal name given by the authorized administrator. -
Configure IKE.
[edit security ike] user@host# set gateway gw1 ike-policy ike-policy1 user@host# set gateway gw1 address 192.0.2.8 user@host# set gateway gw1 local-identity inet 192.0.2.5 user@host# set gateway gw1 external-interface ge-0/0/2
Note:Here,
gw1is an IKE gateway name,192.0.2.8is the peer VPN endpoint IP,192.0.2.5is the local VPN endpoint IP, andge-0/0/2is a local outbound interface as the VPN endpoint. The following configuration is also needed for IKEv1.[edit security ike] user@host# set gateway gw1 version v1-only
-
Configure the VPN.
[edit] user@host# set security ipsec vpn vpn1 ike gateway gw1 user@host# set security ipsec vpn vpn1 ike ipsec-policy ipsec-policy1 user@host# set security ipsec vpn vpn1 bind-interface st0.0 user@host# set routing-options static route 192.0.2.10/24 qualified-next-hop st0.0 preference 1
Note:Here,
vpn1is the VPN tunnel name given by the authorized administrator. -
Configure the outbound flow policies.
[edit security policies] user@host# set from-zone trustZone to-zone untrustZone policy policy1 match source-address trustLan user@host# set from-zone trustZone to-zone untrustZone policy policy1 match destination-address untrustLan user@host# set from-zone trustZone to-zone untrustZone policy policy1 match application any user@host# set from-zone trustZone to-zone untrustZone policy policy1 then permit user@host# set from-zone trustZone to-zone untrustZone policy policy1 then log session-init user@host# set from-zone trustZone to-zone untrustZone policy policy1 then log session-close
Note:Here,
trustZoneanduntrustZoneare preconfigured security zones andtrustLananduntrustLanare preconfigured network addresses. -
Configure the inbound flow policies.
[edit security policies] user@host# set from-zone untrustZone to-zone trustZone policy policy1 match source-address untrustLan user@host# set from-zone untrustZone to-zone trustZone policy policy1 match destination-address trustLan user@host# set from-zone untrustZone to-zone trustZone policy policy1 match application any user@host# set from-zone untrustZone to-zone trustZone policy policy1 then permit user@host# set from-zone untrustZone to-zone trustZone policy policy1 then log session-init user@host# set from-zone untrustZone to-zone trustZone policy policy1 then log session-close
Note:Here,
trustZoneanduntrustZoneare preconfigured security zones andtrustLananduntrustLanare preconfigured network addresses. -
Commit the configuration.
user@host# commit
Configuring IPsec VPN with ECDSA signature IKE authentication on the Responder
To configure IPsec VPN with ECDSA signature IKE authentication on the responder:
Configure the PKI, generate and load the CA certificate, local certificate and Certificate Revocation List (CRL). See Managing the Trust Store (Certificates and Authorities).
-
Generate the RSA key pair. See Generating or Deleting key-pair for IKE Endpoint Authentication.
Configure the local identity and remote identity parameters.
Syntax
remote-identity { distinguished-name { container container-string; wildcard wildcard-string; } hostname hostname; inet ip-address; user-at-hostname e-mail-address; }Hierarchy Level
[edit security ike gateway gateway-name]
Options
distinguished-name—Specify identity as the distinguished name (DN) from the certificate. If there is more than one certificate on the device, use thesecurityike gatewaygateway-namepolicypolicy-namecertificate local-certificatecertificate-id.Optional container and wildcard strings can be specified:
container container-string—Specify a string for the container.wildcard wildcard-string—Specify a string for the wildcard.
hostnamehostname—Specify identity as a fully qualified domain name (FQDN).inetip-address—Specify identity as an IPv4 address.user-at-hostnamee-mail-address—Specify identity as an e-mail address.
local-identity configuration options:
[edit] root@fipscc-nfx# set security ike gateway gw1 local-identity ? Possible completions: distinguished-name Use a distinguished name specified in local certificate > hostname Use a fully-qualified domain name > inet Use an IPv4 address > inet6 Use an IPv6 address > key-id Key ID identification values in ASCII string > user-at-hostname Use an e-mail address
IP-Address:
set security ike gateway gw1 local-identity inet 10.1.5.41
remote-identity configuration options:
[edit] root@fipscc-nfx# set security ike gateway gw1 remote-identity ? Possible completions: > distinguished-name Use a distinguished name: > hostname Use a fully-qualified domain name > inet Use an IPv4 address > inet6 Use an IPv6 address > key-id Key ID identification values in string > user-at-hostname Use an e-mail address
IP-Address:
FQDN:set security ike gateway gw1 remote-identity inet 10.1.5.42
User FQDN:set security ike gateway gw1 remote-identity hostname peer.acumensec.com
DN:set security ike gateway gw1 remote-identity user-at-hostname "peer@acumensec.com"
set security ike gateway gw1 remote-identity distinguished-name container "CN=NFXPEER, OU=CC, o=Acumen, C=US"
-
Configure the IKE proposal.
[edit security ike] user@host# set proposal ike-proposal1 authentication-method ecdsa-signatures-256 user@host# set proposal ike-proposal1 dh-group group14 user@host# set proposal ike-proposal1 authentication-algorithm sha-384 user@host# set proposal ike-proposal1 encryption-algorithm aes-256-cbc
Note:Here,
ike-proposal1is the IKE proposal name given by the authorized administrator. -
Configure the IKE policy.
[edit security ike] user@host# set policy ike-policy1 mode main user@host# set policy ike-policy1 proposals ike-proposal1 user@host# set policy ike-policy1 certificate local-certificate cert1
-
Configure the IPsec proposal.
[edit security ipsec] user@host# set proposal ipsec-proposal1 protocol esp user@host# set proposal ipsec-proposal1 encryption-algorithm aes-256-gcm
Note:Here,
ipsec-proposal1is the IPsec proposal name given by the authorized administrator. -
Configure the IPsec policy.
[edit security ipsec] user@host# set policy ipsec-policy1 perfect-forward-secrecy keys group14 user@host# set policy ipsec-policy1 proposals ipsec-proposal1
Note:Here,
ipsec-policy1is the IPsec policy name andipsec-proposal1is the IPsec proposal name given by the authorized administrator. -
Configure the IKE.
[edit security ike] user@host# set gateway gw1 ike-policy ike-policy1 user@host# set gateway gw1 address 192.0.2.5 user@host# set gateway gw1 local-identity inet 192.0.2.8 user@host# set gateway gw1 external-interface ge-0/0/1
Note:Here,
gw1is an IKE gateway name,192.0.2.5is the peer VPN endpoint IP,192.0.2.8is the local VPN endpoint IP, andge-0/0/1is a local outbound interface as the VPN endpoint. The following configuration is also needed for IKEv1.[edit security ike] user@host# set gateway gw1 version v1-only
-
Configure the VPN.
[edit] user@host# set security ipsec vpn vpn1 ike gateway gw1 user@host# set security ipsec vpn vpn1 ike ipsec-policy ipsec-policy1 user@host# set security ipsec vpn vpn1 bind-interface st0.0 user@host# set routing-options static route 192.0.2.1/24 qualified-next-hop st0.0 preference 1
Note:Here,
vpn1is the VPN tunnel name given by the authorized administrator. -
Configure the outbound flow policies.
[edit security policies] user@host# set from-zone trustZone to-zone untrustZone policy policy1 match source-address trustLan user@host# set from-zone trustZone to-zone untrustZone policy policy1 match destination-address untrustLan user@host# set from-zone trustZone to-zone untrustZone policy policy1 match application any user@host# set from-zone trustZone to-zone untrustZone policy policy1 then permit user@host# set from-zone trustZone to-zone untrustZone policy policy1 then log session-init user@host# set from-zone trustZone to-zone untrustZone policy policy1 then log session-close
Note:Here,
trustZoneanduntrustZoneare preconfigured security zones andtrustLananduntrustLanare preconfigured network addresses. -
Configure the inbound flow policies.
[edit security policies] user@host# set from-zone untrustZone to-zone trustZone policy policy1 match source-address untrustLan user@host# set from-zone untrustZone to-zone trustZone policy policy1 match destination-address trustLan user@host# set from-zone untrustZone to-zone trustZone policy policy1 match application any user@host# set from-zone untrustZone to-zone trustZone policy policy1 then permit user@host# set from-zone untrustZone to-zone trustZone policy policy1 then log session-init user@host# set from-zone untrustZone to-zone trustZone policy policy1 then log session-close
Note:Here,
trustZoneanduntrustZoneare preconfigured security zones andtrustLananduntrustLanare preconfigured network addresses. -
Commit the configuration.
user@host# commit
For more information about troubleshooting IPSec VPN, see the following: