Related Documentation
- J Series
- Understanding Junos VPN Site Secure
- M Series
- Understanding Junos VPN Site Secure
- Configuring Security Associations
- Configuring IPsec Proposals
- Configuring IKE Proposals
- MX Series
- Understanding Junos VPN Site Secure
- Configuring Security Associations
- Configuring IPsec Proposals
- Configuring IKE Proposals
- T Series
- Understanding Junos VPN Site Secure
- Configuring Security Associations
- Configuring IPsec Proposals
- Configuring IKE Proposals
Example: Configuring Statically Assigned IPsec Tunnels over a VRF Instance
This example shows how to configure a statically assigned IPsec tunnel over a VRF instance, and contains the following sections:
Requirements
This example uses the following hardware and software components:
- M Series, MX Series, or T Series router that is configured as a provider edge router.
- Junos OS Release 9.4 and later.
No special configuration beyond device initialization is required before you can configure this feature.
Overview
Junos OS enables you to configure statically assigned IPsec tunnels on Virtual Routing and Forwarding (VRF) instances. Ability to configure IPsec tunnels on VRF instances enhances network segmentation and security. You can have multiple customer tunnels configured on the same PE router over VRF instances. Each VRF instance acts as logical router with an exclusive routing table.
Configuration
This example shows the configuration of an IPsec tunnel over a VRF instance on a provider edge router, and provides step-by-step instructions for completing the required configuration.
This section contains:
Configuring the Provider Edge Router
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.
Step-by-Step Procedure
The following example requires you to navigate various levels in the configuration hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration Mode in the CLI User Guide.
To configure a statically assigned IPsec tunnel on a VRF instance:
- Configure the interfaces. In this step, you configure
two Ethernet (ge) interfaces, one services interface (ms-), and also the service-domain properties for the logical
interfaces of the services interface. Note that the logical interface
that is marked as the inside interface applies the configured service
on the traffic, whereas the one that is marked as the outside interface
acts as the egress point for the traffic on which the inside interface
has applied the service. [edit interfaces]user@PE1# set ge-0/3/0 unit 0 family inet address 10.6.6.6/32user@PE1# set ge-1/1/0 description "teller ge-0/1/0"user@PE1# set ge-1/1/0 unit 0 family inet address 10.21.1.1/16user@PE1# set ms-1/2/0 unit 0 family inet address 10.7.7.7/32user@PE1# set ms-1/2/0 unit 1 family inetuser@PE1# set ms-1/2/0 unit 1 service-domain insideuser@PE1# set ms-1/2/0 unit 2 family inetuser@PE1# set ms-1/2/0 unit 2 service-domain outside
- Configure a routing policy to specify route import and
export criteria for the VRF instance. The import and export policies
defined in this step are referenced from the routing-instance configuration
in the next step.[edit policy-options]user@PE1# set policy-statement vpn-export then community add vpn-communityuser@PE1# set policy-statement vpn-export then acceptuser@PE1# set policy-statement vpn-import term a from community vpn-communityuser@PE1# set policy-statement vpn-import term a then acceptuser@PE1# set community vpn-community members target:100:20
- Configure a routing instance and specify the routing-instance
type as vrf. Apply the import and export policies defined
in the previous step to the routing instance, and specify a static
route to send the IPsec traffic to the inside interface (ms-1/2/0.1) configured in the first step.[edit routing-instance]user@PE1# set vrf instance-type vrfuser@PE1# set vrf interface ge-0/3/0.0user@PE1# set vrf interface ms-1/2/0.1user@PE1# set vrf route-distinguisher 192.168.0.1:1user@PE1# set vrf vrf-import vpn-importuser@PE1# set vrf vrf-export vpn-exportuser@PE1# set vrf routing-options static route 10.0.0.0/0 next-hop ge-0/3/0.0user@PE1# set vrf routing-options static route 10.11.11.1/32 next-hop ge-0/3/0.0user@PE1# set vrf routing-options static route 10.8.8.1/32 next-hop ms-1/2/0.1
- Configure IKE and IPsec proposals and policies, and a
rule to apply the IKE policy on the incoming traffic..

Note: By default, Junos OS uses IKE policy version 1.0. Junos OS Release 11.4 and later also support IKE policy version 2.0 which you must configure at [edit services ipsec-vpn ike policy policy-name pre-shared].
[edit services]user@PE1# set ipsec-vpn ipsec proposal demo_ipsec_proposal protocol espuser@PE1# set ipsec-vpn ipsec proposal demo_ipsec_proposal authentication-algorithm hmac-sha1-96user@PE1# set ipsec-vpn ipsec proposal demo_ipsec_proposal encryption-algorithm 3des-cbcuser@PE1# set ipsec-vpn ipsec policy demo_ipsec_policy perfect-forward-secrecy keys group2user@PE1# set ipsec-vpn ipsec policy demo_ipsec_policy proposals demo_ipsec_proposaluser@PE1# set ipsec-vpn ike proposal demo_ike_proposal authentication-method pre-shared-keysuser@PE1# set ipsec-vpn ike proposal demo_ike_proposal dh-group group2user@PE1# set ipsec-vpn ike policy demo_ike_policy proposals demo_ike_proposaluser@PE1# set ipsec-vpn ike policy demo_ike_policy pre-shared-key ascii-text juniperkeyuser@PE1# set ipsec-vpn rule demo-rule term demo-term then remote-gateway 10.21.2.1user@PE1# set ipsec-vpn rule demo-rule term demo-term then dynamic ike-policy demo_ike_policyuser@PE1# set ipsec-vpn rule demo-rule match-direction input - Configure a next-hop style service set. Note that you
must configure the inside and outside interfaces that you configured
in the first step as the inside-service-interface and outside-service-interface respectively. [edit services]user@PE1# set service-set demo-service-set next-hop-service inside-service-interface ms-1/2/0.1user@PE1# set service-set demo-service-set next-hop-service outside-service-interface ms-1/2/0.2user@PE1# set service-set demo-service-set ipsec-vpn-options local-gateway 10.21.1.1user@PE1# set service-set demo-service-set ipsec-vpn-rules demo-rule
- Commit the configuration. [edit]user@PE1# commit
Results
From the configuration mode of Router 1, confirm your configuration by entering the show interfaces, show policy-options, show routing-instances, show services ipsec-vpn, and show services service-set commands. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.
Verification
Verifying that the VRF instance is working
Purpose
Action
Meaning
Related Documentation
- J Series
- Understanding Junos VPN Site Secure
- M Series
- Understanding Junos VPN Site Secure
- Configuring Security Associations
- Configuring IPsec Proposals
- Configuring IKE Proposals
- MX Series
- Understanding Junos VPN Site Secure
- Configuring Security Associations
- Configuring IPsec Proposals
- Configuring IKE Proposals
- T Series
- Understanding Junos VPN Site Secure
- Configuring Security Associations
- Configuring IPsec Proposals
- Configuring IKE Proposals