Manual Chapter :
Setting Up IPsec To Use NAT Traversal on One Side of the WAN
Applies To:
Show VersionsBIG-IP AAM
- 15.1.9, 15.1.8, 15.1.7, 15.1.6, 15.1.5, 15.1.4, 15.1.3, 15.1.2, 15.1.1, 15.1.0, 15.0.1, 15.0.0, 14.1.5, 14.1.4, 14.1.3, 14.1.2, 14.1.0
BIG-IP APM
- 17.0.0, 16.1.5, 16.1.4, 16.1.3, 16.1.2, 16.1.1, 16.1.0, 16.0.1, 16.0.0, 15.1.9, 15.1.8, 15.1.7, 15.1.6, 15.1.5, 15.1.4, 15.1.3, 15.1.2, 15.1.1, 15.1.0, 15.0.1, 15.0.0, 14.1.5, 14.1.4, 14.1.3, 14.1.2, 14.1.0
BIG-IP Link Controller
- 17.0.0, 16.1.5, 16.1.4, 16.1.3, 16.1.2, 16.1.1, 16.1.0, 16.0.1, 16.0.0, 15.1.9, 15.1.8, 15.1.7, 15.1.6, 15.1.5, 15.1.4, 15.1.3, 15.1.2, 15.1.1, 15.1.0, 15.0.1, 15.0.0, 14.1.5, 14.1.4, 14.1.3, 14.1.2, 14.1.0
BIG-IP LTM
- 17.0.0, 16.1.5, 16.1.4, 16.1.3, 16.1.2, 16.1.1, 16.1.0, 16.0.1, 16.0.0, 15.1.9, 15.1.8, 15.1.7, 15.1.6, 15.1.5, 15.1.4, 15.1.3, 15.1.2, 15.1.1, 15.1.0, 15.0.1, 15.0.0, 14.1.5, 14.1.4, 14.1.3, 14.1.2, 14.1.0
BIG-IP AFM
- 17.0.0, 16.1.5, 16.1.4, 16.1.3, 16.1.2, 16.1.1, 16.1.0, 16.0.1, 16.0.0, 15.1.9, 15.1.8, 15.1.7, 15.1.6, 15.1.5, 15.1.4, 15.1.3, 15.1.2, 15.1.1, 15.1.0, 15.0.1, 15.0.0, 14.1.5, 14.1.4, 14.1.3, 14.1.2, 14.1.0
BIG-IP ASM
- 17.0.0, 16.1.5, 16.1.4, 16.1.3, 16.1.2, 16.1.1, 16.1.0, 16.0.1, 16.0.0, 15.1.9, 15.1.8, 15.1.7, 15.1.6, 15.1.5, 15.1.4, 15.1.3, 15.1.2, 15.1.1, 15.1.0, 15.0.1, 15.0.0, 14.1.5, 14.1.4, 14.1.3, 14.1.2, 14.1.0
Setting Up IPsec To Use NAT Traversal on One Side of the WAN
Overview: Setting up IPsec to use NAT traversal on one side of the WAN
When you are using IPsec to secure WAN traffic, you can set up an IPsec tunnel with NAT
traversal (NAT-T) to get around a firewall or other NAT device. This implementation describes how
to set up the IPsec tunnel when you have a NAT device on one side of the tunnel.
The following illustration shows a network configuration with a firewall (NAT device) on one
side of the WAN.
Before you begin IPsec configuration
Before you configure IPsec on a BIG-IP® device, make sure that you have
completed the following general prerequisites.
- You must have an existing routed IP network between the two locations where the BIG-IP devices will be installed.
- The BIG-IP hardware is installed with an initial network configuration applied.
- The management IP address is configured on the BIG-IP system.
- If you are using NAT traversal, forward UDP ports 500 and 4500 to the BIG-IP system behind each firewall.
- Verify the connectivity between the client or server and its BIG-IP device, and between each BIG-IP device and its gateway. You can usepingto test connectivity.
Task summary
When you are configuring an IPsec tunnel, you must repeat the configuration tasks on the BIG-IP
systems on both sides of the WAN.
Task list
Creating a forwarding virtual server for IPsec
For IPsec, you create a forwarding
(IP) type of virtual server to intercept IP traffic and direct it over the tunnel. With
a forwarding (IP) virtual server, destination address translation and port translation
are disabled.
- On the Main tab, click.The Virtual Server List screen opens.
- ClickCreate.The New Virtual Server screen opens.
- In theNamefield, type a unique name for the virtual server.
- From theTypelist, selectForwarding (IP).
- In theDestination Address/Maskfield, type a wildcard network address in CIDR format, such as0.0.0.0/0for IPv4 or::/0for IPv6, to accept any traffic.
- From theService Portlist, select*All Ports.
- From theProtocollist, select*All Protocols.
- From theVLAN and Tunnel Trafficlist, retain the default selection,All VLANs and Tunnels.
- ClickFinished.
Creating an IPsec tunnel with NAT-T on one side
You can create an IPsec tunnel to securely transport application traffic across
the WAN. You must configure an IPsec tunnel on the BIG-IP systems on both sides of
the WAN.
When you create an IKEv1 or IKEv2 peer for NAT traversal (NAT-T), the key
configuration detail is that the
Remote Address
setting you
configure on the BIG-IP system behind the firewall or other NAT device is the public
IP address of the NAT device (not the IP address of the remote BIG-IP system). You
can customize the remaining settings to conform to your network.For the IKE peer
negotiations to be successful, the IKE Phase 1 settings (on the IKE peer) and IKE
Phase 2 settings (in the IPsec policy) must be the same on the BIG-IP systems at
both ends of the IPsec tunnel.
You must perform this procedure twice, once on each BIG-IP system
on either side of the WAN. For each step in the procedure where you need to type an
IP address, the step shows two sample IP addresses -- one that you configure
on the BIG-IP system located in Site A and the other that you configure on the
BIG-IP system located in Site B.
- Create an IKE peer that specifies the other end of the IPsec tunnel.
- On the Main tab, click.
- Click theCreatebutton.
- In theNamefield, type a unique name for the IKE peer.
- In theRemote Addressfield, type the IP address of the remote peer.If the remote BIG-IP system is behind a firewall or other NAT device, type the public IP address of that device.If the remote BIG-IP system is reachable directly, type the IP address of the BIG-IP system.This address must match the value of theTunnel Remote Addressof the remote site setting in the relevant IPsec policy.For example, on Site A, you specify the translation address for the BIG-IP system in Site B. The BIG-IP system in Site B is behind the NAT device. Here are the peer remote addresses that you would configure on the BIG-IP systems in Site A and Site B, according to the previous illustration.LocationRemote (Peer) AddressSite A165.160.15.20Site B198.50.100.3This screen snippet shows the peerRemote Addresssetting at Site A.
- For the IKE Phase 1 Algorithms area, retain the default values, or select the options that are appropriate for your deployment.
- For the IKE Phase 1 Credentials area, for theAuthentication Methodsetting, select eitherPreshared KeyorRSA Signature, and specify additional information in the fields that appear.For example, if you selectPreshared Key, type the key in thePreshared Keyfield that becomes available.In this example,Preshared Keyis selected.The key you type must be the same at both ends of the tunnel.
- From theNAT Traversallist, selectOn, for Site A's IKE peer only.Use this setting only for the IKE peer (remote BIG-IP system) that is behind a NAT device. On the Site B BIG-IP system, for the IKE peer, retain the default setting,Off.
- ClickFinished.
- Create a custom IPsec policy that uses Tunnel mode and has the same remote IP address as the IKE peer.
- On the Main tab, click.
- Click theCreatebutton.
- In theNamefield, type a unique name for the policy.
- For theIPsec Protocolsetting, retain the default selection,ESP.
- From theModelist, selectTunnel.The screen refreshes to show additional related settings.
- In theTunnel Local Addressfield, type the local IP address of the system you are configuring.For example, the tunnel local addresses that you configure on the BIG-IP systems in Site A and Site B are as follows.LocationTunnel Local AddressSite A198.50.100.3Site B10.102.20.5
- In theTunnel Remote Addressfield, type the IP address of the remote peer.If the remote BIG-IP system is behind a NAT device, type the public IP address of that device.If the remote BIG-IP system is reachable directly, type the IP address of the remote BIG-IP system.This address must match the value of theRemote Addresssetting in the relevant IKE peer.Based on the sample configuration in the implementation overview, the tunnel remote addresses that you configure on the BIG-IP systems in Site A and Site B are as follows.LocationTunnel Remote AddressSite A165.160.15.20Site B198.50.100.3This screen snippet shows the tunnel settings at Site A.
- For theAuthentication Algorithmsetting, retain the default value, or select the algorithm appropriate for your deployment.
- For theEncryption Algorithmsetting, retain the default value, or select the algorithm appropriate for your deployment.
- For thePerfect Forward Secrecysetting, retain the default value, or select the option appropriate for your deployment.
- ClickFinished.
- Create a bidirectional traffic selector that uses the custom IPsec policy you created.The traffic selector filters the application traffic based on the source and destination IP addresses you specify.
- On the Main tab, click.
- ClickCreate.
- In theNamefield, type a unique name for the traffic selector.
- For theOrdersetting, retain the default value.
- For theSource IP Addresssetting, in theAddressfield, type the IP address from which the application traffic originates.In the illustration the source IP addresses that you configure on the BIG-IP systems in Site A and Site B are as follows.LocationSource IP AddressSite A10.100.20.50Site B10.102.20.10
- For theDestination IP Addresssetting, in theAddressfield, type the final IP address for which the application traffic is destined.In the illustration, the destination IP addresses that you configure on the BIG-IP systems in Site A and Site B are as follows.LocationDestination IP AddressSite A10.102.20.10Site B10.100.20.50
- For theActionsetting, retain the default value,Protect.
- From theIPsec Policy Namelist, select the name of the custom IPsec policy that you just created.This screen snippet is an example of the completed Traffic Selector screen at Site A.
- ClickFinished.
- Repeat this task on the BIG-IP system on the other side of the WAN.
After doing this task on each BIG-IP
system in the configuration, you have created an IPsec tunnel through which traffic
travels in both directions across the WAN, and through a firewall on one side.
Verifying IPsec connectivity for Tunnel mode
After you have configured an IPsec tunnel and before you configure additional
functionality, you can verify that the tunnel is passing traffic.
Only data traffic matching the traffic selector triggers the
establishment of the tunnel.
- Access thetmshcommand-line utility.
- Before sending traffic, type this command at the prompt.tmsh modify net ipsec ike-daemon ikedaemon log-level debugThis command increases the logging level to display the messages that you want to view.
- Send data traffic to the destination IP address specified in the traffic selector.
- For an IKEv1 configuration, check the IKE Phase 1 negotiation status by typing this command at the prompt.racoonctl -l show-sa isakmpThis example shows a result of the command.Destinationis the tunnel remote IP address.Destination Cookies ST S V E Created Phase2 165.160.15.20.500 98993e6 . . . 22c87f1 9 I 10 M 2012-06-27 16:51:19 1This table shows the legend for interpreting the result.ColumnDisplayedDescriptionST (Tunnel Status)1Start Phase 1 negotiation2msg 1 received3msg 1 sent4msg 2 received5msg 2 sent6msg 3 received7msg 3 sent8msg 4 received9isakmp tunnel established10isakmp tunnel expiredSIInitiatorRResponderV (Version Number)10ISAKMP version 1.0E (Exchange Mode)MMain (Identity Protection)AAggressivePhase2<n>Number of Phase 2 tunnels negotiated with this IKE peer
- For an IKEv1 configuration, check the IKE Phase 2 negotiation status by typing this command at the prompt.racoonctl -ll show-sa internalThis example shows a result of this command.Sourceis the tunnel local IP address.Destinationis the tunnel remote IP address.Source Destination Status Side 10.100.20.3 165.160.15.20 sa established [R]This table shows the legend for interpreting the result.ColumnDisplayedSideI (Initiator)R (Responder)Statusinitstartacquiregetspi sentgetspi done1st msg sent1st msg recvdcommit bitsa addedsa establishedsa expired
- To verify the establishment of dynamic negotiated Security Associations (SAs), type this command at the prompt.tmsh show net ipsec ipsec-saFor each tunnel, the output displays IP addresses for two IPsec SAs, one for each direction, as shown in the example.IPsec::SecurityAssociations 10.100.20.3 -> 165.160.15.20 SPI(0x7b438626) in esp (tmm: 6) 165.160.15.20 -> 10.100.20.3 SPI(0x5e52a1db) out esp (tmm: 5)
- To display the details of the dynamic negotiated Security Associations (SAs), type this command at the prompt.tmsh show net ipsec ipsec-sa all-propertiesFor each tunnel, the output displays the details for the IPsec SAs, as shown in the example.IPsec::SecurityAssociations 165.160.15.20 -> 10.100.20.3 ----------------------------------------------------------------------------- tmm: 2 Direction: out; SPI: 0x6be3ff01(1810104065); ReqID: 0x9b0a(39690) Protocol: esp; Mode: tunnel; State: mature Authenticated Encryption : aes-gmac128 Current Usage: 307488 bytes Hard lifetime: 94 seconds; unlimited bytes Soft lifetime: 34 seconds; unlimited bytes Replay window size: 64 Last use: 12/13/2012:10:42 Create: 12/13/2012:10:39
- To display the details of the IKE-negotiated SAs (IKEv2), type this command at the prompt.tmsh show net ipsec ike-sa all-properties
- To filter the Security Associations (SAs) by traffic selector, type this command at the prompt.tmsh show net ipsec ipsec-sa traffic-selector ts_codecYou can also filter by other parameters, such as SPI (spi), source address (src_addr), or destination address (dst_addr)The output displays the IPsec SAs that area associated with the traffic selector specified, as shown in the example.IPsec::SecurityAssociations 10.100.115.12 -> 10.100.15.132 SPI(0x2211c0a9) in esp (tmm: 0) 10.100.15.132 -> 10.100.115.12 SPI(0x932e0c44) out esp (tmm: 2)
- Check the IPsec stats by typing this command at the prompt.tmsh show net ipsec-statIf traffic is passing through the IPsec tunnel, the stats will increment.------------------------------------------------------------------- Net::Ipsec Cmd Id Mode Packets In Bytes In Packets Out Bytes Out ------------------------------------------------------------------- 0 TRANSPORT 0 0 0 0 0 TRANSPORT 0 0 0 0 0 TUNNEL 0 0 0 0 0 TUNNEL 0 0 0 0 1 TUNNEL 353.9K 252.4M 24.9K 1.8M 2 TUNNEL 117.9K 41.0M 163.3K 12.4M
- If the SAs are established, but traffic is not passing, type one of these commands at the prompt.
tmsh delete net ipsec ipsec-sa (IKEv1)
tmsh delete net ipsec ike-sa (IKEv2)This action deletes the IPsec tunnels. Sending new traffic triggers SA negotiation and establishment. - If traffic is still not passing, type this command at the prompt.racoonctl flush-sa isakmpThis action brings down the control channel. Sending new traffic triggers SA negotiation and establishment.
- View the/var/log/racoon.logto verify that the IPsec tunnel is up.These lines are examples of the messages you are looking for.2012-06-29 16:45:13: INFO: ISAKMP-SA established 10.100.20.3[500]-165.160.15.20[500] spi:3840191bd045fa51:673828cf6adc5c61 2012-06-29 16:45:14: INFO: initiate new phase 2 negotiation: 10.100.20.3[500]<=>165.160.15.20[500] 2012-06-29 16:45:14: INFO: IPsec-SA established: ESP/Tunnel 165.160.15.20[0]->10.100.20.3[0] spi=2403416622(0x8f413a2e) 2012-06-29 16:45:14: INFO: IPsec-SA established: ESP/Tunnel 10.100.20.3[0]->165.160.15.20[0] spi=4573766(0x45ca46
- To turn on IKEv2 logging on a production build, complete these steps.If you are using IKEv2, you can skip these steps; the BIG-IP system enables IPsec logging by default.
- Configure the log publisher for IPsec to use.% tmsh create sys log-config publisher ipsec { destinations add { local-syslog }} % tmsh list sys log-config publisher ipsec sys log-config publisher ipsec { destinations { local-syslog { } } }
- Attach the log publisher to theike-daemonobject.tmsh modify net ipsec ike-daemon ikedaemon log-publisher ipsec
- For protocol-level troubleshooting, you can increase the debug level by typing this command at the prompt.tmsh modify net ipsec ike-daemon ikedaemon log-level debug2Use this command only for debugging. It creates a large log file, and can slow the tunnel negotiation.Using this command flushes existing SAs.
- After you view the results, return the debug level to normal to avoid excessive logging by typing this command at the prompt.tmsh modify net ipsec ike-daemon ikedaemon log-level infoUsing this command flushes existing SAs.