Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation

Configuring Filters for Traffic Transiting the ES PIC

This section contains the following topics:

Traffic Overview

Traffic configuration defines the traffic that must flow through the tunnel. You configure outbound and inbound firewall filters, which identify and direct traffic to be encrypted and confirm that decrypted traffic parameters match those defined for the given tunnel. The outbound filter is applied to the LAN or WAN interface for the incoming traffic you want to encrypt. The inbound filter is applied to the ES PIC to check the policy for traffic coming in from the remote host. Because of the complexity of configuring a router to forward packets, no automatic checking is done to ensure that the configuration is correct.

Note: The valid firewall filters statements for IPsec are destination-port, source-port, protocol, destination-address, and source-address.

In Figure 1, Gateway A protects the network 10.1.1.0/24, and Gateway B protects the network 10.2.2.0/24. The gateways are connected by an IPsec tunnel. For more information about firewalls, see the Routing Policy Feature Guide for Routing Devices.

Figure 1: Example: IPsec Tunnel Connecting Security Gateways

Example: IPsec Tunnel Connecting Security
Gateways

The SA and ES interface for security Gateway A are configured as follows:

[edit security ipsec]
security-association manual-sa1 {manual {direction bidirectional {protocol esp;spi 2312;authentication {algorithm hmac-md5-96;key ascii-text 1234123412341234;}encryption {algorithm 3des-cbc;key ascii-text 123456789009876543211234;}}}}
[edit interfaces es-0/1/0]
unit 0 {tunnel {source 10.5.5.5;destination 10.6.6.6;}family inet {ipsec-sa manual-sa1;address 10.1.1.8/32 {destination 10.2.2.254;}}}

Configuring the Security Association

To configure the SA, include the security-association statement at the [edit security] hierarchy level:

security-association name {mode (tunnel | transport);manual {direction (inbound | outbound | bi-directional) {auxiliary-spi auxiliary-spi-value;spi spi-value;protocol (ah | esp | bundle);authentication {algorithm (hmac-md5-96 | hmac-sha1-96);key (ascii-text key | hexadecimal key);}encryption {algorithm (des-cbc | 3des-cbc);key (ascii-text key | hexadecimal key);}}dynamic {replay-window-size (32 | 64);ipsec-policy policy-name;}}}

For more information about configuring an SA, see the Junos OS Administration Library for Routing Devices. For information about applying the SA to an interface, see Specifying the Security Association Name for Encryption Interfaces.

Configuring an Outbound Traffic Filter

To configure the outbound traffic filter, include the filter statement at the [edit firewall] hierarchy level:

filter filter-name {term term-name {from {match-conditions;}then {action;action-modifiers;}}}

For more information, see the Routing Policy Feature Guide for Routing Devices.

Example: Configuring an Outbound Traffic Filter

Firewall filters for outbound traffic direct the traffic through the desired IPsec tunnel and ensure that the tunneled traffic goes out the appropriate interface (see Figure 1). Here, an outbound firewall filter is created on security Gateway A; it identifies the traffic to be encrypted and adds it to the input side of the interface that carries the internal virtual private network (VPN) traffic:

[edit firewall]
filter ipsec-encrypt-policy-filter {term term1 {from {source-address { # local network10.1.1.0/24;}destination-address { # remote network10.2.2.0/24;}}
then ipsec-sa manual-sa1; # apply SA name to packet
term default {then accept;}

Note: The source address, port, and protocol on the outbound traffic filter must match the destination address, port, and protocol on the inbound traffic filter. The destination address, port, and protocol on the outbound traffic filter must match the source address, port, and protocol on the inbound traffic filter.

Applying the Outbound Traffic Filter

After you have configured the outbound firewall filter, you apply it by including the filter statement at the [edit interfaces interface-name unit logical-unit-number family inet] hierarchy level:

filter {input filter-name;}

Example: Applying the Outbound Traffic Filter

Apply the outbound traffic filter. The outbound filter is applied on the Fast Ethernet interface at the [edit interfaces fe-0/0/1 unit 0 family inet] hierarchy level. Any packet matching the IPsec action term (term 1) on the input filter (ipsec-encrypt-policy-filter), configured on the Fast Ethernet interface, is directed to the ES PIC interface at the [edit interfaces es-0/1/0 unit 0 family inet] hierarchy level. So, if a packet arrives from the source address 10.1.1.0/24 and goes to the destination address 10.2.2.0/24, the Packet Forwarding Engine directs the packet to the ES PIC interface, which is configured with the manual-sa1 SA. The ES PIC receives the packet, applies the manual-sa1 SA, and sends the packet through the tunnel.

The router must have a route to the tunnel end point; add a static route if necessary.

[edit interfaces]
fe-0/0/1 {unit 0 {family inet {filter {input ipsec-encrypt-policy-filter;}address 10.1.1.254/24;}}}

Configuring an Inbound Traffic Filter

To configure an inbound traffic filter, include the filter statement at the [edit firewall] hierarchy level:

filter filter-name {term term-name {from {match-conditions;}then {action;action-modifiers;}}}

For more information, see the Routing Policy Feature Guide for Routing Devices.

Example: Configuring an Inbound Traffic Filter

Configure an inbound firewall filter. This filter performs the final IPsec policy check and is created on security gateway A. The policy check ensures that only packets that match the traffic configured for this tunnel are accepted.

[edit firewall]
filter ipsec-decrypt-policy-filter {term term1 { # perform policy checkfrom {source-address { # remote network10.2.2.0/24;}destination-address { # local network10.1.1.0/24;}
then accept;

Applying the Inbound Traffic Filter to the Encryption Interface

After you create the inbound firewall filter, you can apply it to the ES PIC. To apply the filter to the ES PIC, include the filter statement at the [edit interfaces es-fpc/pic/port unit logical-unit-number family inet filter] hierarchy level:

filter {input filter;}

The input filter is the name of the filter applied to received traffic. For a configuration example, see Example: Configuring an Inbound Traffic Filter. For more information about firewall filters, see the Routing Policy Feature Guide for Routing Devices.

Example: Applying the Inbound Traffic Filter to the Encryption Interface

Apply the inbound firewall filter (ipsec-decrypt-policy-filter) to the decrypted packet to perform the final policy check. The IPsec manual-sa1 SA is referenced at the [edit interfaces es-1/2/0 unit 0 family inet] hierarchy level and decrypts the incoming packet.

The Packet Forwarding Engine directs IPsec packets to the ES PIC. It uses the packet’s security parameter index (SPI), protocol, and destination address to look up the SA configured on one of the ES interfaces. The IPsec manual-sa1 SA is referenced at the [edit interfaces es-1/2/0 unit 0 family inet] hierarchy level and is used to decrypt the incoming packet. When the packets are processed (decrypted, authenticated, or both), the input firewall filter (ipsec-decrypt-policy-filter) is applied on the decrypted packet to perform the final policy check. term1 defines the decrypted (and verified) traffic and performs the required policy check. For information about term1, see Example: Configuring an Inbound Traffic Filter.

Note: The inbound traffic filter is applied after the ES PIC has processed the packet, so the decrypted traffic is defined as any traffic that the remote gateway is encrypting and sending to this router. IKE uses this filter to determine the policy required for a tunnel. This policy is used during the negotiation with the remote gateway to find the matching SA configuration.

[edit interfaces]
es-1/2/0 {unit 0 {tunnel {source 10.5.5.5; # tunnel source addressdestination 10.6.6.6; # tunnel destination address}family inet {filter {input ipsec-decrypt-policy-filter;}ipsec-sa manual-sa1; # SA name applied to packetaddress 10.1.1.8/32 { # local interface address inside local VPNdestination 10.2.2.254; # destination address inside remote VPN}}}

Published: 2013-08-29