Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Example: Configuring Policy-Based VPN Using an SRX Series or a J Series Device and an SSG Device

 

This topic includes the following sections:

Requirements

This example uses the following hardware and software components:

  • Junos OS Release 9.5 or later

  • Juniper Networks SRX Series Services Gateways or J Series Services Routers

Note

This configuration example has been tested using the software release listed and is assumed to work on all later releases.

Overview and Topology

Figure 1 shows the network topology used in this configuration example.

Figure 1: Network Topology
Network Topology

This example assumes the following:

  • The internal LAN interface is ge-0/0/0 in zone trust and has a private IP subnetwork address.

  • The Internet interface is ge-0/0/3 in zone untrust and has a public IP subnetwork address.

  • All traffic between the local and remote LANs is permitted, and traffic can be initiated from either side.

  • The Juniper Networks SSG5 Secure Services Gateway has already been configured with the correct information for this example.

The basic steps for configuring Junos OS devices for policy-based VPNs are:

  1. Configure the IP addresses for Gigabit Ethernet interfaces ge-0/0/0.0 and ge-0/0/3.0.

  2. Configure the default route to the Internet next hop.

    Optionally, you can use a dynamic routing protocol such as OSPF instead. Configuring OSPF is beyond the scope of this document.

  3. Configure security zones, and bind the interfaces to the appropriate zones.

    Also ensure that you have enabled the necessary host-inbound services on the interfaces or the zone. For this example, enable the Internet Key Exchange (IKE) service on either the ge-0/0/3 interface or the untrust zone.

  4. Configure address book entries for each zone.

    This is necessary for the security policies.

  5. Configure phase 1 (IKE) gateway settings.

    Note

    For this example, the standard proposal set is used. However, you can create a different proposal if necessary.

  6. Configure phase 2 (IP Security [IPsec]) VPN settings.

    Optionally, you can also configure VPN monitor settings if you want.

    Note

    For this example, the standard proposal set and Perfect Forward Secrecy (PFS) group 2 are used. However, you can create a different proposal if necessary.

  7. Configure tunnel policies to permit remote office traffic into the corporate LAN and vice versa.

    Also configure an outgoing trust to untrust permit-all policy with source NAT for Internet traffic. Ensure that the tunnel policy is above the permit-all policy. Otherwise, the policy lookup never reaches the tunnel policy.

  8. Configure the TCP-maximum segment size (tcp-mss) for IPsec traffic to eliminate the possibility of fragmented TCP traffic.

    This will lessen the resource usage on the device.

Configuration

To configure a policy-based VPN, perform the following tasks:

Configuring Junos OS

Step-by-Step Procedure

To configure the Junos OS device for a policy-based VPN:

  1. Configure interface IP addresses.

    Junos OS uses the concept of units for the logical component of an interface. In this example, unit 0 and family inet (IPv4) are used.

  2. Configure a default route.

    When processing the first packet of a new session, the Junos OS device first performs a route lookup. The static route, which happens to be the default route, determines the zone that the VPN traffic needs to egress. In this example, the VPN traffic ingresses on interface ge-0/0/0.0 with the next hop of 1.1.1.1. Thus, the traffic egresses out interface ge-0/0/3.0. Any tunnel policy needs to take into account the ingress and egress interfaces.

  3. Configure security zones, and assign interfaces to the zones.

    The ingress and egress zones are determined by the ingress and egress interfaces involved in the route lookup. From step 1 and step 2, you can see that packets ingress on ge-0/0/0 and that the ingress zone is the trust zone. Following the route lookup, the egress interface is ge-0/0/3, which signifies that the egress zone is the untrust zone. Thus, the tunnel policy needs to be from from-zone trust to-zone untrust and vice versa.

  4. Configure host-inbound services for each zone.

    Host-inbound services are for traffic destined for the Junos OS device itself. This includes but is not limited to FTP, HTTP, HTTPS, IKE, ping, rlogin, RSH, SNMP, SSH, Telnet, TFTP, and traceroute. For this example, assume that you want to allow all such services from zone trust. For security reasons, allow only IKE on the Internet facing zone untrust, which is required for IKE negotiations to occur. However, other services such as management and troubleshooting can also be individually enabled if required.

  5. Configure address book entries for each zone.

    This example uses the address book object names local-net and remote-net. There are some limitations with regard to the characters that are supported for address book names.

  6. Configure the IKE policy for main mode, standard proposal set, and preshared key.

    This example uses proposal set standard, which includes preshared-group2-3des-sha1 and preshared-group2-aes128-sha1 proposals. However, a unique proposal can be created and specified in the IKE policy in accordance with your corporate security policy.

  7. Configure the IKE gateway (phase 1) with a peer IP address, IKE policy, and outgoing interface.

    A remote IKE peer can be identified by IP address, fully qualified domain name/user-fully qualified domain name (FQDN/u-FQDN), or ASN1-DN (PKI certificates). For this example, identify the peer by IP address. The gateway address should be the remote peer’s public IP address. It is important to specify the correct external interface. If either the peer address or external interface specified is incorrect, then the IKE gateway will not be properly identified during phase 1 negotiations.

  8. Configure an IPsec policy for the standard proposal set.

    As mentioned for phase 1, for the purposes of this example, the standard proposal set is used, which includes the esp-group2- 3des-sha1 and esp-group2-aes128-sha1 proposals. However, a unique proposal can be created and then specified in the IPsec policy if needed.

  9. Configure an IPsec VPN with an IKE gateway and an IPsec policy.

    For this example, the VPN name ike-vpn needs to be referenced in the security policy to create a security association.

  10. Configure VPN bidirectional security policies for tunnel traffic.

    For this example, traffic from the corporate LAN to the remote office LAN requires a from-zone trust to-zone untrust tunnel policy. However, if a session needs to originate from the remote LAN to the corporate LAN, then a tunnel policy in the opposite direction from-zone untrust to-zone trust is also needed. By including the pair-policy statement, the VPN becomes bidirectional. Enter the zone trust to zone untrust hierarchy.

    Note
    • In addition to the permit action, you need to specify the IPsec profile to be used. Source NAT can be enabled on the policy if desired, but that is beyond the scope of this document.

    • For tunnel policies, the action is always permit. If you are configuring a policy with the deny action, you will not see an option for specifying the tunnel.



  11. Configure a source NAT rule and a security policy for Internet traffic.

    This policy permits all traffic from zone trust to zone untrust. With source-nat interface specified, the device translates the source IP and port for outgoing traffic, using the IP address of the egress interface as the source IP address and a random higher port for the source port. If required, more granular policies can be created to permit or deny certain traffic.

    Tip

    The security policy Internet traffic must be below the VPN bidirectional security policy because the policy list is read from top to bottom. If this policy is above the VPN policy, then the traffic always matches this policy and does not continue to the next policy. Thus, no user traffic is encrypted.

  12. If it is necessary to move the VPN policy, use the insert command.
  13. Configure the TCP-maximum segment size (tcp-mss) to eliminate fragmentation of TCP traffic across the tunnel.

    The tcp-mss is negotiated as part of the TCP three-way handshake. It limits the maximum size of a TCP segment to better fit the maximum transmission unit (MTU) limits of a network. This is especially important for VPN traffic because the IPsec encapsulation overhead, along with the IP and frame overhead, can cause the resulting Encapsulating Security Payload (ESP) packet to exceed the MTU of the physical interface, thereby causing fragmentation. Fragmentation increases bandwidth and device resource usage and is always best avoided.

    Note

    The value of 1350 is a recommended starting point for most Ethernet-based networks with an MTU of 1500 or greater. This value might need to be altered if any device in the path has a lower MTU or if there is any added overhead such as PPP or Frame Relay. As a general rule, you might need to experiment with different tcp-mss values to obtain optimal performance.

  14. This is the SSG5 portion of the configuration and is provided for your reference.

    The focus of this example is the configuration and troubleshooting of the Junos OS device. For the purpose of completing the network topology shown inFigure 1, a sample of the relevant configurations is provided for an SSG5 device. However, the concepts for configuration of policy-based VPNs for Juniper Networks Firewall/VPN products are well documented in the Concepts and Examples (C&E) guides. For more information, see the Concepts & Examples ScreenOS Reference Guide at: https://www.juniper.net/documentation/software/screenos/.

Verifying Policy-Based VPN Connections

Step-by-Step Procedure

To verify VPN Connections for Policy-Based VPNs, perform the following steps:

  1. Confirm IKE (phase 1) status. The remote peer is 2.2.2.2. The state shows UP. If the state shows DOWN or if there are no IKE security associations present, then there is a problem with phase 1 establishment. Confirm that the remote IP address, IKE policy, and external interfaces are all correct. Common errors include incorrect IKE policy parameters such as incorrect mode type (aggressive or main), preshared keys or phase 1 proposals (all must match on the peers). An incorrect external interface is another common misconfiguration. This interface must be the correct interface to receive the IKE packets. If configurations have been checked, then check the kmd log for any errors, or run traceoptions (see Troubleshooting).
    user@CORPORATE> show security ike security-associations
  2. In the following show command output, note that the Index number is 4. This value is unique for each IKE security association and allows you to get more details from that particular security association. The detail option gives more information that includes the role (initiator or responder). This is useful to know because troubleshooting is usually best done on the peer that has the responder role. Also shown are details regarding the authentication and encryption algorithms used, the phase 1 lifetime, and the traffic statistics. Traffic statistics can be used to verify that traffic is flowing properly in both directions. Also note the number of IPsec security associations created or in progress. This helps to determine the existence of any completed phase 2 negotiations.
    user@CORPORATE> show security ike security-associations index 4 detail
  3. Confirm IPsec (phase 2) status. From steps 1 and 2, you can see that there is one IPsec security association (SA) pair and that the port used is 500, which means there is no NAT traversal (nat-traversal would show port 4500 or a random high port). Also, you can see the security parameter index (SPI) used for both directions, as well as the lifetime (in seconds) and usage limits or lifesize (in kilobytes). In the following output, you can see 3565/ unlim, which means that phase 2 lifetime is set to expire in 3565 seconds. There is no lifesize specified; thus, it shows unlimited (unlim). Phase 2 lifetime can differ from phase 1 lifetime because phase 2 is not dependent on phase 1 after the VPN is up. The Mon column refers to VPN monitoring status. If VPN monitoring is enabled, then this shows U (up) or D (down). A hyphen (-) means that VPN monitoring is not enabled for this SA. For more details on VPN monitoring, refer to the complete Junos OS documentation. Note that Vsys always shows 0. Note also the ID number 2. This is the Index value and is unique for each IPsec security association.
    user@CORPORATE> show security ipsec security-associations
  4. In the following show command output, you can view more details for a particular security association. The following output shows the Local Identity and Remote Identity. These elements compose the proxy ID for this SA. Proxy ID mismatch is a very common reason for phase 2 failing to complete. For policy-based VPNs, the proxy ID is derived from the security policy. From the security policy, the local address and remote address are derived from the address book entries, and the service is derived from the application configured for the policy. If phase 2 fails due to a proxy ID mismatch, confirm from the policy which address book entries are configured, and verify the addresses to confirm that they match what is being sent. Also, verify the service to ensure that the ports match what is being sent.

    Note that if multiple objects are configured in a policy for source address, destination address, or application, then the resulting proxy ID for that parameter changes to zeroes. For example, assume the tunnel policy has multiple local addresses of 10.10.10.0/24 and 10.10.20.0/24, remote address 192.168.168.0/24, and application junos-http. The resulting proxy ID would be local 0.0.0.0/0, remote 192.168.168.0/24, service 80. This can affect interoperability if the remote peer is not configured for the second subnet.

    For certain third-party vendors, you may need to manually enter the proxy ID to match. If IPsec cannot complete, then check the kmd log or set traceoptions as detailed in Troubleshooting.

    user@CORPORATE> show security ipsec security-associations index 2 detail
  5. In the following show command output, check the statistics and errors for an IPsec SA. This command is used to check Encapsulating Security Payload (ESP) and Authentication Header (AH) counters and to check for any errors with a particular IPsec security association. You normally do not want to see error values other than zero. However if you experience packet loss issues across a VPN, one approach is to use the show command multiple times and confirm that the encrypted and decrypted packet counters are incrementing. Also, verify whether any error counter increments while you are experiencing the issue. It may also be necessary to enable security flow traceoptions (see Troubleshooting) to view which ESP packets are experiencing errors and why.
    user@CORPORATE> show security ipsec statistics index 2
  6. Test the traffic flow across the VPN. After you have confirmed the status of phase 1 and phase 2, the next step is to test the traffic flow across the VPN. One way to test the traffic flow is through the ping command. You can ping from a local host PC to a remote host PC. You can also initiate the ping command from the Junos OS device itself. The following is an example of testing using the ping command from the Junos OS device to the remote PC host. Note that when initiating ping packets from the Junos OS device, the source interface needs to be specified in order to be sure that route lookup is correct and that the appropriate zones can be referenced in policy lookup. In this case, because ge-0/0/0.0 resides in the same security zone as the local host PC, ge-0/0/0 needs to be specified in the ping commands so that the policy lookup can be from zone trust to zone untrust. Similarly, you can initiate a ping command from the remote host to the local host.
    user@CORPORATE> ping 192.168.168.10 interface ge-0/0/0 count 5
  7. You can also initiate a ping command from the SSG5 device itself, as shown in the following output. If pings fail from either direction, this could indicate an issue with routing, policy, end host, or perhaps an issue with the encryption/decryption of the ESP packets. One way to check is to view the IPsec statistics to see whether any errors are reported. Also, you can confirm end host connectivity by pinging from a host on the same subnet as the end host. Assuming that the end host is reachable by other hosts, the issue probably is not with the end host. For routing and policy issues, you can enable security flow traceoptions.

Troubleshooting

Step-by-Step Procedure

Basic troubleshooting begins by first isolating the issue and then focusing the debugging efforts on the area where the problem is occurring. One common approach is to start with the lowest layer of the Open System Interconnection (OSI) model and work up the OSI stack to confirm at which layer the failure occurs.

Following this methodology, the first step to troubleshooting is to confirm the physical connectivity of the Internet link at the physical and data link level. Next, by using the ping command, confirm that the Junos OS device has connectivity to the Internet next hop, followed by confirming connectivity to the remote IKE peer. If this is confirmed, then confirm that IKE phase 1 can complete by running the verification commands. After phase 1 is confirmed, confirm phase 2. Finally, confirm that traffic is flowing across the VPN. If the VPN is not in the UP state, then there is little reason to test any transit traffic across the VPN. Likewise, if phase 1 is not successful, then it is unnecessary to look at phase 2 issues.

To troubleshoot issues further at the different levels, configure traceoptions. Traceoptions are enabled in configuration mode and are a part of the Junos OS operating configuration. This means that a configuration commit is necessary before a traceoption will take effect. Likewise, removing traceoptions requires deleting or deactivating the configuration, followed by committing the configuration. With a traceoption flag enabled, the data from the traceoption will be written to a log file, which may be predetermined or manually configured and stored in flash memory. This means that any trace logs are retained even after a system reboot. Ensure there is sufficient storage available in the flash memory before implementing traceoptions.

To troubleshoot, perform the following steps:

  1. You can check the available storage in the following show command output, in which /dev/ad0s1a represents the onboard flash memory and is currently at 65% capacity. You can also view available storage on the J-Web homepage under System Storage. The output of all traceoptions is written to logs stored in the /var/log directory. To view a list of all the logs in/var/log, use the show log operational mode command.
    user@CORPORATE> show system storage
  2. Check the traceoption logs. Enabling traceoptions begins the logging of the output to the filenames specified or to the default log file for the traceoption. View the appropriate log to see the trace output. The following are the show commands for viewing the appropriate logs.
    user@CORPORATE> show log messages
    user@CORPORATE> file copy /var/log/kmd ftp://10.10.10.10/kmd.log
    Note

    For the Juniper Networks SRX3000 line, SRX5000 line, and SRX1400 devices, the logs are located in the /var/tmp directory and the SPU ID values are included in the log filename. For example /var/tmp/kmd14.

  3. To view success or failure messages in IKE or IPsec, view the kmd log, using the show log kmd command. Although the kmd log displays a general reason for any failure, it may be necessary to obtain additional details by enabling IKE traceoptions. As a general rule, it is always best to troubleshoot on the peer that has the role of responder. Enable IKE traceoptions for phase 1 and phase 2 negotiation issues. The following example shows all of the IKE traceoptions.
    user@CORPORATE# set security ike traceoptions file ?
    user@CORPORATE# set security ike traceoptions flag ?
  4. By default, if no filename is specified, then all IKE traceoptions are written to the kmd log. However, you can specify a different filename if you wish. If a different filename is specified, then all IKE and IPsec related logs are no longer written to the kmd log.

    To write trace data to the log, you must specify at least one flag option. The file size option determines the maximum size of a log file in bytes. For example, 1m or 1000000 generates a maximum file size of 1 MB. The file files option determines the maximum number of log files that are generated and stored in the flash memory. Remember to commit the configuration changes to start the trace. The following example shows recommended traceoptions for troubleshooting most IKE-related issues.

  5. Review the kmd log for success/failure messages. In the following show command output are some excerpts of successful phase 1 and phase 2 completion as well as some instances of failure. Phase 1 and phase 2 successful. The following output shows that the local address is 1.1.1.2 and the remote peer is 2.2.2.2. The output udp:500 indicates that no NAT traversal was negotiated. You should see a phase 1 done message, along with the role (initiator or responder). Next you should see a phase 2 done message with proxy ID information. At this point, you can confirm that the IPsec SA is up, using the verification commands in Steps 1 through 4.
    user@CORPORATE> show log kmd
  6. Phase 1 failing to complete, example 1. In the following show command output, the local address is 1.1.1.2 and the remote peer is 2.2.2.2. The role is responder. The reason for failing is No proposal chosen. This is likely caused by mismatched phase 1 proposals. To resolve this issue, configure the phase 1 proposals to match on the peers. Also confirm that a tunnel policy exists for the VPN.
    user@CORPORATE> show log kmd
  7. Phase 1 failing to complete, example 2. In the following show command output, the local address is 1.1.1.2 and the remote peer is 2.2.2.2. The role is responder. The reason for failing may seem to indicate that no proposal was chosen. However, you also see peer:2.2.2.2 is not recognized. This message could be caused by an incorrect peer address, a mismatched peer ID type, or an incorrect peer ID, depending on whether this is a dynamic or static VPN. The peer address must be checked first before the phase 1 proposal is checked. To resolve this issue, confirm that the local peer has the correct peer IP address. Also confirm that the peer is configured with IKE ID type as the IP address.
    user@CORPORATE> show log kmd
  8. Phase 1 failing to complete, example 3. In the following show command output, the remote peer is 2.2.2.2. Invalid payload type usually indicates a problem with the decryption of the IKE packet due to a mismatched preshared key. To resolve this issue, configure the preshared keys to match on the peers.
    user@CORPORATE> show log kmd
  9. Phase 1 successful, phase 2 failing to complete, example 1. In the following show command output, the local address is 1.1.1.2 and the remote peer is 2.2.2.2. Phase 1 was successful, based on the Phase-1 [responder] done message. The reason for the failure is due to No proposal chosen during phase 2 negotiation. The issue is likely phase 2 proposal mismatch between the two peers. To resolve this issue, configure the phase 2 proposals to match on the peers.
    user@CORPORATE> show log kmd
  10. Phase 1 successful, phase 2 failing to complete, example 2. In the following show command output, phase 1 was successful. The reason for failure in phase 2 may seem to be that no proposal was chosen. However, there is also the message Failed to match the peer proxy ids, which means that the proxy ID did not match what was expected. Phase 2 proxy ID of remote=192.168.168.0/24, local=10.10.20.0/24, service=any was received. It is clear that this does not match the configurations on the local peer; thus, proxy ID match fails. This results in the error: No proposal chosen. To resolve this, configure one peer proxy ID so that it matches the other peer. Note that for a route-based VPN, the proxy ID, by default, is all zeroes (local=0.0.0.0/0, remote=0.0.0.0/0, service=any). If the remote peer specifies a proxy ID other than all zeroes, then you must manually configure the proxy ID within the IPsec profile of the peer.
    user@CORPORATE> show log kmd
  11. The following is a problem scenario using the network diagram. See Figure 1.
    1. Remote PC 192.168.168.10 can ping local PC 10.10.10.10.

    2. Local PC 10.10.10.10 cannot ping 192.168.168.10.

    3. Based on the output from show commands, IPsec SA is up, and the statistics show no errors.

    Considering that the IPsec tunnel is up, then it is likely that there is a problem with the route lookup, security policy, or some other flow issue. Enable security flow traceoptions to determine why the traffic is successful in one direction but not the other.

    Note

    Enabling flow traceoptions can increase system CPU and memory usage. Therefore, we do not recommend enabling flow traceoptions during peak traffic load times or when CPU utilization is very high. We recommend enabling packet filters to lower resource usage and to facilitate pinpointing the packets of interest. Be sure to delete or deactivate all flow traceoptions and remove any unnecessary log files from the flash memory after you complete troubleshooting.

  12. Enable security flow traceoptions for routing or policy issues. See the following example of output for security flow traceoptions. By default, if no filename is specified, then all flow traceoptions output is written to the security-trace log file. However, you can specify a different filename if you wish. To write trace data to the log, you must specify at least one flag option. The file size option determines the maximum size of a log file in bytes. For example, 1m or 1000000 generates a maximum file size of 1 MB. The file files option determines the maximum number of log files that are generated and stored in flash memory. Remember to commit the configuration changes to start the trace.
    user@CORPORATE# set security flow traceoptions file ?
    user@CORPORATE# set security flow traceoptions flag ?
  13. Junos OS can configure packet filters to limit the scope of the traffic to be captured. You can filter the output based on source/destination IP address, source/destination port, interface, and IP protocol. Up to 64 filters can be configured. A packet filter also matches the reverse direction to capture the reply traffic, assuming that the source of the original packet matches the filter. The following example shows the packet flow filter options.
    user@CORPORATE# set security flow traceoptions packet-filter filter-name ?
  14. Terms listed within the same packet filter act as a Boolean logical AND statement. This means that all statements within the packet filter need to match in order to write the output to the log. A listing of multiple filter names acts as a logical OR. Using packet filters, the following example lists the recommended traceoptions for security flow for the problem scenario given in Step 11.
  15. The following output details the reasoning behind each flow traceoption setting.
    user@CORPORATE# show
  16. In the following example the security-trace log file is set to 1 MB and up to 3 files can be created. The reason for this is that because of the nature of flow traceoptions, a single file could become full very quickly, depending on how much traffic is captured. The basic-datapath flag shows details for most flow-related problems.
  17. The filter used in Step 16 is for capturing the decapsulated or unencrypted traffic from the remote PC to the local PC. Because there are multiple terms, policy execution acts as a Boolean logical AND, which means that the source IP address and destination IP address must both match the filter. If the source IP address matches but the destination IP address does not, then the packet is not captured. Because packet filters are bidirectional, it is not necessary to configure a filter for the reply traffic.
  18. As mentioned in Step 17, no filter is required for capturing the reply traffic. However, a filter captures only the packets which are originally sourced from the specified side. Thus, the local-to-remote filter in Step 17 is still required to capture traffic which sources from the local side to the remote side. The filter in the example is optional and depends on whether or not the previous filter captured any packets. This filter captures all ESP (IP protocol 50) or encrypted packets from remote peer 2.2.2.2. Note that this filter captures ALL encrypted traffic from 2.2.2.2, including packets that perhaps you are not interested in. If the unencrypted traffic is captured, then this last filter may not be necessary.

    With the three problem statements mentioned in the problem scenario in Step 11, you can now begin to look at the flow traceoptions log to isolate the issue. Assume that the third statement is correct, based on IKE and IPsec troubleshooting. Therefore, the next step is to validate the first problem statement to confirm that the remote PC can ping the local PC. Then you can troubleshoot the second problem statement to find out why the traffic fails in the reverse direction.

  19. Validate the first problem statement. Send a ping packet from 192.168.168.10 to 10.10.10.10 and then view the security-trace log. Because no filename is specified, view the flow traceoptions output using the show log security-trace command. The following flow traceoptions output shows successful traffic flow from remote PC to the local PC. The first packet captured is the ESP, or encrypted packet.
    user@CORPORATE> show log security-trace

    Based on the top header in the output in Step 19, the packet is from 2.2.2.2 to 1.1.1.2; the IP protocol is 50. The ingress interface is ge-0/0/3.0 in zone untrust and matching packet filter remote-esp. This is the ESP packet from the remote peer. The port values for IP protocol 50 are not the same as with TCP/UDP. The values are an amalgamation of the SPI value for the tunnel. The flow session id is the tunnel session created for the ESP traffic. You can view details about this session using the show security flow session session-identifier <session id> command. The flow_decrypt message indicates that the decryption process is to take place. The tun value is an internal pointer, and iif refers to the incoming logical interface index. You can view all the logical interface index numbers using the show interface extensive command.

  20. The following is the decrypted packet output. Based on the top header in the output for the show log security-trace command, the packet is from 192.168.168.10 to 10.10.10.10; the IP protocol is 1. The ingress interface is ge-0/0/3.0 because the source is from across the VPN. Therefore, the ingress zone is zone untrust and matching packet filter remote-to-local. This is an ICMP packet. In particular, icmp, (8/0) indicates that this is an ICMP type 8, code 0, which is an echo request. The source port is the ICMP sequence value, and the destination port is the ICMP identifier.
    user@CORPORATE> show log security-trace

    There is no existing session for this flow, so first-packet processing occurs. Next route lookup occurs. Route lookup must occur to determine the ingress and egress zones for security policy lookup. Route lookup determines that the packet needs to egress out ge-0/0/0.0. Because interface ge-0/0/0.0 is associated with zone trust, and ge-0/0/3.0 is associated with zone untrust, the policy lookup is from-zone untrust to-zone trust. Policy 6 was found, which permits the traffic.

  21. The details for policy 6 can be viewed with the show security policies command.
    user@CORPORATE> show security policies | find “Index: 6”
  22. At this point, the session is created; in this case, the session ID is 45. The reply packet is also captured and shows existing session 45 is found as shown in the following output. Note that icmp, (0/0) indicates that this is an ICMP packet type 0, code 0, which is an ICMP echo reply. The packet is shown going into tunnel 4000002. This means that the tunnel is 0x2, which converts to SA index 2 in decimal notation. This confirms that the traffic initiating from remote PC 192.168.168.10 to local PC 10.10.10.10 is successful.
    user@CORPORATE> show log security-trace
  23. Troubleshoot the second problem statement. In the the second problem statement, the local PC cannot ping the remote PC. You can determine the problem by reviewing the security-trace log while attempting to ping from 10.10.10.10 to 192.168.168.10. The following is a sample output showing a failure.
    user@CORPORATE> show log security-trace

    Based on the top header in the output in Step 23, the packet is from 10.10.10.10 to 192.168.168.10; the IP protocol is 1. No session is found, so first packet processing occurs. Next, route-lookup occurs. The route lookup correctly shows that the egress interface is ge-0/0/3.0. Therefore, policy lookup is from zone trust to zone untrust. The packet matches policy index 4.

  24. To confirm if policy index 4 is the correct policy, use the show security policies command.
    user@CORPORATE> show security policies

    From the output in Step 24, you can see that policy index 4 is the any-permit policy. However, in order to be sent across the VPN, the traffic must match tunnel policy vpnpolicy-tr-unt, which is policy index 7. But policy index 7 is below policy index 4; thus, the traffic always matches the any-permit policy first. Recall that policy lookup is always from top to bottom.

  25. To resolve the order of policy issue, place the tunnel policy above the any-permit policy using the insert command as follows.

    Why did the remote PC to local PC traffic succeed despite that there is no route or policy configured for the reply traffic? The order of packet processing is important to answering this question. Junos OS first inspects the packet to see whether there is already an existing session. If no session exists, then a route lookup is performed. Next, policy lookup is performed. When the first packet reaches the device from the remote PC to the local PC, the session is built for the reply packet. When the reply packet is received, it matches the existing session and is then forwarded. If a session match is found, then no further route or policy lookup occurs.

Results

For reference, the configuration of the Corporate Office Router is shown.

Corporate Office Router