Related Documentation
- J Series
- Understanding Junos VPN Site Secure
- M Series
- Understanding Junos VPN Site Secure
- Configuring Security Associations
- Configuring IPsec Policies
- Configuring IKE Policies
- Tracing Junos VPN Site Secure Operations
- MX Series
- Understanding Junos VPN Site Secure
- Configuring Security Associations
- Configuring IPsec Policies
- Configuring IKE Policies
- Tracing Junos VPN Site Secure Operations
- T Series
- Understanding Junos VPN Site Secure
- Configuring Security Associations
- Configuring IPsec Policies
- Configuring IKE Policies
- Tracing Junos VPN Site Secure Operations
Example: Configuring Dynamically Assigned Policy Based Tunnels
This example shows how to configure dynamically assigned policy-based tunnels and contains the following sections.
Requirements
This example uses the following hardware and software components:
- Three M Series, MX Series or T Series routers.
- Junos OS Release 9.4 or later.
Overview and Topology
An IPsec policy for dynamic endpoints defines a combination of security parameters (IPsec proposals) used during IPsec negotiation between dynamic peer security gateways, in which the remote ends of tunnels do not have a statically assigned IP address.
A policy based VPN is a configuration with a specific VPN tunnel referenced in a policy which acts as a Tunnel. You use a Policy-based VPN if the remote VPN device is a non-Juniper device and if you must access only one subnet or one network at the remote site, across the VPN.
This example explains the IPsec dynamic endpoint tunneling topology as shown in Figure 1.
Before you configure dynamically assigned tunnels, be sure you have:
- A local network N-1 connected to a security gateway SG-1. The exit points must have a Juniper Networks router to terminate the static and dynamic peer endpoints. The tunnel termination address on SG-1 is 10.1.1.1 and the local network address is 172.16.1.0/24.
- Two remote peer routers that obtain addresses from an ISP pool and run an RFC-compliant IKE. The remote network N-2 has the address 172.16.2.0/24 and is connected to the security gateway SG-2 with the tunnel termination address 10.2.2.2. The remote network N-3 has the address 172.16.3.0/24 and is connected to the security gateway SG-3 with the tunnel termination address 10.3.3.3.
Figure 1: IPsec Dynamic Endpoint Tunneling Topology

Configuration
To configure dynamically assigned policy based tunnels, perform these tasks:
![]() | Note: The interface types shown in this example are for indicative purpose only. For example, you can use so- interfaces instead of ge- and sp- instead of ms-. |
CLI Quick Configuration
To quickly configure this example, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the commands into the CLI, at the [edit] hierarchy level, of SG1 router.
Configuring Interfaces
Configuring Access Profile
Configuring Service Set
Configuring IPsec Properties
Configuring Routing Instances
Configuring a Next-Hop SG1 Service-Set
Step-by-Step Procedure
Step-by-Step Procedure
The following example requires you to navigate various levels in the configuration hierarchy.
- Configure the interfaces.[edit interfaces]user@router1# set interfaces ms-0/0/0 unit 0 family inetuser@router1# set interfaces ms-0/0/0 unit 1 family inetuser@router1# set interfaces ms-0/0/0 unit 1 service-domain insideuser@router1# set interfaces ms-0/0/0 unit 1 dial-options ipsec-interface-id demo-ipsec-interface-iduser@router1# set interfaces ms-0/0/0 unit 1 dial-options mode shareduser@router1# set interfaces ms-0/0/0 unit 2 family inetuser@router1# set interfaces ms-0/0/0 unit 2 service-domain outside
- Configure the access profile.[edit access]user@router1# set profile demo-access-profile client * ike allowed-proxy-pair remote 172.16.2.0/24 local 172.16.1.0/24user@router1# set profile demo-access-profile client * ike ascii-text keyfordynamicpeersuser@router1# set profile demo-access-profile client * ike interface-id demo-ipsec-interface-id
- Configure the services set.[edit services]user@router1# set service-set demo-service-set next-hop-service inside-service-interface ms-0/0/0.1user@router1# set service-set demo-service-set next-hop-service outside-service-interface ms-0/0/0.2
- Configure the IPsec properties.[edit services ipsec-vpn]user@router1#set ipsec proposal ipsec_proposal_demo1 protocol espuser@router1#set ipsec proposal ipsec_proposal_demo1 authentication-algorithm hmac-sha1-96user@router1#set ipsec proposal ipsec_proposal_demo1 encryption-algorithm 3des-cbcuser@router1#set ipsec policy demo2 perfect-forward-secrecy keys group2user@router1#set ipsec policy demo2 proposals ipsec_proposal_demo1user@router1#set ike proposal ike_proposal_demo1 authentication-method pre-shared-keysuser@router1#set ike proposal ike_proposal_demo1 dh-group group2user@router1#set ike policy ike_policy_demo1 version 2user@router1#set ike policy ike_policy_demo1 proposals ike_proposal_demo1user@router1#set ike policy ike_policy_demo1 pre-shared-key ascii-text keyfordemo1
- Configure the routing instances.[edit routing-instances]user@router1# set demo-vrf instance-type vrfuser@router1# set demo-vrf ms-0/0/0.1user@router1# set demo-vrf ms-0/0/0.2
Results
From configuration mode of Router 1, confirm your configuration by entering the show interfaces, show access, and show services commands. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.
Verification
Verifying That the Next-Hop SG1 Service Set with Policy-Based Tunnels Is Created
Purpose
Verify that the next-hop SG1 service set with policy-based tunnels is created.
Action
From operational mode, enter the show route command.
user@router1> show routedemo-vrf.inet.0: .... # Routing instance 172.11.0.0/24 *[Static/1].. > via ms-0/0/0.1 172.12.0.0/24 *[Static/1].. > via ms-0/0/0.1
From operational mode, enter the show services ipsec-vpn ipsec security-associations detail
user@router1>show services ipsec-vpn ipsec security-associations
detailrule: junos-dynamic-rule-0 term: term-0 local-gateway-address : 10.1.1.1 #Tunnel termination address on SG-1 remote-gateway-address: 10.2.2.2 #Tunnel termination address on SG-2 source-address : 0.0.0.0/0 destination-address : 0.0.0.0/0 ipsec-inside-interface: ms-0/0/0.1 term: term-1 local-gateway-address : 10.1.1.1 #Tunnel termination address on SG-1 remote-gateway-address: 10.3.3.3 #Tunnel termination address on SG-3 source-address : 0.0.0.0/0 destination-address : 0.0.0.0/0 IPsec Properties ipsec-inside-interface: ms-0/0/0.1 match-direction: input
Meaning
The show services ipsec-vpn ipsec security-associations detail command output shows the properties that you configured.
Related Documentation
- J Series
- Understanding Junos VPN Site Secure
- M Series
- Understanding Junos VPN Site Secure
- Configuring Security Associations
- Configuring IPsec Policies
- Configuring IKE Policies
- Tracing Junos VPN Site Secure Operations
- MX Series
- Understanding Junos VPN Site Secure
- Configuring Security Associations
- Configuring IPsec Policies
- Configuring IKE Policies
- Tracing Junos VPN Site Secure Operations
- T Series
- Understanding Junos VPN Site Secure
- Configuring Security Associations
- Configuring IPsec Policies
- Configuring IKE Policies
- Tracing Junos VPN Site Secure Operations
