Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

    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.

    set interfaces ge-0/3/0 unit 0 family inet address 10.6.6.6/32set interfaces ge-1/1/0 description "teller ge-0/1/0"set interfaces ge-1/1/0 unit 0 family inet address 10.21.1.1/16set interfaces ms-1/2/0 unit 0 family inet address 10.7.7.7/32set interfaces ms-1/2/0 unit 1 family inetset interfaces ms-1/2/0 unit 1 service-domain insideset interfaces ms-1/2/0 unit 2 family inetset interfaces ms-1/2/0 unit 2 service-domain outsideset policy-options policy-statement vpn-export then community add vpn-communityset policy-options policy-statement vpn-export then acceptset policy-options policy-statement vpn-import term a from community vpn-communityset policy-options policy-statement vpn-import term a then acceptset policy-options community vpn-community members target:100:20set routing-instances vrf instance-type vrfset routing-instances vrf interface ge-0/3/0.0set routing-instances vrf interface ms-1/2/0.1set routing-instances vrf route-distinguisher 192.168.0.1:1set routing-instances vrf vrf-import vpn-importset routing-instances vrf vrf-export vpn-exportset routing-instances vrf routing-options static route 10.0.0.0/0 next-hop ge-0/3/0.0set routing-instances vrf routing-options static route 10.11.11.1/32 next-hop ge-0/3/0.0set routing-instances vrf routing-options static route 10.8.8.1/32 next-hop ms-1/2/0.1set services ipsec-vpn ipsec proposal demo_ipsec_proposal protocol espset services ipsec-vpn ipsec proposal demo_ipsec_proposal authentication-algorithm hmac-sha1-96set services ipsec-vpn ipsec proposal demo_ipsec_proposal encryption-algorithm 3des-cbcset services ipsec-vpn ipsec policy demo_ipsec_policy perfect-forward-secrecy keys group2set services ipsec-vpn ipsec policy demo_ipsec_policy proposals demo_ipsec_proposalset services ipsec-vpn ike proposal demo_ike_proposal authentication-method pre-shared-keysset services ipsec-vpn ike proposal demo_ike_proposal dh-group group2set services ipsec-vpn ike policy demo_ike_policy proposals demo_ike_proposalset services ipsec-vpn ike policy demo_ike_policy pre-shared-key ascii-text juniperkeyset services ipsec-vpn rule demo-rule term demo-term then remote-gateway 10.21.2.1set services ipsec-vpn rule demo-rule term demo-term then dynamic ike-policy demo_ike_policyset services ipsec-vpn rule demo-rule match-direction inputset services service-set demo-service-set next-hop-service inside-service-interface ms-1/2/0.1set services service-set demo-service-set next-hop-service outside-service-interface ms-1/2/0.2set services service-set demo-service-set ipsec-vpn-options local-gateway 10.21.1.1set services service-set demo-service-set ipsec-vpn-rules demo-rule

    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:

    1. 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
    2. 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
    3. 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
    4. 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
    5. 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
    6. 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.

    user@PE1# show interfaces
    ...ms-1/2/0 {unit 0 {family inet {address 10.7.7.7/32;}}unit 1 {family inet;service-domain inside;}unit 2 {family inet;service-domain outside;}}ge-0/3/0 {unit 0 {family inet {address 10.6.6.6/32;}}}ge-1/1/0 {description "teller ge-0/1/0";unit 0 {family inet {address 10.21.1.1/16;}}}...
    user@PE1# show policy-options
    policy-statement vpn-export {then {community add vpn-community;accept;}}policy-statement vpn-import {term a {from community vpn-community;then accept;}}community vpn-community members target:100:20;
    user@PE1# show routing-instances
    vrf {instance-type vrf;interface ge-0/3/0.0;interface ms-1/2/0.1;route-distinguisher 192.168.0.1:1;vrf-import vpn-import;vrf-export vpn-export;routing-options {static {route 10.0.0.0/0 next-hop ge-0/3/0.0;route 10.11.11.1/32 next-hop ge-0/3/0.0;route 10.8.8.1/32 next-hop ms-1/2/0.1;}}}
    user@PE1# show services ipsec-vpn
    ipsec-vpn {rule demo-rule {term demo-term {then {remote-gateway 10.21.2.1;dynamic {ike-policy demo_ike_policy;}}}match-direction input;}ipsec {proposal demo_ipsec_proposal {protocol esp;authentication-algorithm hmac-sha1-96;encryption-algorithm 3des-cbc;}policy demo_ipsec_policy {perfect-forward-secrecy {keys group2;}proposals demo_ipsec_proposal;}}ike {proposal demo_ike_proposal {authentication-method pre-shared-keys;dh-group group2;}policy demo_ike_policy {proposals demo_ike_proposal;pre-shared-key ascii-text "$9$JoUi.QF/0BEP5BEcyW8ZUjqPQ/9p0Ic"; ## SECRET-DATA}}}
    user@PE1# show services service-set demo-service-set
    next-hop-service {inside-service-interface ms-1/2/0.1;outside-service-interface ms-1/2/0.2;}ipsec-vpn-options {local-gateway 10.21.1.1;}ipsec-vpn-rules demo-rule;

    Verification

    Verifying that the VRF instance is working

    Purpose

    Action

    Meaning

    Published: 2013-08-29