Used Cars from USA
Previous Page
Next Page

Deploying IPsec VPNs: Fundamental Considerations

When deploying an IPsec VPN, there are a number of fundamental considerations, including the following:

  • IKE policies (assuming automated SA and key management)

  • IPsec transforms

  • Crypto access lists

  • Crypto map

  • Transport of multiprotocol and multicast traffic

  • Manual SA and key management

  • Special considerations, including whether IPsec tunnels will traverse NAT devices or firewalls

These considerations are discussed in the remainder this chapter. The sample topology shown in Figure 6-31 is used to illustrate the various concepts discussed.

Figure 6-31. Sample IPsec VPN Topology


Selecting and Configuring IKE Policies for Automated SA and Key Management

When deploying IPsec VPNs with IKE, it is important to select the appropriate IKE parameters such as method of authentication and encryption algorithm to ensure that the VPN is both secure and scalable. IKE parameters are collectively known as a protection suite.

As previously mentioned, the purpose of IKE is to allow IPsec peers (IPsec VPN gateways) to dynamically authenticate each other, negotiate cryptographic parameters, and agree on session keys.

Selecting the Appropriate Method of IKE Authentication

Cisco routers can support three methods of authentication for IKE:

The sections that follow cover these methods of authentication in greater detail.

IKE Preshared Key Authentication

You can configure IKE preshared key authentication on all Cisco devices that support IPsec.

Example 6-1 shows configuration of an IKE (ISAKMP) preshared key on a Cisco IOS router using the crypto isakmp key keystring address peer-address [mask] command.

Example 6-1. Configuring Preshared Key Authentication

London#conf t
Enter configuration commands, one per line. End with CNTL/Z.
London(config)#crypto isakmp key 1tdsKre*7:'W12345sQw'#%5 address 192.168.2.2
London(config)#exit
London#

In Example 6-1, the preshared key is 1tdsKre*7: 'W12345sQw'#%5, and the peer's IP address is 192.168.2.2. The preshared key is an alphanumeric string and must be configured identically on peer IPsec VPN gateways. If the preshared key is not configured identically on peer IPsec VPN gateways, IKE authentication will fail, and the IPsec tunnel(s) will not come up.

The address parameter is used to specify the identity of the remote IPsec peer in the form of an IP address.

Normally, you specify one preshared key per remote IPsec VPN gateway. Having one preshared per remote gateway is best from a security perspective, but with a large number of remote gateways administration can become burdensome.

It is possible to specify a wildcard address (0.0.0.0) rather than a specific IP address. If you specify a wildcard address, a remote host with any IP address can establish an IPsec tunnel using the configured preshared key. Example 6-2 illustrates configuration of a wildcard preshared key.

Example 6-2. Configuring a Wildcard Preshared Key

London#conf t
Enter configuration commands, one per line. End with CNTL/Z.
London(config)#crypto isakmp key 4$pe&89fHPi*90oic;:atv!(:1 address 0.0.0.0
London(config)#exit
London#

Although wildcard preshared keys can occasionally be useful, you should be aware of the security risks. A regular preshared key can only be used by the IPsec VPN gateway specified (for example, 192.168.2.2 in Example 6-2). But when you configure a wildcard preshared key, an attacker with any IP address can connect to the IPsec VPN gateway if he/she is able to find out the preshared key (something that is quite possible if you choose a weak preshared key).

It is worth taking a closer look at the preshared keystring itself. Notice that in Example 6-1 the keystring is pretty random (1tdsKre*7: 'W12345sQw'#%5). The (relative) randomness of the keystring is deliberateif the keystring is easily guessable, it is weak and vulnerable to attack. So, make sure that your preshared keys are long, random strings of lower- and uppercase characters, numbers, and punctuation.

It is possible to launch brute-force attacks against weak preshared keys, especially if you use aggressive mode for phase 1 IKE negotiation. If you use main mode for IKE phase 1 negotiation, it is more difficult but still possible for an attacker to recover a weak preshared key.

Do not be lulled by the strength of cryptographic algorithms such as SHA-1, 3DES, and AES, thinking that it does not matter whether preshared keys are (relatively) random. Preshared keys can be the weak link that undermines IPsec as a whole.

Note

The vulnerability of weak preshared keys has been extensively documented. For more information, refer to the following sites:

http://www.ernw.de/download/pskattack.pdf

http://www.cisco.com/warp/public/707/cisco-sn-20030422-ike.html


Now that you know how vulnerable weak preshared keys can be to attack, it is useful to list some recommendations for using preshared key authentication:

  • Don't! If possible, use digital signature authentication instead. See the section "IKE Digital Signature Authentication" later in this chapter for more information.

  • Make sure that your preshared keys are as random as possible (as previously described).

  • Use a unique preshared key between each pair of IPsec peers.

    Do not use wildcard or group preshared keys, if possible. Wildcard and group preshared keys are particularly vulnerable to attack because a specific preshared key is not tied to a specific peer identity (such as an IP address or fully qualified domain name).

  • Cisco routers use main mode for IKE phase 1 negotiations by default. However, if a remote IPsec peer initiates aggressive mode to a Cisco router, the Cisco router will switch to aggressive mode.

    If you do not need aggressive mode, you can disable it using the crypto isakmp aggressive-mode disable command, as shown in Example 6-3. This command is available in Cisco IOS Software Release 12.3(1) and higher.

    Example 6-3. Disabling IKE Aggressive Mode

    London#conf t
    Enter configuration commands, one per line. End with CNTL/Z.
    London(config)#crypto isakmp aggressive-mode disable
    London(config)#exit
    London#
    

    Make sure that you do not disable IKE aggressive mode if you are deploying remote access IPsec VPNs with Cisco VPN clients or Cisco Easy VPN clients. Both Cisco VPN clients and Easy VPN clients may require IKE aggressive mode negotiation.

  • By default, preshared keys are stored in cleartext in IPsec VPN gateway configuration files.

    Do not overlook the possibility of an attacker gaining access to printouts of IPsec VPN gateway configuration files or IPsec VPN gateway configuration files stored on a file server. Make sure that distribution of printouts of IPsec VPN gateway configuration files is restricted and that file servers are properly secured. In addition, if you are running Cisco IOS Software Release 12.3(2)T or higher, you can encrypt preshared keys within your IPsec VPN gateway configuration files.

Example 6-4 shows the encryption of preshared keys in a configuration file.

Example 6-4. Encrypting Preshared Keys in a Configuration File

London#show running-config | begin crypto isakmp key
crypto isakmp key cisco address 192.168.1.1 (line 1)
!
London#conf t
Enter configuration commands, one per line. End with CNTL/Z.
London(config)#key config-key password-encrypt psk123encrypt (line 2)
London(config)#password encryption aes (line 3)
London(config)#exit
London#
London#show running-config | begin crypto isakmp key
crypto isakmp key 6 ShGXJ][_TOLdGHTPFg[U_EMQff_ address 192.168.1.1 (line 4)
!
!

Highlighted line 1 shows that the preshared key is cisco. Note that this is a weak preshared key and is used for illustrative purposes only.

In highlighted lines 2, a master key that will be used to encrypt all preshared keys within the configuration file is configured using the key config-key password-encrypt [master-key] command. In this example, the master key is psk123encrypt. The master key is not stored within the configuration file and cannot be obtained by users that connect to the router.

In highlighted line 3, the password encryption aes command is used to enable encryption of preshared keys within the configuration file using the AES.

Finally, in highlighted line 4, you can see the preshared key in its encrypted form within the configuration file.

IKE Encrypted Nonce Authentication

The second option for IKE authentication is encrypted nonce authentication.

Note

Encrypted nonce authentication can be configured only on Cisco routers, and not on PIX Firewalls, ASA 5500s, or VPN 3000 concentrators.


In you want to use encrypted nonce authentication, you must complete the following tasks on each IPsec VPN gateway:

  • Configure the IPsec VPN gateway's host name and domain name.

  • Generate RSA keys.

  • Configure public keys from peer IPsec VPN gateways.

You can configure an IPsec VPN gateway's host name and IP domain name using the hostname hostname and ip domain-name domain-name commands, as demonstrated in Example 6-5.

Example 6-5. Configuring the Host Name and IP Domain Name

London#conf t
Enter configuration commands, one per line. End with CNTL/Z.
London(config)#hostname London
London(config)#ip domain-name mjlnet.com
London(config)#exit
London#

In Example 6-5, an IPsec VPN gateway's host name and domain name are configured as London and mjlnet.com, respectively. The host name and domain name are concatenated into the fully qualified domain name (FQDN) London.mjlnet.com.

After you have configured the host name and domain name, the next step is to generate RSA keys on the IPsec VPN gateway using the crypto key generate rsa [usage-keys | general-keys] [key-pair-label] command, as demonstrated in Example 6-6.

Example 6-6. Generating RSA Keys on an IPsec VPN Gateway

London#conf t
Enter configuration commands, one per line. End with CNTL/Z.
London(config)#crypto key generate rsa (line 1)
The name for the keys will be: London.mjlnet.com (line 2)
Choose the size of the key modulus in the range of 360 to 2048 for your
 General Purpose Keys. Choosing a key modulus greater than 512 may take
 a few minutes.
How many bits in the modulus [512]: 1024 (line 3)
% Generating 1024 bit RSA keys...[OK]
London(config)#exit
London#

In highlighted line 1, the crypto key generate rsa command is used to generate RSA general usage keys (keys that can be used for either signing or encryption). If you specify the usage-keys keyword, separate keys are generated for encryption and signing.

The message shown in highlighted line 2 indicates that the name assigned to the key pair (public and private keys) will be London.mjlnet.com (the FQDN). The default name assigned to the key pair is the FQDN, but if you do want to assign a different name to a key pair, you can specify it using the key-pair-label parameter when you use the crypto key generate rsa command.

Highlighted line 3 specifies a key size (modulus) of 1024 bits. You can specify a key modulus of 360 to 2048 bits. The shorter the key modulus, the less secure the key pair is, so recommended practice is that you use a minimum key modulus of 1024 bits.

After you have generated RSA keys on your IPsec VPN gateways, the next step is to exchange the peer gateways' public keys and paste them into the configuration of the IPsec VPN gateways.

For example, after you have generated RSA keys on the London and Berlin gateways (see Figure 6-31), you should paste the public key(s) from the Berlin gateway into the configuration of the London gateway and the public key(s) of the London gateway into the configuration of the Berlin gateway.

In Figures 6-32, 6-33, and 6-34, the public key of the Berlin gateway is displayed, and then it is copied and pasted into the configuration of the London gateway.

Figure 6-32. Displaying and Copying the Public Key of the Berlin IPsec VPN Gateway


Figure 6-33. Preparing to Paste Berlin's Public Key into the Configuration of the London IPsec VPN Gateway


Figure 6-34. Berlin's Public Key Is Pasted to the London IPsec VPN Gateway


In Figure 6-32, the show crypto key mypubkey rsa command is used to display the public key of the Berlin gateway. This public key is copied.

In Figure 6-33, the crypto key pubkey-chain rsa command is used on the London IPsec VPN gateway to enter the public key configuration mode.

The named-key key-name command is then used to specify the name (FQDN) of the key to be manually configured (in this example, Berlin.mjlnet.com).

Finally, the key-string command is used to enter the mode in which the public key from the peer gateway (Berlin in this example) can be pasted into the configuration.

As shown in Figure 6-34, after the key-string command has been entered, the public key of the remote gateway is pasted, and the quit command is used to exit public key configuration mode.

You might be thinking to yourself that IKE encrypted nonce authentication looks like a lot of hard work, especially if you have a large number of gateways in your VPN. Well, you are right; it is a lot of hard work (imagine copying and pasting all those public keys), and that is the reason that it is not a common method of IKE authentication.

So, when might you use encrypted nonce authentication? Well, you might possibly use it if you are concerned about weak preshared keys but you do not want to go to the trouble of deploying the PKI necessary to enable digital signature authentication.

In summary, IKE encrypted nonce authentication is more secure than preshared key authentication, but it is a lot of trouble to set it up for a large number of IPsec peers. Most people opt for preshared key authentication (while avoiding weak preshared keys) or, much better, use digital signature authentication.

IKE Digital Signature Authentication

The third and final method of IKE authentication is RSA digital signature authentication using digital certificates.

You must complete a number of steps on each IPsec VPN gateway if you want to use digital signature authentication in your IPsec VPN:

Step 1.
Step 2.
Step 3.
Step 4.
Step 5.
Step 6.

These steps are examined in the sections that follow.

Step 1: Set the Time on the IPsec VPN Gateways

Ensuring that the time is correctly set on IPsec VPN gateways is important when using digital signature authentication. Certificates are valid for a certain time period only, and if the time is not set correctly, IKE authentication may fail, and gateways may not even be able to obtain a certificate from a CA in the first place.

So, now that you know how important time is for digital signature authentication, what are the options for ensuring accurate time on the gateways? There are two options:

  • Manually setting the time on each IPsec VPN gateway

  • Setting the time on IPsec VPN gateways using the Network Time Protocol (NTP)

These methods of ensuring accurate time are discussed in the following two sections.

Manually Setting the Time on Each IPsec VPN Gateway To ensure accurate time on IPsec VPN gateways by manually setting them, use the clock set hh:mm:ss day month year command to manually set the clock, as demonstrated in Example 6-7.

Example 6-7. Manually Setting the System Clock

London#clock set 11:33:00 june 14 2004

Also, be sure to set the time zone using the clock timezone zone hours-offset [minutes-offset] command, as demonstrated in Example 6-8.

Example 6-8. Setting the Time Zone

London#conf t
Enter configuration commands, one per line. End with CNTL/Z.
London(config)#clock timezone GMT 0
London(config)#exit
London#

In Example 6-8, the time zone is set to be GMT (Greenwich mean time), with an offset of 0 hours from universal time coordinated (UTC).

Disadvantages of manually setting time of the IPsec VPN gateways are that it is easy to make a simple error and if the systems in question do not have hardware clocks, the time will reset in the event of a reboot.

Setting the Time on IPsec VPN Gateways Using NTP Another option for ensuring accurate time on the gateways in an IPsec VPN is to use NTP.

The advantages of NTP are that you can be sure that all the gateways in the VPN will have accurate time (assuming that the NTP server[s] has accurate time), and that even if a gateway is rebooted it will resynchronize its time with an NTP server.

The disadvantage of NTP is that an NTP server (or preferably servers) is required.

Use the ntp server ip-address command to allow a gateway to synchronize its time to an NTP server, as demonstrated in Example 6-9.

Example 6-9. Specifying an NTP Server Using the ntp server Command

London#conf t
Enter configuration commands, one per line. End with CNTL/Z.
London(config)#ntp server 10.10.10.99
London(config)#exit
London#

In Example 6-9, a gateway is configured to synchronize its time to NTP server 10.10.10.99.

One important consideration when using NTP is to ensure that IPsec VPN gateways synchronize their clocks with a trusted time source. It is possible for an attacker to carry out a denial-of-service attack by getting gateways to synchronize their time with a bogus time source. In this case, IKE authentication can fail if the bogus time is outside the validity period of the gateways' certificates. In addition, gateways with revoked certificates might be able continue to participate in the VPN.

To ensure that gateways synchronize their clocks with a trusted time source, you can use NTP authentication, as demonstrated in Example 6-10.

Example 6-10. Configuring NTP Authentication

London#conf t
Enter configuration commands, one per line. End with CNTL/Z.
London(config)#ntp authenticate
London(config)#ntp authentication-key 1 md5 mjlnet
London(config)#ntp trusted-key 1
London(config)#ntp server 10.10.10.99 key 1
London(config)#exit
London#

The ntp authenticate command in Example 6-10 enables NTP authentication.

The ntp authentication-key key-number md5 key-string command specifies MD5 NTP authentication with, in this example, the key string mjlnet. Note that mjlnet is not a secure choice of authentication key and is used here for illustrative purposes only. In live deployments, you should choose a random string of up to eight characters.

After the authentication key has been configured, the ntp trusted-key key-number command specifies the trusted NTP key. The key number must match with that specified using the ntp authentication-key command.

The ntp server ip-address key key-value command then configures the IP address of an NTP server, and specifies that the gateway will synchronize its time to that server only if the server's NTP packets can be authenticated with the previously specified trusted key (mjlnet in this example).

Note

If you decide to use NTP in your IPsec VPN, it is important that it be deployed in a scalable, highly available, and secure manner. A good starting point for obtaining more information concerning NTP deployment is the following white paper:

http://www.cisco.com/en/US/tech/tk869/tk769/technologies_white_paper09186a0080117070.shtml


Step 2: Configure the IPsec VPN Gateways' Host Names and IP Domain Names

Having set the time on the IPsec VPN gateways, the next step is to configure their IP domain names, as well host names if they have not already been configured.

Example 6-11 demonstrates configuration of the IP domain name.

Example 6-11. Configuring an IP Domain Name

London#conf t
Enter configuration commands, one per line. End with CNTL/Z.
London(config)#ip domain-name mjlnet.com
London(config)#exit
London#

The IP domain name of IPsec VPN gateway London is configured in Example 6-11 using the ip domain-name name command.

If you have not already configured a host name on your IPsec VPN gateways, now is the time to do it using the hostname name global configuration mode command.

The IPsec VPN gateways' host name and IP domain name are concatenated to produce an FQDN.

Step 3: Generate RSA Keys on the IPsec VPN Gateways

Next are the IPsec VPN gateways' RSA keys.

Use the crypto key generate rsa command to generate RSA keys, as demonstrated in Example 6-12.

Example 6-12. Generating RSA Keys on the IPsec VPN Gateways

London#conf t
Enter configuration commands, one per line. End with CNTL/Z.
London(config)#crypto key generate rsa
The name for the keys will be: London.mjlnet.com
Choose the size of the key modulus in the range of 360 to 2048 for your
 General Purpose Keys. Choosing a key modulus greater than 512 may take
   a few minutes.
How many bits in the modulus [512]: 1024
% Generating 1024 bit RSA keys...[OK]
London(config)#exit
London#

Notice that the name associated with the RSA key pair generated using the crypto key generate command is, by default, the FQDN of the gateway. Also, notice that a key length (modulus) of 1024 bits is specified. The minimum recommended length for RSA keys is 1024 bits.

You can verify the RSA keys using the show crypto key mypubkey rsa command, as demonstrated in Example 6-13.

Example 6-13. Verifying RSA Keys

London#show crypto key mypubkey rsa
% Key pair was generated at: 12:14:20 GMT Jun 14 2004
Key name: London.mjlnet.com (line 1)
 Usage: General Purpose Key (line 2)
 Key is not exportable.
 Key Data:
 30819F30 0D06092A 864886F7 0D010101 05000381 8D003081 89028181 00C6CED9 (line 3)
 C6887913 A661D773 C200DB17 0BF83826 30371342 18EF2CCD F691BB36 62E91B5D (line 4)
 17C9B4F9 4F1CCDE4 15A4F80F 3288D6E9 C193701A 246CEAE6 CCEDD551 C577A7C8 (line 5)
 EE247482 37F2166D 7B0C21E5 6BD038E9 4D48210B 799CF399 1097B323 BD8E9776 (line 6)
 C2533CDE 3B1ED52B B49A364C 895C5BC3 9BB6D517 671677D5 2A5CC996
  BF020301 0001 (line 7)
% Key pair was generated at: 12:26:36 GMT Jun 14 2004
Key name: London.mjlnet.com.server
 Usage: Encryption Key
 Key is not exportable.
 Key Data:
 307C300D 06092A86 4886F70D 01010105 00036B00 30680261 009A2365 E55C3BC9
 742995EC FDB3DFDF 1AF1EE36 D05D3ABF 749282A7 4C8D152E 78DA88D4 2B25178C
 04A3209E 1008ED55 6B1A82AB 2A7C49BA 86005839 06517310 4B95C487 6D2D3666
 ADFA28BF 84BADB77 3F92A3D7 6F061F73 B5ABAB9E 19A472C3 0B020301 0001
London#

Highlighted line 1 shows the RSA public key name London.mjlnet.com.

Highlighted line 2 shows that the key is for general purposes (encryption and signing).

The key itself is then shown in highlighted lines 3 to 7.

Step 4: Declare the CA

You are almost ready to obtain the IPsec VPN gateway's certificate from the CA, but there are one or two remaining steps before you can do thatthe first of which is to declare the CA.

Declaring the CA involves a number of things, including specifying a name for the CA, specifying the mode to be used for certificate enrollment, and configuring the URL to use when enrolling with the CA.

Before declaring the CA, make sure that the CA's name is mapped locally on the gateway using the ip host name ip-address command or resolvable via DNS.

Example 6-14 declares CA mjlnetcertsrv.

Example 6-14. Declaring the CA

London#conf t
Enter configuration commands, one per line. End with CNTL/Z.
London(config)#crypto pki trustpoint mjlnetcertsrv (line 1)
London(ca-trustpoint)#enrollment mode ra (line 2)
London(ca-trustpoint)#enrollment url
 http://mjlnetcertsrv:80/certsrv/mscep/mscep.dll (line 3)
London(ca-trustpoint)#revocation-check none (line 4)
London(ca-trustpoint)#end
London#

In highlighted line 1, the crypto pki trustpoint name command configures a locally significant name for a CA and enters ca-trustpoint configuration mode.

Note

The crypto pki trustpoint command replaces the crypto ca trustpoint, crypto ca identity, and crypto ca trusted-root commands. The pki keyword also replaces the ca keyword in a number of commands in more recent versions of Cisco IOS Software.


The enrollment mode ra command shown in highlighted line 2 configures the gateway to enroll with the CA using the registration authority (RA) enrollment mode. Check with your CA administrator about the enrollment mode that you should configure.

Next is the enrollment url url command (highlighted line 3). This command configures the URL to be used for Simple Certificate Enrollment Protocol (SCEP) enrollment with the CA. SCEP is a protocol that supports operations such as certificate enrollment, revocation, certificate access, and CRL access.

Verify the correct enrollment URL with your CA administrator.

Note

It is also possible to enroll with a CA either manually or using TFTP if your CA does not support SCEP. Check Cisco.com for more information.


In highlighted line 4, the revocation-check method1 [method2[method3]] command specifies how the gateway should check whether peer IPsec VPN gateways' certificates have been revoked. You can specify up to three methods for the gateway to use for certificate revocation checking. If more than one method is specified, each method is tried in turn.

In Example 6-14, the none keyword is specified, so the local gateway will check a CRL if one is cached in memory, but will not download a CRL from a CRL Distribution Point (CDP). The revocation-check none command replaces the crl optional command.

Other keywords (methods) that you can specify with the revocation-check command are ocsp and crl. If you specify the ocsp keyword, OCSP is used to check certificate revocation status, via the OSCP responder (server) specified in the Authority Information Access (AIA) extension of a certificate (it is also possible to specify the OCSP responder manually, and override that contained in the AIA, by using the ocsp url url command in the trustpoint configuration mode). If you specify the crl keyword, the gateway will attempt to download a CRL from the CDP specified in a certificate.

If you specify either the ocsp or crl keyword alone (for example, revocation-check oscp), the local gateway attempts to verify certificate status by using OCSP or by downloading a CRL as appropriate; if it is unable to contact the OCSP responder or download the CRL, however, the revocation check will not succeed, and IKE authentication will fail.

A best-effort certificate revocation check can be configured by specifying the none keyword after the crl or ocsp keywords. So, for example, if you specify the revocation-check crl none command, the local gateway will attempt to download a CRL and verify the certificate's status; if it is unable to download the CRL, however, it will accept the certificate, and IKE authentication will succeed.

The revocation-check crl none command replaces the crl best-effort command.

Note

If you specify either the none keyword alone or use best-effort certificate revocation checking (as previously discussed), it is possible for IKE authentication to succeed even if a certificate has been revoked.

On the other hand, if you specify either the ocsp or crl keyword alone, it is possible for an attacker to conduct a denial-of-service attack on your IPsec VPN by targeting the OSCP responder(s) or CDP(s) and making them unavailable to the IPsec VPN gateways. In this case, if the OSCP responder or CDP is unavailable, IKE authentication will fail throughout the IPsec VPN.

So, be sure you carefully weigh the options when configuring the revocation-check command.


Step 5: Authenticate the CA

The penultimate step before you can enroll your IPsec VPN gateways is to authenticate the CA by obtaining its certificate, as illustrated in Figure 6-35.

Figure 6-35. Authenticating the CA


Use the crypto pki authenticate name command to authenticate the CA, as demonstrated in Example 6-15, where the name parameter is that specified when declaring the CA (see Example 6-14).

Example 6-15. Authenticating the CA

London#conf t
Enter configuration commands, one per line. End with CNTL/Z.
London(config)#crypto pki authenticate mjlnetcertsrv
Certificate has the following attributes:
Fingerprint: 54C151AE FFF125FD BD4FB4D7 D26AD8CA
% Do you accept this certificate? [yes/no]: y
Trustpoint CA certificate accepted.
London(config)#exit
London#

In Example 6-15, the CA's certificate is downloaded from the CA.

At this point, you can choose to either accept or reject the CA's certificate. If the fingerprint displayed (highlighted in Example 6-15) matches the fingerprint visible to the CA administrator, you should accept the certificate.

After the CA's certificate has been downloaded, you can verify the CA's certificate using the show crypto pki certificate command, as demonstrated in Example 6-16.

Example 6-16. Verifying the CA's Certificate

London#show crypto pki certificate
CA Certificate
 Status: Available
 Certificate Serial Number: 48B8A34E0C6A09A7447B8CBDD77C3A81
 Certificate Usage: Signature
 Issuer:
  CN = mjlnet.ca1
   OU = Engineering
   O = MJL Network Solutions
   L = London
   ST = none
   C = UK
   EA = admin@mjlnet.com
 Subject:
  CN = mjlnet.ca1
   OU = Engineering
   O = MJL Network Solutions
   L = London
   ST = none
   C = UK
   EA = admin@mjlnet.com
 CRL Distribution Point:
  http://mjl-certsrv-acs/CertEnroll/mjlnet.ca1.crl
 Validity Date:
  start date: 13:20:22 UTC Mar 25 2004
  end date: 13:29:01 UTC Mar 25 2009
 Associated Trustpoints: mjlnetca
London#

For more information about the fields in the certificate shown in Example 6-16, see the section titled "The X.509 Certificate" in Chapter 7.

Note

You can also manually add (or delete) a CA's certificate in hexadecimal format using the certificate ca certificate-serial-number command within the certificate chain configuration mode. You can enter the certificate chain configuration mode using the crypto pki certificate chain name command from global configuration mode.


Step 6: Enroll the IPsec VPN Gateways with the CA

The final step is to enroll the IPsec VPN gateway with the CA. During enrollment, the gateway obtains a signed certificate from the CA for each RSA key pair that you generated, as illustrated in Figure 6-36.

Figure 6-36. Enrolling with the CA and Obtaining a Certificate


You can use the crypto pki enroll name command to enroll with the CA, as demonstrated in Example 6-17. The name should be the same as you specified using the crypto pki trustpoint command (see Example 6-14).

Example 6-17. Enrolling with the CA

London#conf t
Enter configuration commands, one per line. End with CNTL/Z.
London(config)#crypto pki enroll mjlnetcertsrv
%
% Start certificate enrollment..
% Create a challenge password. You will need to verbally provide this
  password to the CA Administrator to revoke your certificate.
  For security reasons your password will not be saved in the configuration.
  Please make a note of it.
Password: (line 1)
Re-enter password: (line 2)
% The fully-qualified domain name in the certificate will be: London.mjlnet.com
% The subject name in the certificate will be: London.mjlnet.com (line 3)
% Include the router serial number in the subject name? [yes/no]: no (line 4)
% Include an IP address in the subject name? [no]: (line 5)
Request certificate from CA? [yes/no]: yes (line 6)
% Certificate request sent to Certificate Authority
% The certificate request fingerprint will be displayed.
% The 'show crypto ca certificate' command will also show the fingerprint.
London(config)# Fingerprint: DEEFAF09 8FC3C7D3 1F26ACE8 87E7238F
Jun 14 11:37:18.859: CRYPTO_PKI: status = 102:
 certificate request pending (line 7)
Jun 14 11:37:40.215: CRYPTO_PKI: status = 102: certificate request pending
Jun 14 11:38:42.175: %CRYPTO-6-CERTRET: Certificate received from Certificate
 Authority (line 8)
London(config)#exit
London#

As you can see in Example 6-17, when you issue the crypto pki enroll command, you are asked to enter a password (highlighted lines 1 and 2) and then asked whether you want to include the router serial number (highlighted line 4) and IP address (highlighted line 5) in the certificate.

The CA administrator may ask you to supply the challenge password in the event that you need to revoke the certificate, so make sure you note this.

The serial number referred to in highlighted line 4 is not the certificate serial number (see the section "The X.509 Certificate" in Chapter 7 for more on this), but instead the gateway's internal board serial number.

If you want to include an IP address in the certificate (see highlighted line 5), make sure it is the IP address of the outside interface to which the crypto map is applied, or if the crypto map is applied to multiple interfaces, the IP address specified with the crypto map local-address command.

Be careful if you do decide to include an IP address in the certificate because if you do change the IP address on the outside interface (or the IP address referred to with the crypto map local-address command), IKE authentication will fail for the IPsec VPN gateway in question. In this case, you need to re-enroll the gateway with the CA, and obtain a new certificate, or change the IP address on the outside interface (or the IP address referred to with the crypto map local-address command) back to its original form.

Notice the subject name shown in highlighted line 3the gateway's FQDN is, by default, included as the subject name in the gateway's certificate.

The certificate is requested from the CA in highlighted line 6, and then in highlighted line 7 you can see that the certificate request is pending.

The CA administrator then approves the certificate, and in highlighted line 8 the gateway receives its certificate.

You can verify the certificate using the show crypto pki certificate command, as demonstrated in Example 6-18 (only the relevant output is shown).

Example 6-18. Verifying the IPsec VPN Gateway's Certificate

London#show crypto pki certificates
Certificate
 Status: Available
Certificate Serial Number: 617C2FE2000000000012
Certificate Usage: General Purpose
Issuer:
 cn=mjlnet.ca1
 ou=Engineering
 o=MJL Network Solutions
 l=London
 st=none
 c=UK
 ea=admin@mjlnet.com
Subject:
 Name: London.mjlnet.com
 hostname=London.mjlnet.com
CRL Distribution Points:
 http://mjlnet-ca/CertEnroll/mjlnet.ca1.crl
Validity Date:
 start date: 11:07:22 GMT Jun 14 2004
 end  date: 11:17:22 GMT Jun 14 2005
 renew date: 00:00:00 GMT Jan 1 1970
Associated Trustpoints: mjlnetcertsrv

The status of the IPsec VPN gateway's certificate is listed as Available, which indicates that the (signed) certificate has been received from the CA. For more information on the various fields in the certificate, see the section "The X.509 Certificate" in Chapter 7.

Phew! All done. But, just in case you are not satisfied with the contents of your certificate, and if you prefer not to go through the dialog shown Example 6-17 (entering a password, specifying a serial number, and so on), it is possible to configure this information in advance within the crypto ca-trustpoint mode, as shown in Example 6-19.

Example 6-19. Specifying Answers to the Certificate Enrollment Dialog, as Well as Certificate Fields

London#conf t
Enter configuration commands, one per line. End with CNTL/Z.
London(config)#crypto pki trustpoint mjlnetcertsrv
London(ca-trustpoint)#usage ike (line 1)
London(ca-trustpoint)#subject-name C=GB, O=MJL Network Solutions,
 OU=Engineering (line 2)
London(ca-trustpoint)#ip-address 192.168.1.1 (line 3)
London(ca-trustpoint)#serial-number (line 4)
London(ca-trustpoint)#password cisco (line 5)
London(ca-trustpoint)#end (line 6)
London#

The usage method1 [method2 [method3]] command in highlighted line 1 specifies the usage of the certificate (in this case, IKE).

In highlighted line 2, the subject-name command specifies the X.500 Distinguished Name (DN) to be used in the Subject Name field of the certificate. In this example, the country (C) is GB, the Organization (O) is MJL Network Solutions, and the organizational unit (OU) is Engineering.

Highlighted line 3 specifies the IP address 192.168.1.1 using the ip-address address command. This IP address is included in the Subject Name field of the certificate. Make sure that you follow the guidelines discussed earlier in this section if you do decide to include an IP address in the certificate.

Next is the serial-number command (see highlighted line 4). This command specifies that the internal board serial number should be included in the certificate. Again, the serial number is included in the Subject Name field of the certificate. If you do not want to include the gateway's serial number in the certificate, you can specify this using the serial-number none command.

The challenge password is specified in highlighted line 5. This password must be supplied to the CA administrator if you need to revoke the certificate at a later date. The password specified in this example (cisco) is not secure and is used for illustrative purposes only.

Caution

Make sure that you save your configuration using the copy running-config startup-config command after you have generated RSA keys, authenticated the CA, and enrolled with the CA.

If you do not save your configuration, information will be lost, and you will have to repeat these processes.


Automating Enrollment with the CA

Now that you know how to enroll with the CA manually, it is useful to take a look at how this process can be automated. The auto-enrollment feature enables you to preconfigure your IPsec VPN gateway with enrollment parameters, and it will then automatically enroll with the CA. If you are configuring a large number of IPsec VPN gateways, this can really be a time saver.

Example 6-20 shows the configuration necessary to enable auto-enrollment.

Example 6-20. Configuring an IPsec VPN Gateway for Auto-Enrollment with the CA

!
crypto pki trustpoint mjlnetcertsrv
 enrollment mode ra
 enrollment url http://mjlnetcertsrv:80/certsrv/mscep/mscep.dll
 usage ike
 serial-number none
 ip-address 192.168.1.1
 password 7 121A0C041104
 subject-name C=GB, O=mjlnet, OU=engineering
 revocation-check crl
 rsakeypair London.mjlnet.com 1024 (line 1)
 auto-enroll (line 2)
!

Almost all of the commands shown in Example 6-20 should already be familiar, but there are one or two new commands.

In highlighted line 2, you can see the auto-enroll [percent] [regenerate] command. This command configures the gateway to automatically generate RSA keys and enroll with the CA on reboot using the parameters specified.

The optional rsakeypair key-label [key-size [encryption-key-size]] command (highlighted line 1) specifies which key pair you want to associate with the certificate as well as (optionally) the key size.

The rsakeypair command is important because, by default, the auto-enroll command generates 512-bit RSA keys prior to enrolling with the CA. By configuring the rsakeypair command, you can specify the RSA key size (the minimum recommended is 1024 bits).

There is one process that must be completed manually on the gateway before auto-enrollment can beginyou must manually authenticate the CA (as discussed in the section "Step 5: Authenticate the CA"). If you forget to authenticate the CA, the message shown in Example 6-21 displays.

Example 6-21. Message Displayed If You Forget to Authenticate the CA

% Time to Re-enroll trust_point mjlnetcertsrv
% You must authenticate the Certificate Authority before you can enroll with it.

Automating Re-Enrollment with the CA

Okay, your IPsec VPN gateways now have their certificates, and you can relax, right? Well, you can for a whilespecifically until your gateways' certificates expire. If you have manually enrolled the gateways with the CA, when the certificates expire you have to go through the entire enrollment process again on each and every gateway.

Luckily (or maybe not so luckily), the auto-enroll [percentage] [regenerate] command allows your gateways to re-enroll with the CA automatically when the original certificate expires, saving you a lot of time and trouble manually re-enrolling gateways with the CA.

If you specify the percentage parameter with the auto-enroll command, you can control the point at which the gateway re-enrolls with the CA. For example, if you specify 90 percent, the gateway will re-enroll with the CA when the current certificate reaches the point at which 90 percent of its validity has expired.

By specifying a re-enrollment percentage, you can help to ensure that certificate enrollment is seamless, and that the gateway is not left with an old and invalid certificate that would cause IKE authentication failure.

Furthermore, you can specify the regenerate keyword with the auto-enroll command if you want the gateway to generate a new RSA key pair when it re-enrolls with the CA. This can be useful because some CAs require a new key pair for re-enrollment.

Example 6-22 shows the configuration of the auto-enroll command with the percentage parameter and regenerate keyword.

Example 6-22. Specifying the percentage Parameter and regenerate Keyword with the auto-enroll Command

London#conf t
Enter configuration commands, one per line. End with CNTL/Z.
London(config)#crypto ca trustpoint mjlnetcertsrv
London(ca-trustpoint)#auto-enroll 90 regenerate
London(ca-trustpoint)#end
London#

In Example 6-22, the auto-enroll command specifies a re-enrollment percentage of 90 percent. When the existing certificate reaches 90 percent of its validity period, the gateway will attempt to re-enroll with the CA.

Because the regenerate keyword is also specified with the auto-enroll command in Example 6-22, the gateway will generate a new RSA key pair every time it re-enrolls with the CA.

Selecting Cryptographic Parameters for IKE Policies

After you have configured the IKE authentication method, the next step is to configure IKE policies.

IKE policies are made up of cryptographic parameters, and are configured using the crypto isakmp policy priority command. You can configure multiple IKE policies each with a different priority (from 1 to 10000). Somewhat confusingly, lower numbered policies have a higher priority, with IKE policy 1 having the highest priority of all.

A default IKE policy is automatically created with priority 65535. This policy includes all of the default IKE policy parameters discussed in this section.

During IKE phase 1, IPsec peers negotiate IKE policies, starting with the highest-priority (lowest-numbered) policy, until either the peers find a matching policy and IKE negotiation succeeds or they do not find a match and IKE negotiation fails.

An IKE policy (ISAKMP policy) is made up of the following elements:

Configuring an Encryption Algorithm for an IKE Policy

You can specify three encryption algorithms in an IKE policy:

  • DES 56-bit encryption (the default)

  • 3DES 168-bit encryption

  • AES 128-bit, 192-bit, or 256-bit encryption

Use the encryption {des | 3des | aes | aes 192 | aes 256} ISAKMP configuration mode command to configure an encryption algorithm, as demonstrated in Example 6-23.

The default encryption algorithm is DES.

Example 6-23. Configuration of an IKE Protection Suite

London#conf t
Enter configuration commands, one per line. End with CNTL/Z.
London(config)#crypto isakmp policy 10
London(config-isakmp)#encryption 3des
London(config-isakmp)#end
London#

Example 6-23 specifies 3DES as the encryption algorithm within IKE policy 10.

Table 6-1 shows the encryption command options.

Table 6-1. IKE Encryption Configuration

Keyword

Function

Notes

des

56-bit DES encryption[*]

Insecure; Default

3des

168-bit 3DES encryption[*]

Secure

aes

128-bit AES encryption[*]

Secure

aes 192

192-bit AES encryption[*]

Secure

aes 256

256-bit AES encryption[*]

Secure


[*] For more information on encryption algorithms, see the section titled "Encryption Algorithms" later in chapter

Configuring a Diffie-Hellman Group for an IKE Policy

The next step is to configure the Diffie-Hellman group.

You can configure one of three Diffie-Hellman groups within IKE policies:

  • Group 1 A 768-bit prime modulus group (the default)

  • Group 2 A 1024-bit prime modulus group

  • Group 5 A 1536-bit prime modulus group

Diffie-Hellman group 5 is the most secure of the three groups but causes the most processing overhead. Diffie-Hellman group 1, on the other hand, is the least secure but causes the least overhead.

Use the group {1 | 2 | 5} command to configure the Diffie-Hellman group within an IKE policy, as demonstrated in Example 6-24.

Example 6-24. Configuring the Diffie-Hellman Group

London#conf t
Enter configuration commands, one per line. End with CNTL/Z.
London(config)#crypto isakmp policy 10
London(config-isakmp)#group 2
London(config-isakmp)#end
London#

In Example 6-24, a 1024-bit Diffie-Hellman group is configured for IKE policy 10.

Table 6-2 summarizes group command options.

Table 6-2. IKE Diffie-Hellman Group Configuration

Keyword

Function

1

768-bit Diffie-Hellman group

(Default) Not recommended by NIST

2

1024-bit Diffie-Hellman group

5

1536 Diffie-Hellman group


Configuring a Hash Algorithm for an IKE Policy

Next is the hash algorithm. This is used to authenticate IKE messages sent between IPsec peers.

Again, there is a choice of algorithms:

  • MD5, HMAC variant

  • SHA-1, HMAC variant (the default)

For more information regarding hash algorithms, see the section "Configuring IPsec Transform Sets" later in this chapter.

Specify the hash algorithm to be used with an IKE policy using the hash {sha | md5} command, as demonstrated in Example 6-25.

The default hash algorithm is SHA-1.

Example 6-25. Configuring the Hash Algorithm Group

London#conf t
Enter configuration commands, one per line. End with CNTL/Z.
London(config)#crypto isakmp policy 10
London(config-isakmp)#hash md5
London(config-isakmp)#end
London#

The hash command is used in Example 6-25 to specify MD5 as the hash algorithm to be used within IKE policy 10.

Table 6-3 shows hash command options.

Table 6-3. IKE Policy Hash Algorithm Configuration

Keyword

Function

Notes

sha

SHA-1 (HMAC variant) authentication[*]

  1. Considered to be secure

  2. Slightly slower than MD5

  3. Default algorithm

md5

MD5 (HMAC variant) authentication[*]

Considered to be secure


[*] See the section "Hash Algorithms" later in this chapter for more information on hash algorithms

Configuring an Authentication Method for an IKE Policy

You must also specify the method of peer authentication within the IKE policy. The method of authentication can be, as previously described, the following:

  • Preshared keys

  • Encrypted nonces

  • Digital signatures (the default)

Use the authentication {rsa-sig | rsa-encr | pre-share} command to configure the method of authentication to be used by an IKE policy, as demonstrated in Example 6-26.

Example 6-26. Configuring the Method of Authentication

London#conf t
Enter configuration commands, one per line. End with CNTL/Z.
London(config)#crypto isakmp policy 10
London(config-isakmp)#authentication pre-share
London(config-isakmp)#end
London#

In Example 6-26, the authentication command specifies preshared key authentication.

Table 6-4 shows the authentication command options.

Table 6-4. IKE Authentication Configuration

Keyword

Function

Notes

rsa-sig

RSA digital signature authentication

  1. Secure

  2. Scalable

  3. Default method of authentication

rsa-encr

RSA encrypted nonce authentication

  1. Secure

  2. Not scalable

pre-share

Preshared key authentication

  1. Not secure with weak preshared keys

  2. Not scalable


Configuring an IKE SA Lifetime for an IKE Policy

The final parameter that you can configure with an IKE policy is the IKE SA lifetime. When this lifetime expires, the IPsec peers renegotiate IKE phase 1.

As shown in Example 6-27, use the lifetime seconds command to configure the IKE SA lifetime. The lifetime can range from 60 seconds to 86400 seconds, with the default lifetime being 86400 seconds (24 hours).

Example 6-27. Configuring the Method of Authentication

London#conf t
Enter configuration commands, one per line. End with CNTL/Z.
London(config)#crypto isakmp policy 10
London(config-isakmp)#lifetime 43200
London(config-isakmp)#end
London#

Many people choose to leave the IKE SA lifetime at the default value of 86400. It is worth noting, however, that the longer the lifetime, the less secure the SA is. The SA is less secure with a longer lifetime because with a longer lifetime an attacker has more time to collect encrypted traffic and subject it to cryptanalysis (attempt to recover the plaintext). However, a shorter IKE lifetime causes IPsec peers to have to renegotiate IKE more often.

So, in a particularly sensitive environment, you may choose to configure a shorter IKE SA lifetime.

Caution

Make sure that you configure IPsec peers with identical IKE SA lifetimes. If you do not, IKE negotiation may fail.


Table 6-5 shows the lifetime command options.

Table 6-5. IKE Lifetime Configuration

Keyword

Function

Notes

seconds

IKE SA Lifetime

Ranges from 60 to 86400 seconds (default is 86400)


Sample IKE Policy

Before finishing this section, it is worth taking a look at a complete sample IKE policy, as shown in Example 6-28.

Example 6-28. A Complete Sample IKE Policy

crypto isakmp policy 10
 encr 3des
 group 2
 lifetime 43200
!

The sample IKE policy in Example 6-28 specifies 3DES as the encryption algorithm, SHA-1 as the hash algorithm (the default), Diffie-Hellman group 2, digital signature authentication (the default), and an IKE SA lifetime of 43200 seconds (12 hours). Note that default parameters are not shown in Example 6-28.

It is generally a good idea to configure identical IKE policies for all peers in an IPsec VPN, but sometimes (particularly when configuring an extranet) it is possible that you might require one IKE policy for most peers and another policy for one or two other peers.

If you do require multiple IKE policies, you can simply configure these with different priority numbers, as shown in Example 6-29.

Example 6-29. Multiple IKE Policies

!
crypto isakmp policy 10
 encr 3des
 group 5
!
crypto isakmp policy 20
 hash md5
 authentication pre-share
!

In Example 6-29, IKE policy 10 specifies RSA digital signature authentication (the default), 3DES encryption, the SHA-1 hash algorithm (the default), and Diffie-Hellman group 5.

IKE policy 20 specifies preshared key authentication, DES encryption (the default), the MD5 hash algorithm, and Diffie-Hellman group 1 (the default). IKE policy 20 is relatively insecure because it utilizes DES.

Selecting and Configuring IPsec Transforms

After you have configured the IKE policy or policies, the next step is to specify cryptographic parameters for the IPsec transform set(s). The cryptographic parameters specified in an IPsec transform set are used as the parameters for the IPsec SAs negotiated with the remote IPsec peer during IKE phase 2. The parameters that you can specify in an IPsec transform set are as follows:

Some common considerations when selecting parameters for IPsec transform sets are as follows:

  • What kind of user traffic do you want to protect, and how do you want it to be protected?

  • How strong must encryption be? How long must the user traffic remain confidential?

  • What volume of traffic do you want to encrypt?

  • What kind of platform will you be using for your IPsec VPN gateways? Will you be using hardware crypto accelerators?

  • What version of Cisco IOS will your IPsec VPN gateways be running? What encryption algorithms can the version of Cisco IOS Software that your gateways will be running support?

Ideally, the final two considerations are informed by the first three considerations. However, your IPsec VPN might need to be constructed using existing hardware, and available versions of Cisco IOS Software might be limited by U.S. government export controls.

Selecting Security Protocols in an IPsec Transform Set

You can specify two security protocols in the IPsec transform set:

As previously described, AH provides message authentication, whereas ESP can provide message authentication and/or encryption.

Selecting Hash Algorithms in an IPsec Transform Set

As with IKE policies, there are two hash algorithms available with IPsec transform sets:

  • MD5, HMAC variant

  • SHA-1, HMAC variant

The MD5 algorithm generates a 128-bit hash, and the SHA-1 algorithm generates a 160-bit hash. As previously mentioned, regular MD5 and SHA-1 have been shown to be (theoretically) vulnerable to attack.

Note

For more information on possible attacks on regular MD5 and SHA-1, refer to the following links:

ftp://ftp.rsasecurity.com/pub/cryptobytes/crypto2n2.pdf

http://www.schneier.com/blog/archives/2005/02/cryptanalysis_o.html

http://www.rsasecurity.com/rsalabs/node.asp?id=2834


As previously discussed, HMAC variants of MD5 and SHA-1 differ from regular MD5 and SHA-1 in that a secret key is used as an additional input of the MD5 hash function. HMAC also adds cryptographic strength to the MD5 and SHA-1 hash function. HMAC-MD5 and HMAC-SHA-1 do not, however, significantly degrade the performance of the regular MD5 and SHA-1.

It is important to note that the HMAC variants of MD5 and SHA-1 (HMAC-MD5 and HMAC-SHA-1) have not to date been shown to be vulnerable to attack.

In IPsec, the 128-bit and 160-bit hashes produced by HMAC-MAC and HMAC-SHA-1 are truncated to a 96-bit length.

So, in summary

  • Regular MD5 and SHA-1 are vulnerable to attack.

  • To date, neither HMAC-MD5 nor HMAC-SHA-1 have been shown to be vulnerable to attack.

  • HMAC-SHA-1 is perceived to be more secure than HMAC-MD5 because of the longer key and hash produced by SHA-1 (160 bits, as opposed to 128 bits for MD5).

  • HMAC-SHA-1 is slower than HMAC-MD5.

Selecting Encryption Algorithms for Use with ESP

You can specify a number of encryption algorithms for use with ESP:

  • DES

  • 3DES

  • AES (128 bit, 192 bit, and 256 bit)

  • The Software Encryption Algorithm (SEAL)

DES (including 3DES) and AES are block ciphers, and SEAL is a stream cipher. Block ciphers operate on blocks of plaintext (original unencrypted data) bits at one time, and stream ciphers (usually) operate on plaintext a single bit at a time.

The DES, 3DES, AES, and SEAL algorithms have the following key sizes:

  • DES 56 bits

  • 3DES 168 bits

  • AES 128 bits, 192 bits, and 256 bits

  • SEAL 160 bits

The most important considerations when deciding which encryption algorithm to use is the security of the encryption algorithm.

The security of 56-bit DES has been questioned since its publication by the U.S. National Institute of Standards and Technology (NIST, formerly called the National Bureau of Standards [NBS]). In 1999, 56-bit DES was publicly cracked in 22 hours and 15 minutes during RSA Data Security's DES Challenge III. 56-bit DES is not considered secure.

Note

For more information on cracking DES, see the following URL:

http://www.eff.org/Privacy/Crypto/Crypto_misc/DESCracker/


With a 168-bit key length, 3DES is much more secure than 56-bit DES. Standard 3DES uses two keys and involves the encryption of the plaintext with the first key, the decryption with the second key, and then encryption once again with a third key. The main disadvantage of 3DES is that it is slow when run in software.

AES is the successor to DES (and 3DES), and is the result of an open competition run by NIST beginning in January 1997, and culminating in the selection of the Rijndael algorithm (one of the initial 15 candidate algorithms) as the AES.

NIST used a number of evaluation criteria for the selection of the AES algorithm:

  • Security (the most important criterion)

  • Costs, including computational efficiency and program size

  • Algorithm and implementation characteristics, including versatility (ability to be implemented on diverse platforms), key agility (key setup time), and simplicity

So, AES was designed from the ground up to be secure and computationally efficient (fast, with relatively low overhead). In addition, and with particular relevance for IPsec, AES offers fast key setup. Fast key setup is important to applications such as IPsec because keys can often change.

The final encryption algorithm that you can use with your IPsec transform sets on Cisco routers is SEAL. SEAL is used with Stream Cipher ESP (SC/ESP), a nonstandard extension to ESP that enables the use of stream ciphers with IPsec.

SEAL uses a 160-bit key, is optimized to run in software, but is not supported if a hardware encryption accelerator is present. SC/ESP (including when used with SEAL) mandates the use of authentication to prevent certain kinds of attacks that are specifically related to the use of stream ciphers with IPsec. If you attempt to configure SEAL without authentication, you will receive an error message.

Two advantages of using SEAL encryption are its speed (SEAL is fastmeasured as being 16.9 times faster than DES in certain sample tests) and the reduced size of SEAL encrypted packets when compared to those encrypted using DES and AES.

Selecting Compression in an IPsec Transform Set

Encryption of plaintext produces a seemingly random ciphertext. Unfortunately, compression algorithms look for common patterns in data, and because a ciphertext by definition contains no common patterns, ciphertext cannot be compressed. In fact, compression of ciphertext can result in an expansion of the original data!

The upshot of the fact that ciphertext cannot be compressed is that data link layer compression algorithms do not work with the network layer encryption provided by IPsec. So, is it possible to use compression with IPsec? Yes, compression is possible, but it must take place prior to encryption.

The IP Payload Compression Protocol (IPComp or PCP) was designed to address the problem of the ineffectiveness of data link layer compression protocols when applied to encrypted data. When using PCP, data is compressed before it is encrypted.

PCP, just like AH and ESP, is an IP protocol in its own right (IP protocol 108). Two compression algorithms are specified for use with PCP: Lempel-Ziv-Stac (LZS) and Deflate. On Cisco routers, you can configure LZS, which can give a maximum compression ratio of 2:1 depending on the data being compressed.

The compression algorithm used between IPsec peers is negotiated using IKE, and this information is stored as a PCP SA.

IPsec adds a large amount of overhead to a user packet (for more on this, see the section "Fragmentation Considerations in an IPsec VPN" in Chapter 7) and on low-speed lines this can cause a considerable impact on throughput. PCP may, therefore, be a solution for improving throughput on low-speed links.

Note that some hardware accelerators support LZS; if LZS runs in software, however, it can add considerable processor overhead to an IPsec VPN gateway.

Configuring IPsec Transform Sets

Use the crypto ipsec transform-set transform-set-name transform1 [transform2] [transform2] [transform3] [tranform4] to configure transforms (IPsec cryptographic algorithms and parameters) for IPsec tunnels.

It is possible to configure a total of four transforms (algorithms) within an IPsec transform set:

  • One AH

  • Two ESP (one authentication, plus one encryption)

  • One compression

However, four transforms would necessarily include an AH (authentication) transform and an ESP authentication transform. Configuration of two authentication transforms within one transform set is nonsensical, and so the practical limit for the number of transforms within a transform set is three:

  • One authentication (whether AH or ESP)

  • One encryption

  • One compression

Cryptographic algorithms and parameters configured using the crypto ipsec transform-set command are used by the IPsec (and PCP) SAs negotiated during IKE phase 2.

Table 6-6 summarizes IPsec transforms that you can configure using the crypto ipsec transform-set command.

Table 6-6. IPsec Transforms

Security/Compression Protocol

Hash Algorithm

Encryption Algorithm

Compression Algorithm

Function

Notes

AH

ah-md5-hmac

  

AH MD5 (HMAC variant) authentication

Authenticates whole packet, including outer IP header[1]

 

ah-sha-hmac

  

AH SHA-1 (HMAC variant) authentication

  1. Authenticates whole packet, including outer IP header[1]

  2. More secure/processor intensive than MD5-HMAC

ESP

esp-md5-hmac

  

ESP MD5 (HMAC variant) authentication

Authenticates whole packet, excluding the outer IP header

 

esp-sha-hmac

  

ESP SHA-1 (HMAC variant) authentication

  1. Authenticates whole packet, excluding outer IP header

  2. More secure/processor intensive than MD5-HMAC

  

esp-null

 

ESP null encryption. Authentication, but no encryption

N/A

  

esp-des

 

ESP 56-bit DES encryption

  1. Not secure

  2. Slow (especially in software)

  

esp-3des

 

ESP 168-bit 3DES encryption

  1. Secure

  2. Slow (especially in software)

  3. Subject to U.S. export controls

  

esp-aes

 

ESP 128-bit AES encryption

  1. Secure

  2. Successor to DES as NIST standard

  3. Available in Cisco IOS Release 12.2(13)T

  4. Subject to U.S. export controls

  

esp-aes 192

 

ESP 192-bit AES encryption

Same as for ESP 128-bit AES encryption

  

esp-aes 256

 

ESP 256-bit AES encryption

Same as for ESP 128-bit AES encryption

  

esp-seal

 

ESP 160-bit SEAL encryption

  1. Secure[2]

  2. Fast

  3. Available in Cisco IOS Release 12.3(7)T

  4. Not supported with hardware accelerators

  5. Smaller packet sizes than DES/AES

  6. Implemented with nonstandard SC/ESP

  7. SC/ESP mandates the use of authentication

  8. Subject to U.S export controls

IPComp / PCP

  

comp-lzs

LZS compression

  1. Option on low-speed links

  2. Processor intensive in software


[1] The value of authenticating the outer IP header is often questioned

[2] Has not been subject to the same level of cryptanalysis as DES and AES, but is generally regarded as being secure

Example 6-30 shows the configuration of a sample IPsec transform set with ESP SHA-1 authentication and ESP 128-bit AES encryption.

Example 6-30. Sample IPsec Transform Set

London#conf t
Enter configuration commands, one per line. End with CNTL/Z.
London(config)#crypto ipsec transform-set mjlnettransform esp-aes esp-sha-hmac
London(cfg-crypto-trans)#end
London#

It is worth noting the possible single transforms or combinations of transforms that you can use in a single transform set:

  • AH authentication alone

  • ESP, DES, or AES encryption alone

  • AH authentication together with ESP encryption

  • ESP authentication together with ESP encryption (most common)

LZS compression can be used with all of these transforms.

As you can see, it is possible to configure ESP, DES, or AES encryption without authentication in an IPsec transform set. Although this might be possible, it is not generally a good ideain certain circumstances ESP encryption SAs (without ESP or AH authentication) are vulnerable to cut-and-paste attacks. Cut-and-paste attacks involve the substitution of certain parts of IPsec packets and can result in an attacker being able to recover unencrypted messages (plaintext). So, use either ESP or AH authentication with ESP, DES, or AES encryption.

There are also one or two transforms that you cannot use:

  • ESP authentication alone

  • SEAL encryption alone

When configuring your IPsec transform sets, it is possible to configure the IPsec security protocol mode using the mode {tunnel | transport} command, as demonstrated in Example 6-31.

Example 6-31. Configuring Security Protocol Modes

London#conf t
Enter configuration commands, one per line. End with CNTL/Z.
London(config)#crypto ipsec transform-set mjlnettransform esp-aes esp-sha-hmac
London(cfg-crypto-trans)#mode transport
London(cfg-crypto-trans)#end
London#

The highlighted line shows the specification of transport mode for use with IPsec transform set mjlnettransform.

If you do not specify an IPsec security protocol mode, the default is tunnel mode. In tunnel mode, user packets are entirely encapsulated and protected by IPsec and a new IP header is added, whereas in transport mode the payload is encapsulated and protected by IPsec, but a new IP packet header is not added.

Typically, tunnel mode is the mode used for IPsec VPNs, although transport mode may be used if a GRE tunnel is being used to carry multiprotocol and multicast traffic. See the section "Using GRE Tunnels to Carry Multiprotocol and Multicast Traffic Across the IPsec VPN" later in this chapter for more information on GRE tunnels.

Designing and Configuring Crypto Access Lists

In IPsec, traffic selectors define the traffic that is to be protected by an SA. Traffic selectors consist of a number of items, including the following:

  • Source and destination IP addresses

  • Next layer protocol (for example, ICMP, GRE, TCP, UDP)

  • Source and destination ports, if applicable

On Cisco routers, traffic selectors are configured using crypto access lists. Crypto access lists are extended access lists that are then specified in a crypto map.

Example 6-32 shows a sample crypto access list.

Example 6-32. Sample Crypto Access List

London#conf t
Enter configuration commands, one per line. End with CNTL/Z.
London(config)#access-list 101 permit ip 10.1.1.0 0.0.0.255 10.2.2.0 0.0.0.255
London(config)#exit
London#

In Example 6-32, access list 101 specifies all IP traffic from source network 10.1.1.0/24 to destination network 10.2.2.0/24.

In this case, all IP traffic from network 10.1.1.0/24 to network 10.2.2.0/24 will be protected using the algorithms specified in the IPsec transform set. Also, all IP traffic received from network 10.2.2.0/24 destined for 10.1.1.0/24 must be protected using the algorithms specified in the IPsec transform setif it is not, it will be dropped.

The output of the show crypto ipsec sa command in Example 6-33 shows the IPsec SAs corresponding to the crypto access list configured in Example 6-32.

Example 6-33. IPsec SAs with One Line in the Crypto Access List

London#show crypto ipsec sa
interface: Serial1/0
  Crypto map tag: mjlnetmap, local addr. 192.168.1.1
  protected vrf:
  local ident (addr/mask/prot/port): (10.1.1.0/255.255.255.0/0/0) (line 1)
  remote ident (addr/mask/prot/port): (10.2.2.0/255.255.255.0/0/0) (line 2)
  current_peer: 192.168.2.2:500
   PERMIT, flags={origin_is_acl,}
  #pkts encaps: 4, #pkts encrypt: 4, #pkts digest: 4
  #pkts decaps: 4, #pkts decrypt: 4, #pkts verify: 4
  #pkts compressed: 0, #pkts decompressed: 0
  #pkts not compressed: 0, #pkts compr. failed: 0
  #pkts not decompressed: 0, #pkts decompress failed: 0
  #send errors 1, #recv errors 0
   local crypto endpt.: 192.168.1.1, remote crypto endpt.: 192.168.2.2
   path mtu 1500, media mtu 1500
  current outbound spi: 64095EF9
  inbound esp sas: (line 3)
  spi: 0xCA9C1822(3399227426)
   transform: esp-aes esp-sha-hmac, (line 4)
    in use settings ={Tunnel, }
    slot: 0, conn id: 2000, flow_id: 7, crypto map: mjlnetmap
    crypto engine type: Software, engine_id: 1
    sa timing: remaining key lifetime (k/sec): (4542627/3575)
    ike_cookies: 966D547F ADD7F649 1E32E5D2 E3AA6BD7
    IV size: 16 bytes
    replay detection support: Y
   inbound ah sas:
   inbound pcp sas:
   outbound esp sas: (line 5)
   spi: 0x64095EF9(1678335737)
    transform: esp-aes esp-sha-hmac, (line 6)
    in use settings ={Tunnel, }
    slot: 0, conn id: 2001, flow_id: 8, crypto map: mjlnetmap
    crypto engine type: Software, engine_id: 1
    sa timing: remaining key lifetime (k/sec): (4542627/3573)
    ike_cookies: 966D547F ADD7F649 1E32E5D2 E3AA6BD7
    IV size: 16 bytes
    replay detection support: Y
   outbound ah sas:
   outbound pcp sas:
London#

Highlighted lines 1 and 2 show the traffic selectors configured in the crypto access list in Example 6-32.

Highlighted lines 3 and 4 show the inbound ESP SA (with ESP AES encryption and SHA-1 authentication). Then, in highlighted lines 5 and 6, you can see the outbound ESP SA (again with AES encryption and SHA-1 authentication).

It is a good idea to specify the traffic that you want to protect in as few lines as possible (often just one line). Each permit statement in a crypto access list causes separate SAs to be negotiated between IPsec peers. For example, the crypto access list shown in Example 6-34 results in the negotiation of the IPsec SAs shown in the output of the show crypto ipsec sa command in Example 6-35.

Example 6-34. Crypto Access List with Two Lines

access-list 101 permit icmp 10.1.1.0 0.0.0.255 10.2.2.0 0.0.0.255
access-list 101 permit ip 10.1.1.0 0.0.0.255 10.2.2.0 0.0.0.255

Example 6-35. IPsec SAs Corresponding to the Access List Shown in Example 6-34

London#show crypto ipsec sa
interface: Serial1/0
  Crypto map tag: mjlnetmap, local addr. 192.168.1.1
  protected vrf:
  local ident (addr/mask/prot/port): (10.1.1.0/255.255.255.0/0/0) (line 1)
  remote ident (addr/mask/prot/port): (10.2.2.0/255.255.255.0/0/0) (line 2)
  current_peer: 192.168.2.2:500
   PERMIT, flags={origin_is_acl,}
  #pkts encaps: 6, #pkts encrypt: 6, #pkts digest: 6
  #pkts decaps: 0, #pkts decrypt: 0, #pkts verify: 0
  #pkts compressed: 0, #pkts decompressed: 0
  #pkts not compressed: 0, #pkts compr. failed: 0
  #pkts not decompressed: 0, #pkts decompress failed: 0
  #send errors 1, #recv errors 0
   local crypto endpt.: 192.168.1.1, remote crypto endpt.: 192.168.2.2
   path mtu 1500, media mtu 1500
   current outbound spi: B6CC7F94
   inbound esp sas: (line 3)
   spi: 0x674B911B(1733005595)
    transform: esp-aes esp-sha-hmac ,
    in use settings ={Tunnel, }
    slot: 0, conn id: 2002, flow_id: 15, crypto map: mjlnetmap
    crypto engine type: Software, engine_id: 1
    sa timing: remaining key lifetime (k/sec): (4416744/3476)
    ike_cookies: 966D547F 66B1A334 1E32E5D2 12CD70EC
    IV size: 16 bytes
    replay detection support: Y
   inbound ah sas:
   inbound pcp sas:
   outbound esp sas: (line 4)
   spi: 0xB6CC7F94(3066855316)
    transform: esp-aes esp-sha-hmac ,
    in use settings ={Tunnel, }
    slot: 0, conn id: 2003, flow_id: 16, crypto map: mjlnetmap
    crypto engine type: Software, engine_id: 1
    sa timing: remaining key lifetime (k/sec): (4416742/3474)
    ike_cookies: 966D547F 66B1A334 1E32E5D2 12CD70EC
    IV size: 16 bytes
    replay detection support: Y
   outbound ah sas:
   outbound pcp sas:
  protected vrf:
  local ident (addr/mask/prot/port): (10.1.1.0/255.255.255.0/1/0) (line 5)
  remote ident (addr/mask/prot/port): (10.2.2.0/255.255.255.0/1/0) (line 6)
  current_peer: 192.168.2.2:500
   PERMIT, flags={origin_is_acl,}
  #pkts encaps: 4, #pkts encrypt: 4, #pkts digest: 4
  #pkts decaps: 4, #pkts decrypt: 4, #pkts verify: 4
  #pkts compressed: 0, #pkts decompressed: 0
  #pkts not compressed: 0, #pkts compr. failed: 0
  #pkts not decompressed: 0, #pkts decompress failed: 0
  #send errors 1, #recv errors 0
   local crypto endpt.: 192.168.1.1, remote crypto endpt.: 192.168.2.2
   path mtu 1500, media mtu 1500
   current outbound spi: 66B63AD9
   inbound esp sas: (line 7)
   spi: 0xC783E6A2(3347310242)
    transform: esp-aes esp-sha-hmac ,
    in use settings ={Tunnel, }
    slot: 0, conn id: 2000, flow_id: 13, crypto map: mjlnetmap
    crypto engine type: Software, engine_id: 1
    sa timing: remaining key lifetime (k/sec): (4414367/3468)
    ike_cookies: 966D547F 66B1A334 1E32E5D2 12CD70EC
    IV size: 16 bytes
    replay detection support: Y
   inbound ah sas:
   inbound pcp sas:
   outbound esp sas: (line 8)
   spi: 0x66B63AD9(1723218649)
    transform: esp-aes esp-sha-hmac ,
    in use settings ={Tunnel, }
    slot: 0, conn id: 2001, flow_id: 14, crypto map: mjlnetmap
    crypto engine type: Software, engine_id: 1
    sa timing: remaining key lifetime (k/sec): (4414367/3467)
    ike_cookies: 966D547F 66B1A334 1E32E5D2 12CD70EC
    IV size: 16 bytes
    replay detection support: Y
   outbound ah sas:
   outbound pcp sas:
London#

Highlighted lines 1 and 2 in Example 6-35 show traffic selectors corresponding to the second line of the crypto access list in Example 6-34.

Note the protocol (prot) and port numbers shown at the end of highlighted lines 1 and 2(/0/0). The 0s indicate that the traffic selectors specify IP but no specific IP protocol or port.

Highlighted lines 3 and 4 show the ESP SAs associated with the traffic selectors specified in the second line of the crypto access list in Example 6-34.

Then, in highlighted lines 5 and 6, you can see traffic selectors corresponding to the first line in the crypto access list. Notice the protocol and port (/1/0) at the end of highlighted lines 5 and 6. The 1 indicates the IP protocol number (ICMP).

Finally, in highlighted lines 7 and 8, you can see the ESP SAs corresponding to the traffic selectors specified in the first line of the crypto access in Example 6-34.

So, keep the number of crypto access list lines (permit statements) to a minimum or you will end up with unnecessary IPsec SAs between IPsec peers.

It is worth saying that there are one or two reasons that might justify configuration of multiple permit statements in a crypto access listsee the section "Designing QoS for IPsec VPNs" in Chapter 7 on page 656 for more information.

If you want to explicitly exclude some traffic from being protected by IPsec, just specify this traffic using a deny statement or statements at the beginning of your crypto access lists.

Note that crypto access lists should be mirrored between peer IPsec VPN gateways. Example 6-36 shows the crypto access lists that would be configured on the London and Berlin gateways (refer back to Figure 6-31).

Example 6-36. Crypto Access Lists Should Be Mirrored Between Peer IPsec VPN Gateways

!
! Crypto access list on London
!
access-list 101 permit ip 10.1.1.0 0.0.0.255 10.2.2.0 0.0.0.255
!

!
! Crypto access list on Berlin
!
access-list 101 permit ip 10.2.2.0 0.0.0.255 10.1.1.0 0.0.0.255
!

It is actually possible to configure crypto access lists that are not mirrored between IPsec VPN gateways, but this results in just one IPsec VPN gateway being able to initiate an IPsec VPN tunnel, as well as IPsec traffic drops.

Note

For more information on crypto access lists that are not mirrored between peer IPsec VPN gateways (and the problems they can cause), refer to Chapter 8 of Troubleshooting Virtual Private Networks (Cisco Press). Troubleshooting Virtual Private Networks includes in-depth information on troubleshooting all typical and not-so-typical issues with IPsec VPNs.


Pulling Everything Together with a Crypto Map

Now that you have designed your IKE policies, IPsec transform sets, and crypto access lists, it is time to configure your crypto map. The function of the crypto map is to pull together the IKE policies, IPsec transform sets, and crypto access lists into a form that can then be applied to an interface.

Example 6-37 illustrates the configuration of a crypto map using the crypto map map-name seq-num ipsec-isakmp [dynamic dynamic-map-name] [discover] command.

Example 6-37. Configuration of a Crypto Map

London#conf t
Enter configuration commands, one per line. End with CNTL/Z.
London(config)#crypto map mjlnetcmap 10 ipsec-isakmp
London(config-crypto-map)#set peer 192.168.2.2
London(config-crypto-map)#set transform-set mjlnettransform
London(config-crypto-map)#match address 101
London(config-crypto-map)#end
London#

In Example 6-37, a crypto map called mjlnetcmap is configured on IPsec VPN gateway London. Within the crypto map, the set peer [hostname | ip-address] command specifies the host name or IP address of the IPsec peer (in this case, IP address 192.168.2.2).

The set transform-set transform-set-name [transform-set-name2.....transform-set-name6] then specifies that the IPsec transform set named mjlnettransform will be used to protect user traffic with peer 192.168.2.2. It is possible to specify up to six possible transform sets. If multiple transform sets are specified, a common transform set will be negotiated with the peer during IPsec tunnel setup (in IKE phase 2).

Finally, the crypto access list is specified using the match address [access-list-number | name] command. In this example, access-list number 101 is specified.

One other option that you can configure within a crypto map is PFS. Normally, keys used to encrypt and authenticate IPsec packets are derived from the IKE phase 1 Diffie-Hellman shared secret key. If the IKE phase 1 Diffie-Hellman shared secret key is discovered, this can lead to the compromise of all IPsec packets. If you specify PFS, however, a new Diffie-Hellman exchange takes place during IKE phase 2 (quick mode), and this exchange is used to derive the keys used to encrypt and authenticate IPsec packets. The result of using PFS is that the compromise of the IKE phase 1 Diffie-Hellman shared secret key cannot lead directly to the compromise of keys used to encrypt and authenticate IPsec packets.

So, the advantage of PFS is increased security, but the disadvantage is some additional processing overhead whenever a new IPsec SA is negotiated during IKE phase 2.

You can configure PFS using the set pfs [group1 | group2 | group5] under the crypto map, as shown in Example 6-38.

Example 6-38. Configuring PFS Within the Crypto Map

London#conf t
Enter configuration commands, one per line. End with CNTL/Z.
London(config)#crypto map mjlnetcmap 10 ipsec-isakmp
London(config-crypto-map)#set pfs group2
London(config-crypto-map)#end
London#

Example 6-38 shows the configuration of PFS using Diffie-Hellman group 2 (1024 bit).

If multiple IPsec peers connect over the same outside interface, you can specify multiple entries in a particular crypto map using different crypto map sequence numbers, as demonstrated in Example 6-39.

Example 6-39. Configuration of Multiple Entries in a Crypto Map

!
crypto map mjlnetcmap 10 ipsec-isakmp
 set peer 192.168.2.2
 set transform-set mjlnettransform
 match address 101
crypto map mjlnetcmap 20 ipsec-isakmp
 set peer 192.168.3.3
 set transform-set mjlnettransform
 match address 102
!

After you have configured a crypto map, you can apply it to the (outside) interface to which IPsec peers will connect. Example 6-40 demonstrates application of a crypto map to an interface.

Example 6-40. Application of a Crypto Map to an Interface

!
interface Serial1/0
 ip address 192.168.1.1 255.255.255.0
 crypto map mjlnetcmap
!

In Example 6-40, the crypto map is applied to the outside interface serial 1/0.

Complete IPsec VPN Gateway Configurations

Now that you understand the main elements of the configuration of an IPsec VPN gateway, it is useful to take a look at the complete configurations of peer IPsec VPN gateways London and Berlin (see Example 6-41 and refer back to Figure 6-31).

Example 6-41. Complete Configurations for IPsec VPN Gateways London and Berlin

London#show running-config
Building configuration...
Current configuration : 7701 bytes
!
version 12.3
!
!
! IPsec gateway's host name and IP domain name
!
hostname London
!
ip domain name mjlnet.com
!
!
! Crypto pki trustpoint  enrollment parameters, certificate fields, and auto
! (re-)enrollment
!
crypto pki trustpoint mjlnetcertsrv
 enrollment mode ra
 enrollment url http://mjlnetcertsrv:80/certsrv/mscep/mscep.dll
 usage ike
 serial-number none
 ip-address 192.168.1.1
 password 7 1104130919171F
 subject-name C=GB, O=mjlnet, OU=engineering
 revocation-check crl none
 rsakeypair London.mjlnet.com
 auto-enroll 90 regenerate
!
!
! Gateway's and CA's Certificates
!
crypto pki certificate chain mjlnetcertsrv
 certificate 613240F1000000000018
 308204A9 30820453 A0030201 02020A61 3240F100 00000000 18300D06 092A8648
 86F70D01 01050500 30819931 1F301D06 092A8648 86F70D01 09011610 61646D69
! <text omitted>
 quit
 certificate ca 48B8A34E0C6A09A7447B8CBDD77C3A81
 30820304 308202AE A0030201 02021048 B8A34E0C 6A09A744 7B8CBDD7 7C3A8130
 0D06092A 864886F7 0D010105 05003081 99311F30 1D06092A 864886F7 0D010901
! <text omitted>
 quit
!
!
! IKE policy
!
crypto isakmp policy 10
 encr 3des
 group 2
!
!
! IPsec transform set
!
crypto ipsec transform-set mjlnettransform esp-3des esp-sha-hmac
!
!
! Crypto map
!
crypto map mjlnetmap 10 ipsec-isakmp
 set peer 192.168.2.2
 set transform-set mjlnettransform
 match address 101
!
!
! Outside interface
!
interface Serial1/0
 ip address 192.168.1.1 255.255.255.0
 crypto map mjlnetmap
!
!
! Inside interface
!
interface FastEthernet3/0
 ip address 10.1.1.1 255.255.255.0
!
!
! Route to the Berlin gateway
!
ip route 0.0.0.0 0.0.0.0 192.168.1.2
!
!
! Crypto access list
!
access-list 101 permit ip 10.1.1.0 0.0.0.255 10.2.2.0 0.0.0.255
!
!
! NTP with authentication
!
ntp authentication-key 1 md5 09414405170003 7
ntp authenticate
ntp trusted-key 1
ntp server 10.10.10.99 key 1
!
end

Berlin#show running-config
Building configuration...
Current configuration : 7109 bytes
!
version 12.3
!
!
! IPsec gateway's host name and IP domain name
!
hostname Berlin
!
ip domain name mjlnet.com
!
!
! Crypto pki trustpoint  enrollment parameters, certificate fields, and auto
! (re-)enrollment
!
crypto pki trustpoint mjlnetcertsrv
 enrollment mode ra
 enrollment url http://mjlnetcertsrv:80/certsrv/mscep/mscep.dll
 usage ike
 serial-number none
 ip-address 192.168.2.2
 password 7 0009190A0A5E1F
 subject-name C=GB, O=mjlnet, OU=engineering
 revocation-check crl none
 rsakeypair Berlin.mjlnet.com
 auto-enroll 90 regenerate
!
!
! Gateway's and CA's certificates
!
crypto pki certificate chain mjlnetcertsrv
 certificate 612A9069000000000019
 308204A9 30820453 A0030201 02020A61 2A906900 00000000 19300D06 092A8648
 86F70D01 01050500 30819931 1F301D06 092A8648 86F70D01 09011610 61646D69
! <text omitted>
 quit
 certificate ca 48B8A34E0C6A09A7447B8CBDD77C3A81
 30820304 308202AE A0030201 02021048 B8A34E0C 6A09A744 7B8CBDD7 7C3A8130
 0D06092A 864886F7 0D010105 05003081 99311F30 1D06092A 864886F7 0D010901
! <text omitted>
 quit
!
!
! IKE policy
!
crypto isakmp policy 10
 encr 3des
 authentication pre-share
 group 2
!
!
! IPsec transform set
!
crypto ipsec transform-set mjlnettransform esp-3des esp-sha-hmac
!
!
! Crypto map
!
crypto map mjlnetmap 10 ipsec-isakmp
 set peer 192.168.1.1
 set transform-set mjlnettransform
 match address 101
!
!
! Inside interface
!
interface FastEthernet1/0
 ip address 10.2.2.1 255.255.255.0
!
!
! Outside interface
!
interface Serial4/0
 ip address 192.168.2.2 255.255.255.0
 crypto map mjlnetmap
!
!
! Route to the London gateway
!
ip route 0.0.0.0 0.0.0.0 192.168.2.1
!
!
! Crypto access list
!
access-list 101 permit ip 10.2.2.0 0.0.0.255 10.1.1.0 0.0.0.255
!
!
! NTP with authentication
!
ntp authentication-key 1 md5 1104130919171F 7
ntp authenticate
ntp trusted-key 1
ntp server 10.10.10.99 key 1
!
end

Transporting Multiprotocol and Multicast Traffic over an IPsec VPN

Standard IPsec can transport and protect unicast IP traffic, but it cannot at present natively transport and protect multiprotocol or multicast traffic. One workaround for this problem is to configure a GRE tunnel between peer IPsec VPN gateways. Multiprotocol and multicast traffic is transported over the GRE tunnel, and the GRE tunnel is in turn protected by IPsec.

If you want to transport IP unicast and multicast traffic (but not multiprotocol traffic), another option is to configure virtual tunnel interfaces (VTI). VTIs were introduced in Cisco IOS Software Release 12.3(14)T.

Configuring GRE/IPsec Tunnels

Figure 6-37 illustrates an IPsec-protected GRE tunnel between IPsec VPN gateways.

Figure 6-37. IPsec-Protected GRE Tunnel Between IPsec VPN Gateways


Configuration of IPsec-protected GRE tunnels involves the following steps:

Step 1.
Step 2.
Step 3.
Step 4.
Step 5.
Step 6.

These steps are discussed in detail in the following sections.

Step 1: Configure the GRE Tunnel Interfaces

The first step is to configure the GRE tunnel interfaces on the IPsec VPN gateways.

Example 6-42 shows the configuration of GRE tunnel interfaces on two IPsec VPN gateways depicted in Figure 6-37, London and Berlin.

Example 6-42. Configuring GRE Tunnel Interfaces for Multiprotocol and Multicast Traffic Transport

!
! On London
!
interface Tunnel0
 ip address 10.3.3.1 255.255.255.0
 ipx network 3000
 ip pim sparse-dense-mode
  tunnel source 192.168.1.1
  tunnel destination 192.168.2.2
!
!

! On Berlin
!
interface Tunnel0
 ip address 10.3.3.2 255.255.255.0
 ipx network 3000
 ip pim sparse-dense-mode
 tunnel source 192.168.2.2
 tunnel destination 192.168.1.1
!

The GRE tunnel interface is configured on the London gateway with a tunnel source IP address of 192.168.1.1 (its outside physical interface) and a destination IP address of 192.168.2.2 (the outside physical interface [tunnel source] on the Berlin gateway).

The GRE tunnel interface on Berlin is configured in a similar manner. The tunnel source IP address is configured as 192.168.2.2 (its outside interface), and the tunnel destination IP address is 192.168.1.1 (the outside interface [tunnel source] on London).

If you have multiple outside physical interfaces, you might want to configure a loopback interface (interface loopback interface-number) on each IPsec VPN gateway to act as the source address for the GRE tunnel.

If you do use loopback interfaces as the source IP address of GRE tunnels, make sure that you specify the loopback interface on the IPsec VPN gateways using the crypto map crypto-map-name local-address interface (for example, crypto map mjlnetcmap local-address Loopback0) command to ensure that IKE negotiation succeeds between the IPsec VPN gateways. Also, if you are using preshared keys, make sure you specify the peer's loopback interface address using the crypto isakmp key key-string address peer-ip-address and crypto map set peer ip-address commands.

Step 2: Configure the Routing Protocol or Static Routes

After you have configured the GRE tunnel interfaces, you can configure a routing protocol for IP reachability over the GRE tunnels between sites, as shown in Example 6-43.

Example 6-43. Configuring EIGRP for IP Reachability Between IPsec VPN Sites

!
! On London
!
router eigrp 100 (line 1)
 network 10.1.1.0 0.0.0.255 (line 2)
 network 10.3.3.0 0.0.0.255 (line 3)
 no auto-summary
!
!

! On Berlin
!
router eigrp 100 (line 4)
 network 10.2.2.0 0.0.0.255 (line 5)
 network 10.3.3.0 0.0.0.255 (line 6)
 no auto-summary
!

In Example 6-43, EIGRP is configured for IP reachability between the London and Berlin sites.

In highlighted lines 1 to 3, EIGRP autonomous system 100 is configured on the London gateway, and EIGRP is enabled on the inside network (10.1.1.0/24) as well as on the GRE tunnel interface (10.3.3.0/24).

Then, in highlighted lines 4 to 6, EIGRP autonomous system 100 is configured on Berlin, and EIGRP is enabled on the inside network (10.2.2.0/24) as well as on the GRE tunnel interface (10.3.3.0/24).

The routing protocol should be enabled on the GRE tunnel interfaces and on inside interfaces (where appropriate), but it should not be enabled on the outside physical interface for reachability between tunnel endpoints.

Note

If the same routing protocol (instance) is configured on the GRE tunnel interface and on the outside physical interface (for reachability between the GRE tunnel endpoints), the GRE tunnel will be disabled.

The GRE tunnel interface is disabled because the best route to the GRE tunnel destination is via the GRE tunnel itself, and the gateway attempts to send GRE tunnel packets over the GRE tunnel itself. That is not going to work!


You could also choose to configure static IP routes for IP reachability between sites. In this case, you can configure the outbound interface of the static routes as the GRE tunnel interface, as shown in Example 6-44.

Example 6-44. Configuring Static Routes for IP Reachability Between IPsec VPN Sites

!
! On London
!
ip route 10.2.2.0 255.255.255.0 Tunnel0 (line 1)
!
!

! On NewYork
!
ip route 10.1.1.0 255.255.255.0 Tunnel0 (line 2)
!

In Example 6-44, highlighted line 1, a static route to the Berlin site network (10.2.2.0/24) via the GRE tunnel interface is configured on the London gateway.

Then, in highlighted line 2, a static route to the London site network (10.1.1.0/24) via the GRE tunnel interface is configured on the Berlin site network.

When you are choosing whether to use a dynamic routing protocol or static routes for IP reachability, remember that static routes are inherently unscalable. The administrative and management overhead of maintaining and troubleshooting a large number of static routes is often considered prohibitive.

Step 3: Configure the IKE Policies

After you have configured either a dynamic routing protocol or static routes, the next step is to configure the IKE (ISAKMP) policies on the gateways. There are no special considerations for GRE tunnels, and so the IKE policies should be configured as discussed in the section "Selecting and Configuring IKE Policies" earlier in this chapter.

Step 4: Configure the IPsec Transform Sets

Next are IPsec transform sets. You should configure these as described in the section "Selecting and Configuring IPsec Transform Sets" earlier in this chapter.

It is worth noting that you can choose to configure IPsec transport mode when configuring IPsec protection for GRE tunnels. One advantage of using transport mode is that you save 20 bytes of overhead when compared to using tunnel mode because a new outer IP header is not required (compare Figures 6-14, 6-15, 6-19, and 6-20).

Step 5: Configure the Crypto Access Lists

Following the configuration of the IPsec transform sets, you can configure the crypto access list (see Example 6-45).

Example 6-45. Configuring a Crypto Access List for a GRE Tunnel

!
! On London
!
access-list 101 permit gre host 192.168.1.1 host 192.168.2.2 (line 1)
!
!

! On Berlin
!
access-list 101 permit gre host 192.168.2.2 host 192.168.1.1 (line 2)
!

Highlighted line 1 shows the crypto access list configured on London. Notice that the source and destination addresses (192.168.1.1 and 192.168.2.2, respectively) are the GRE tunnel endpoints (GRE tunnel interface source addresses). Also, notice that GRE is specified as the protocol within the crypto access list.

In highlighted line 2, you can see the crypto access list on Berlin. The idea is the samesource and destination addresses correspond to the GRE tunnel endpoints. Again, GRE is specified as the protocol within the crypto access list.

Step 6: Configure and Apply Crypto Maps

To a great extent, configuring and applying crypto maps is as described in the section "Pulling Everything Together with a Crypto Map."

There is one important consideration, howeverif your gateways are running Cisco IOS Software prior to Release 12.2(13)T, you must apply the crypto map to the outside interfaces and the GRE tunnel interfaces. If your gateways are running Cisco IOS Software Release 12.2(13)T or higher, you need to apply the crypto map only to the outside physical interfaces.

Note

It is also possible to use the tunnel protection command to apply IPsec protection to a GRE tunnel. This command is discussed further in Chapter 7.


Complete IPsec VPN Gateway Configurations with GRE Tunnel for Multiprotocol and Multicast Traffic Transport

Again, it is useful to examine the complete configurations of peer IPsec VPN gateways London and Berlin with GRE tunnel for multiprotocol and multicast traffic transport. Example 6-46 shows these configuration (see Figure 6-37 for the physical topology).

Example 6-46. Complete Configurations for IPsec VPN Gateways London and Berlin with GRE Tunnels for Multiprotocol and Multicast Traffic Transport

London#show running-config
Building configuration...
Current configuration : 7757 bytes
!
version 12.3
!
!
! IPsec gateway's host name and IP domain name
!
hostname London
!
ip domain name mjlnet.com
!
!
! IP multicast and IPX configuration (example only)
!
ip multicast-routing
ipx routing 0050.2afe.0800
ipx internal-network 1000
!
!
! Crypto pki trustpoint  enrollment parameters, certificate fields, and auto
! (re-)enrollment
!
crypto pki trustpoint mjlnetcertsrv
 enrollment mode ra
 enrollment url http://mjlnetcertsrv:80/certsrv/mscep/mscep.dll
 usage ike
 serial-number none
 ip-address 192.168.1.1
 password 7 1104130919171F
 subject-name C=GB, O=mjlnet, OU=engineering
 revocation-check crl none
 rsakeypair London.mjlnet.com
 auto-enroll 90 regenerate
!
!
! Gateway's and CA's certificates
!
crypto pki certificate chain mjlnetcertsrv
 certificate 613240F1000000000018
 308204A9 30820453 A0030201 02020A61 3240F100 00000000 18300D06 092A8648
 86F70D01 01050500 30819931 1F301D06 092A8648 86F70D01 09011610 61646D69
! <text omitted>
 quit
 certificate ca 48B8A34E0C6A09A7447B8CBDD77C3A81
 30820304 308202AE A0030201 02021048 B8A34E0C 6A09A744 7B8CBDD7 7C3A8130
 0D06092A 864886F7 0D010105 05003081 99311F30 1D06092A 864886F7 0D010901
! <text omitted>
 quit
!
!
! IKE policy
!
crypto isakmp policy 10
 encr 3des
 group 2
!
!
! IPsec transform set
!
crypto ipsec transform-set mjlnettrans esp-3des esp-sha-hmac
!
!
! Crypto map
!
crypto map mjlnetmap 10 ipsec-isakmp
 set peer 192.168.2.2
 set transform-set mjlnettrans
 match address 101
!
!
! GRE tunnel interface
!
interface Tunnel0
 ip address 10.3.3.1 255.255.255.0
 ip pim sparse-dense-mode
 ipx network 3000
 tunnel source 192.168.1.1
 tunnel destination 192.168.2.2
!
!
! Outside interface
!
interface Serial1/0
 ip address 192.168.1.1 255.255.255.0
 crypto map mjlnetmap
!
!
! Inside interface
!
interface FastEthernet3/0
 ip address 10.1.1.1 255.255.255.0
 ip pim sparse-dense mode
!
!
! Dynamic routing protocol for reachability over the GRE tunnel
!
router eigrp 100
 network 10.1.1.0 0.0.0.255
 network 10.3.3.0 0.0.0.255
 no auto-summary
!
!
! Route to the Berlin gateway (outside interface)
!
ip route 0.0.0.0 0.0.0.0 192.168.1.2
!
!
! Crypto access list
!
access-list 101 permit gre host 192.168.1.1 host 192.168.2.2
!
!
! NTP with authentication
!
ntp authentication-key 1 md5 09414405170003 7
ntp authenticate
ntp trusted-key 1
ntp server 10.10.10.99 key 1
!
end

Berlin#show running-config
Building configuration...
Current configuration : 7437 bytes
!
version 12.3
!
!
! IPsec gateway's host name and IP domain name
!
hostname Berlin
!
ip domain name mjlnet.com
!
!
! IP multicast and IPX configuration (example only)
!
ip multicast-routing
ip cef
ipx routing 0004.9bd6.0c00
ipx internal-network 2000
!
!
! Crypto pki trustpoint  enrollment parameters, certificate fields, and auto
! (re-)enrollment
!
crypto pki trustpoint mjlnetcertsrv
 enrollment mode ra
 enrollment url http://mjlnetcertsrv:80/certsrv/mscep/mscep.dll
 usage ike
 serial-number none
 ip-address 192.168.2.2
 password 7 0009190A0A5E1F
 subject-name C=GB, O=mjlnet, OU=engineering
 revocation-check crl none
 rsakeypair Berlin.mjlnet.com
 auto-enroll 90 regenerate
!
!
! Gateway's and CA's certificates
!
crypto pki certificate chain mjlnetcertsrv
 certificate 612A9069000000000019
 308204A9 30820453 A0030201 02020A61 2A906900 00000000 19300D06 092A8648
 86F70D01 01050500 30819931 1F301D06 092A8648 86F70D01 09011610 61646D69
! <text omitted>
 quit
 certificate ca 48B8A34E0C6A09A7447B8CBDD77C3A81
 30820304 308202AE A0030201 02021048 B8A34E0C 6A09A744 7B8CBDD7 7C3A8130
 0D06092A 864886F7 0D010105 05003081 99311F30 1D06092A 864886F7 0D010901
! <text omitted>
 quit
!
!
! IKE policy
!
crypto isakmp policy 10
 encr 3des
group 2
!
!
! IPsec transform set
!
crypto ipsec transform-set mjlnettrans esp-3des esp-sha-hmac
!
!
! Crypto map
!
crypto map mjlnetmap 10 ipsec-isakmp
 set peer 192.168.1.1
 set transform-set mjlnettrans
 match address 101
!
!
! GRE tunnel interface
!
interface Tunnel0
 ip address 10.3.3.2 255.255.255.0
 ip pim sparse-dense-mode
 ipx network 3000
 tunnel source 192.168.2.2
 tunnel destination 192.168.1.1
!
!
! Inside interface
!
interface FastEthernet1/0
 ip address 10.2.2.1 255.255.255.0
 ip pim sparse-dense mode
!
!
! Outside interface
!
interface Serial4/0
 ip address 192.168.2.2 255.255.255.0
 crypto map mjlnetmap
!
!
! Dynamic routing protocol for reachability over the GRE tunnel
!
router eigrp 100
 network 10.2.2.0 0.0.0.255
 network 10.3.3.0 0.0.0.255
 no auto-summary
!
!
! Route to the London gateway (outside interface)
!
ip route 0.0.0.0 0.0.0.0 192.168.2.1
!
!
! Crypto access list
!
access-list 101 permit gre host 192.168.2.2 host 192.168.1.1
!
!
! NTP with authentication
!
ntp authentication-key 1 md5 1104130919171F 7
ntp authenticate
ntp trusted-key 1
ntp server 10.10.10.99 key 1
!
End

Configuring VTIs

The configuration of VTIs is similar to that for IPsec-protected GRE tunnels.

Example 6-47 shows the configuration on the Berlin and London IPsec VPN gateways using, in this case, preshared key authentication. Note that only the relevant configuration is shown.

Example 6-47. Configurations for IPsec VPN Gateways London and Berlin with VTIs for IP Unicast and Multicast Traffic Transport

!
hostname London
!
!
! IP multicast configuration (example only)
!
ip multicast-routing
ip cef
!
!
! IKE policy
!
crypto isakmp policy 10
 encr 3des
 authentication pre-share
 group 2
!
!
! Preshared key
!
crypto isakmp key mjlnet address 0.0.0.0 0.0.0.0
!
!
! IPsec transform set
!
crypto ipsec transform-set vti.trans esp-3des esp-sha-hmac
!
!
! IPsec profile
!
crypto ipsec profile vti.prof
 set transform-set vti.trans
!
!
! Virtual tunnel interface (VTI)
!
interface Tunnel0
 ip address 10.3.3.1 255.255.255.0
 ip pim sparse-dense-mode
 tunnel source 192.168.1.1
 tunnel destination 192.168.2.2
 tunnel mode ipsec ipv4
 tunnel protection ipsec profile vti.prof
!
!
! Outside interface
!
interface Serial1/0
 ip address 192.168.1.1 255.255.255.0
!
!
! Inside interface
!
interface FastEthernet3/0
 ip address 10.1.1.1 255.255.255.0
 ip pim sparse-dense mode
!
! Dynamic routing protocol for reachability over the VTI
!
router eigrp 100
network 10.1.1.0 0.0.0.255
 network 10.3.3.0 0.0.0.255
no auto-summary
!
!
! Route to the Berlin gateway (outside interface)
!
ip route 192.168.2.0 255.255.255.0 192.168.1.2
!

!
hostname Berlin
!
!
! IP multicast configuration (example only)
!
ip multicast-routing
!
!
! IKE policy
!
crypto isakmp policy 10
 encr 3des
 authentication pre-share
 group 2
!
!
! Preshared key
!
crypto isakmp key mjlnet address 0.0.0.0 0.0.0.0
!
!
! IPsec transform set
!
crypto ipsec transform-set vti.trans esp-3des esp-sha-hmac
!
!
! IPsec profile
!
crypto ipsec profile vti.prof
 set transform-set vti.trans
!
!
! Virtual tunnel interface (VTI)
!
interface Tunnel0
 ip address 10.3.3.2 255.255.255.0
 ip pim sparse-dense-mode
 tunnel source 192.168.2.2
 tunnel destination 192.168.1.1
 tunnel mode ipsec ipv4
 tunnel protection ipsec profile vti.prof
!
!
! Inside interface
!
interface FastEthernet1/0
 ip address 10.2.2.1 255.255.255.0
 ip pim sparse-dense mode
!
!
! Outside interface
!
interface Serial4/0
 ip address 192.168.2.2 255.255.255.0
!
!
! Dynamic routing protocol for reachability over the VTI
!
router eigrp 100
network 10.2.2.0 0.0.0.255
 network 10.3.3.0 0.0.0.255
 no auto-summary
!
!
! Route to the London gateway (outside interface)
!
ip route 192.168.1.0 255.255.255.0 192.168.2.1
!

If you compare the configurations shown in Example 6-46 and 6-47, you will see quite a number of similarities. Apart from the obvious difference in the method of IKE phase 1 authentication (digital signature authentication versus preshared key authentication), the other major differences are the configuration of the VTIs and the IPsec profiles in Example 6-47.

The configuration of the VTI consists of many of the same commands used to configure a GRE tunnel (tunnel source, tunnel destination, and so on). Some of the commands that are used to configure VTIs are new, however. The tunnel mode ipsec ipv4 command configures the tunneling mode as IPsec and the transport protocol as IPv4. The tunnel protection ipsec profile profile-name command associates the tunnel interface with an IPsec profile (which provides IPsec protection). The IPsec profile in this example is called vti.prof.

The IPsec profile itself (vti.prof) is configured using the crypto ipsec profile profile-name command. Within the IPsec profile, an IPsec transform set (vti.trans) is specified using the set transform-set transform-set-name.

The IKE policy, preshared key, and transform set (vti.trans) are configured in the normal way using the crypto isakmp policy, crypto isakmp key, and crypto ipsec transform-set commands.

The show ip eigrp neighbors command can be used to verify the EIGRP neighbor relationship over the VTI (see Example 6-48).

Example 6-48. Verifying the EIGRP Neighbor Relationship over the VTI Using the show ip eigrp neighbors Command

London#show ip eigrp neighbors
IP-EIGRP neighbors for process 100
H  Address         Interface    Hold Uptime  SRTT  RTO Q Seq
                      (sec)     (ms)    Cnt Num
0  10.3.3.2        Tu0        10 00:42:20 1062 5000 0 4
London#

As you can see, IPsec VPN gateway London has an EIGRP neighbor relationship with IPsec VPN gateway Berlin (10.3.3.2) over the VTI (Tu0).

As shown in Example 6-49, you can verity the PIM neighbor relationship using the show ip pim neighbor command.

Example 6-49. Verifying the PIM Neighbor Relationship over the VTI Using the show ip pim neighbor Command

London#show ip pim neighbor
PIM Neighbor Table
Neighbor     Interface        Uptime/Expires  Ver  DR
Address                                               Prio/Mode
10.3.3.2     Tunnel0         00:38:57/00:01:40 v2  1 / S
London#

The output of the show ip pim neighbor command shows that a PIM neighbor relationship has also been established over the VTI with Berlin.

Manual SA and Key Management

As discussed earlier in this chapter, there are two ways of managing SAs and session keys with IPsec:

  • You can automate it using IKE.

  • You can manually configure your SAs and session keys.

Manual session key configuration does have a number of disadvantages, including the following:

  • Configuring and troubleshooting manual session keys is laborious. These factors render manual configuration unsuitable for all but the smallest VPN deployments.

  • Anti-relay mechanisms for AH and ESP are not supported with manual SA and key management.

  • Manual key management is not supported with hardware accelerators.

Now that you know why you would not want to deploy it, it is worth taking a look at the one or two exceptions when the configuration of manual session keys might prove useful:

  • If an IPsec peer does not support IKE, configuration of manual session keys is a solution. Note, however, that all Cisco devices that support IPsec also support IKE.

  • It is a possible solution if there is a firewall or other device in the path between IPsec VPN gateways that blocks IKE. In this case, the best option is to reconfigure the device blocking IKE, but manual session keys are a possible solution if reconfiguration is not possible.

Okay, on to configuration. Figure 6-38 and Example 6-50 show the configuration of manual session keys on peer IPsec VPN gateways, London and Berlin.

Figure 6-38. Configuring IPsec Manual Session Keys


Example 6-50. Configuring IPsec Manual Session Keys

!
! On London
!
no crypto isakmp enable (line 1)
!
!
crypto ipsec transform-set mjlnettransform esp-des (line 2)
!
crypto map mjlnetcmap 10 ipsec-manual (line 3)
 set peer 192.168.2.2
 set session-key inbound esp 1000 cipher 1234567812345678 (line 4)
 set session-key outbound esp 2000 cipher 8765432187654321 (line 5)
 set transform-set mjlnettransform
 match address 101
!
!
access-list 101 permit ip 10.1.1.0 0.0.0.255 10.2.2.0 0.0.0.255
!
!

! On Berlin
!
no crypto isakmp enable
!
!
crypto ipsec transform-set mjlnettransform esp-des
!
crypto map mjlnetcmap 10 ipsec-manual
 set peer 192.168.1.1
 set session-key inbound esp 2000 cipher 8765432187654321 (line 6)
 set session-key outbound esp 1000 cipher 1234567812345678 (line 7)
 set transform-set mjlnettransform
 match address 101
!
!
access-list 101 permit ip 10.2.2.0 0.0.0.255 10.1.1.0 0.0.0.255
!

The configuration of the London gateway begins with the command no crypto isakmp enable (highlighted line 1). This command disables IKE.

In highlighted line 2, you can see a regular IPsec transform set. Note, however, that it only includes ESP DES encryption. You will know by now that this is a weak transformit specifies 56-bit DES (an insecure encryption algorithm), and it does not include authentication (it is vulnerable to cut-and-paste attacks). In a live network, you should include authentication in the transform set and if possible specify a stronger encryption algorithm.

The crypto map map-name seq-number ipsec-manual command in highlighted line 3 is then used to specify that IKE will not be used to establish IPsec SAs. Within the crypto map, two session keys are specified using the set session-key {inbound|outbound} esp spi hex-key-string [authenticator hex-key-string] command (see highlighted lines 4 and 5).

The set session-key command in highlighted line 4 configures the SPI (1000) and ESP key (1234567812345678) for IPsec packets inbound from the Berlin gateway to the London gateway. The SPI is specified in decimal (a value from 256 to 4,294,967,295), and the key is specified in hexadecimal.

The set session-key command in highlighted line 5, on the other hand, configures the SPI (2000) and ESP key (8765432187654321) for IPsec packets sent by London and outbound to the Berlin gateway.

Because ESP authentication is not specified in the IPsec transform in this example, the authenticator keyword is not required with the set session-key command. If you do specify ESP authentication, make sure that you configure the authenticator keyword and associated hex-key-string parameter. The authenticator keyword is used to configure the key string (in hexadecimal) to be used for ESP authentication.

The key that you specify can be 8, 16, or 20 bytes long, depending on the following requirements:

  • If you specify DES encryption in the IPsec transform set, the key must be at least 8 bytes long.

  • If you specify MD5 authentication, the key must be at least 16 bytes long.

  • If you specify SHA-1 authentication, the key must be at least 20 bytes long.

If you configure AH in your IPsec transforms, you can specify the AH SPIs and keys in a similar way using the set session-key {inbound|outbound} ah spi hex-key-string command.

The configuration of the Berlin gateway is almost identical, but there are one or two slight differences.

The set session-key command in highlighted line 6 configures the SPI (2000) and ESP key (8765432187654321) for IPsec packets inbound from the London gateway. Parameters in this line must match those for IPsec packets outbound from the London gateway (see highlighted line 5).

The set session-key command in highlighted line 5 configures the SPI (1000) and ESP key (1234567812345678) for IPsec packets sent by the Berlin gateway and outbound to the London gateway. Parameters in this line must match those for IPsec packets inbound to the London gateway (see highlighted line 4).

So, configuration of manual session keys is fairly simple, but their usage is limited by the disadvantages discussed earlier in this section.

Deploying IPsec VPNs with NAT/PAT

If there is a Network Address Translation (NAT) or Port Address Translation (PAT) device in the path between IPsec peers in your IPsec VPN, you must carefully configure either the IPsec peers or the NAT/PAT device to ensure that IPsec operates correctly and does not break. This section examines how NAT/PAT devices can break IPsec, and how you can get around this. Figure 6-39 shows a sample IPsec VPN topology used to illustrate some of the concepts discussed in this section.

Figure 6-39. Sample IPsec VPN Topology


As you can see in Figure 6-39, the only difference to the reference topology used throughout the rest this chapter is the addition of a NAT/PAT device in front of the London IPsec VPN gateway.

How NAT/PAT Breaks IPsec

So, NAT can break IPsec, but how exactly can this happen? NAT/PAT can break IPsec in a number of ways, including the following:

To understand how you can get around problems with NAT/PAT, it is a good idea to examine each problem in a little more depth.

NAT/PAT Can Cause IKE Negotiation Initiated by IPsec Peers on Outside Networks to Fail

NAT/PAT devices must be specifically configured to accept IKE negotiation initiated by IPsec peers on outside networks. This is because there is usually a default requirement with NAT devices that address translation be initiated by devices on the inside network.

A simple method of allowing outsides IPsec devices to initiate IKE negotiation with inside IPsec devices when using standard (one-to-one) NAT is to configure a static NAT translation. So, for example, in Figure 6-39 a static translation would allow the Berlin gateway to initiate IKE negotiation through the NAT/PAT device to the London gateway.

Example 6-51 shows the configuration of a static NAT translation to allow outside IPsec gateways to initiate IKE negotiation to an inside IPsec gateway.

Example 6-51. Configuring a Static NAT Translation on the NAT Device to Allow Outside IPsec Gateways to Initiate IKE Negotiation with an Inside IPsec Gateway

!
! NAT device configuration
!
! Interface s2/0 is the NAT inside address
!
interface Serial2/0
 ip address 10.10.10.2 255.255.255.0
 ip nat inside
!
! Interface serial 2/1 is the NAT outside address
!
interface Serial2/1
 ip address 192.168.3.1 255.255.255.0
 ip nat outside
!
! The static NAT translation here allows the Berlin gateway to initiate IPsec
! connections to the London gateway.
!
ip nat inside source static 10.10.10.1 192.168.3.5
!

The highlighted line shows a static NAT translation of London's inside local address (10.10.10.1) to the inside global address 192.168.3.5.

Do not forget to configure the remote gateway (Berlin in this example) to use the local gateway's inside global address as appropriate (see Example 6-52).

Example 6-52. Configuring the Remote Gateway (Berlin) to Use the Local Gateway's Inside Global Address

!
! Remote gateway's (Berlin's) configuration
!
crypto isakmp policy 10
 hash md5
 authentication pre-share
crypto isakmp key cisco address 192.168.3.5 (line 1)
!
!
crypto ipsec transform-set mjlnettrans esp-des esp-md5-hmac
!
crypto map mjlnetmap 10 ipsec-isakmp
 set peer 192.168.3.5 (line 2)
 set transform-set mjlnettrans
 match address 101
!

In Example 6-52, highlighted line 1, the inside global address of London gateway (192.168.3.5) is specified using the crypto isakmp key and set peer commands.

If you are using PAT rather than standard (one-to-one) NAT, the configuration differs slightly, as shown in Example 6-53.

Example 6-53. Configuring a Static Translation on a PAT Device to Allow Outside IPsec Gateways to Initiate IKE Negotiation with an Inside IPsec Gateway

!
! PAT device configuration
!
!
Interface s2/0 is the NAT inside address
!
interface Serial2/0
 ip address 10.10.10.2 255.255.255.0
 ip nat inside
!
!
! Interface serial 2/1 is the NAT outside address
!
interface Serial2/1
 ip address 192.168.3.1 255.255.255.0
 ip nat outside
!
!
! The static translations here allows the Berlin gateway to initiate IPsec
! connections to the London gateway.
!
ip nat inside source list 10 interface Serial2/1 overload
ip nat inside source static esp 10.10.10.1 interface Serial2/1 (line 1)
ip nat inside source static udp 10.10.10.1 500 interface Serial2/1 500 (line 2)
!
access-list 10 permit 10.10.10.0 0.0.0.255
!

The ip nat inside source static esp inside_local_address_of_gateway interface outside_interface command in highlighted line 1 is used to allow the translation of ESP tunnel mode traffic for an IPsec tunnel to the specified inside local address. So, in this example, the destination address of ESP packets that the Berlin gateway sends to the London gateway is translated from the inside global address 192.168.3.1 (the IP address applied to interface serial 2/1) to the inside local address 10.10.10.1 (London's outside interface IP address).

The ip nat inside source static udp inside_local_address_of_gateway 500 interface outside_interface 500 command (highlighted line 2) similarly allows the translation of ISAKMP traffic (UDP port 500) to the specified inside local address. In this example, the destination address of ISAKMP packets that the Berlin gateway sends are translated from the inside global address 192.168.3.1 (the IP address applied to interface serial 2/1) to the inside local address 10.10.10.1 (London).

Again, you should configure the remote gateway to use the local gateway's inside global address as appropriate (see Example 6-52). In this case, the local gateway's inside global address is 192.168.3.1 (the IP address of interface serial 2/1 on the NAT device [see Example 6-53]).

NAT/PAT Can Cause Rekeying to Fail When NAT/PAT Is Based on IKE Cookies

Instead of translating UDP ports, some NAT/PAT devices use ISAKMP cookies to demultiplex IKE traffic inbound on the outside interface and identify individual IPsec peers to which this traffic is bound. Cookies are unique identifiers used during IKE phase 1 to make denial-of-service attacks more difficult.

If a NAT/PAT device uses ISAKMP cookies to demultiplex IKE traffic, then during rekeying (when different cookies are typically used) NAT/PAT may fail.

NAT/PAT Might Break IP Address IKE Identifier Verification

When you use IP addresses as IKE (ISAKMP) identifiers, your IKE identifier verification might fail, and ISAKMP packets might be dropped. Verification might fail because NAT/PAT modifies IP addresses in the IP header.

NAT/PAT Can Cause IPsec Peers to Drop ISAKMP Traffic

When there are multiple IPsec peers behind a PAT device, all of which are negotiating IKE SAs to the same responder, that responder must be able to accept ISAKMP packets with a source port other than UDP port 500 if the PAT device translates the source port of ISAKMP packets (from UDP port 500). This is because the PAT device translates the source UDP port of ISAKMP packets from each IPsec peer to a unique value (so that it can distinguish the individual flows/IPsec peers). However, translation of UDP source ports does mean that the responder must be able to accept (and respond to) ISAKMP packets from source UDP ports other than UDP port 500.

During rekeying, the responder must also use the unique UDP port that identifies each individual IPsec peer behind the PAT device as the UDP destination port for ISAKMP packets. If the responder does not do this, rekeying may fail.

Figure 6-40 illustrates translation of the UDP port for ISAKMP packets. In Figure 6-40, the UDP port for ISAKMP packets from hosts A, B, and C (all IKE initiators) is translated from port 500 to X, Y, and Z, respectively. This translation of UDP source port numbers allows the PAT device to distinguish ISAKMP traffic inbound from the IKE responder.

Figure 6-40. PAT Device Translates ISAKMP Source Port Numbers


So, for example, when IKE traffic from Host A to the IKE responder is received on the PAT device, it translates the UDP source port from 500 to X. The IKE responder then sends IKE traffic to Host A using UDP destination port X, and because this UDP port is unique, the PAT device is able to distinguish that this traffic should be sent to Host A (and not Hosts B and C).

It is worth noting that some PAT devices do not translate UDP port 500 because of the inability of some IPsec devices to handle ISAKMP traffic on UDP ports other than 500.

NAT/PAT Causes IPsec Devices to Drop All AH Traffic

If AH is used to protect IP traffic (whether in transport or tunnel mode), the whole packet is authenticated, including the outer IP header. NAT/PAT, by definition, translates the outer header IP address(es), and that causes the AH integrity check to fail.

Figure 6-41 illustrates the failure of the AH integrity check.

Figure 6-41. NAT Causes the AH Integrity Check to Fail


In Figure 6-41, the London gateway sends an AH packet to the Berlin gateway. The NAT/PAT device in the path translates the IP address(es) in the outer IP header, and when the AH packet arrives at the Berlin gateway, this translation causes the AH integrity check to fail, and the Berlin gateway drops the packet.

So, if there is a NAT/PAT device between two IPsec devices, use ESP rather than AH.

NAT/PAT Based on SPI Selection Might Break IPsec

As previously discussed, a combination of the security protocol (AH or ESP), SPI, and destination address uniquely identifies an IPsec SA. NAT/PAT devices sometimes use the SPI of ESP packets to distinguish traffic flows from multiple IPsec peers and ensure that IP addresses are correctly translated.

NAT/PAT based on the SPI of ESP packets often works well, but it can sometimes go wrong. Before examining how it can go wrong, it is useful to first examine exactly how NAT/PAT based on SPI works.

SPIs are assigned independently by the IPsec devices and then communicated to IPsec peers during IKE phase 2 (quick mode) negotiation. So, one host will inform the other of the SPI to use when sending traffic to it for a particular IPsec SA. Because all phase 2 messages are encrypted, it is impossible for a PAT device to find out SPI values from IKE negotiation.

PAT devices can translate the IP addresses for ESP packets by making a "best guess" based on which inside host (or other device) has recently negotiated IKE and sent ESP packets.

Figure 6-42 illustrates how a PAT device can handle ESP packet translation using SPIs. In Figure 6-42, Host A negotiates IKE with the IPsec gateway. During phase 2 negotiation, Host A informs the IPsec gateway that it should use SPI 0x11111111 when sending ESP packets to Host A, and the IPsec gateway informs Host A that should use SPI 0x22222222 when sending ESP packets to the IPsec gateway. The phase 2 negotiation is encrypted so the PAT device has no way of knowing that Host A has assigned SPI 0x11111111 and that the IPsec gateway has assigned SPI 0x22222222.

Figure 6-42. NAT/PAT Based on SPIs


After IKE negotiation is finished, Host A sends an ESP packet to the IPsec gateway (using SPI 0x22222222). Then shortly after that, the IPsec gateway sends an ESP packet to Host A via the PAT device.

When the PAT device receives the ESP packet, the destination IP address is 192.168.1.1 (the PAT overload IP address), and the SPI is 0x11111111. The PAT device then does a lookup into its translation table for the SPI (and IP addresses). If the PAT device has not previously seen the SPI, it makes a best guess and assumes that this SPI corresponds to an IPsec SA negotiated via a recent IKE negotiation (in this case, between Host A and the IPsec gateway).

Having determined that the ESP packet should go to Host A, the PAT device translates the destination IP address of the ESP packet from 192.168.1.1 (the inside global address) to 10.1.1.1 (the inside local address [Host A]) and sends the packet onward to Host A.

So, NAT/PAT based on SPIs can work well. But if two (or more) inside IPsec devices attempt to negotiate IKE with the same peer IPsec device at the same time, this can lead to communication failure.

Figure 6-43 illustrates a communication failure when two devices on the inside of the PAT device simultaneously attempt to negotiate IKE with the same IPsec peer. In Figure 6-43, Hosts A and B simultaneously negotiate IKE with the IPsec gateway. During IKE phase 2 negotiation, Host A informs the IPsec gateway that it should use SPI 0x11111111 when transmitting ESP packets to Host A. Host B informs the IPsec gateway that it should use SPI 0x55555555 when transmitting ESP packets to Host B. Immediately after negotiating IKE phase 2, Hosts A and B both send ESP packets to the IPsec gateway (not shown).

Figure 6-43. NAT/PAT Based on SPIs Fails


The IPsec gateway then sends an ESP packet to Host A, the header of which contains SPI 0x11111111. When it arrives at the PAT device, the PAT device looks up the SPI in its translation table, and when it finds no existing translation for that particular SPI (from that particular IPsec gateway), the PAT device checks to see which inside devices have recently negotiated IKE with the IPsec gateway. Unfortunately, both Host A and Host B have recently negotiated IKE phase 2 with the IPsec gateway, and so the PAT device has no idea where to send the packet.

NAT/PAT Devices Might Not Translate ESP Packets

Some NAT/PAT devices will only translate UDP- or TCP-based traffic. In this case, ESP traffic will simply be dropped.

NAT/PAT Translation Timeouts Can Cause IPsec Traffic to be Dropped

NAT translations may time out before IPsec SAs. In this case, IPsec traffic will be black-holed!

Figure 6-44 illustrates IPsec packets dropped when the NAT translation times out before the IPsec SA.

Figure 6-44. NAT Translation Times Out Before the IPsec SA


In Figure 6-44, the London and Berlin gateways negotiate IKE and then exchange ESP packets. At this point, NAT translations exist on the NAT device for IPsec traffic between the London and Berlin gateways.

A period of inactivity then ensues, during which no traffic is sent between the London and Berlin gateways. This period of inactivity causes the NAT translations on the NAT device to time out. The Berlin gateway then sends an IPsec packet to the London gateway, but the NAT device drops the packet because the NAT translation has already timed out.

NAT/PAT Can Cause TCP/UDP Header Checksum Verification to Fail When TCP/UDP Traffic Is Transported over ESP

TCP and UDP include a checksum to ensure the integrity of segments transmitted over a network. The checksum computation performed by TCP and UDP includes not only the TCP or UDP header and data but also a 12-byte "pseudo-header." This pseudo-header includes the source and destination IP addresses and ensures the TCP or UDP segment has not been delivered to the wrong destination. Normally, when a NAT device modifies IP addresses in the IP header, it updates the TCP checksum as appropriate.

In transport mode IPsec, the pseudo-header included in checksum calculation includes IP addresses from the outer IP header. Unfortunately, when a NAT device translates IP addresses in the outer header, it cannot update the checksums in the TCP or UDP headers because they are protected by ESP. This means that checksum verification fails on the receiving IPsec peer, and packets may be dropped.

NAT/PAT Can Cause Applications with Embedded IP Addresses to Fail

If IP addresses are embedded into the payload of an IP packet and the packets are protected by ESP, the IP addresses embedded in the payload will not be translated by a NAT/PAT device, and applications that rely on the IP addresses in the payload being correctly translated will not function correctly.

FTP is a good example of a protocol where IP addresses are carried in the payload of the packet (with FTP PORT and PASV commands).

Figure 6-45 shows how IP addresses embedded in an ESP packet payload are not translated by a NAT device.

Figure 6-45. IP Addresses Embedded in IPsec Packet Payloads Are Not Translated by NAT


In Figure 6-45, the FTP server sends an ESP packet to the FTP client. The NAT device translates the source address of the packet from 10.1.1.1 to 192.168.3.1 but is unable to modify the IP address (10.1.1.1) embedded in the ESP packet payload. Because the NAT device does not translate the embedded IP address, communication fails.

Unintentional NAT'ing of User Packets Can Cause These Packets Not to Be Sent over the IPsec Tunnel

If you configure NAT on an IPsec VPN gateway, you must be careful not to unintentionally NAT user packets that should be sent over an IPsec tunnel. In this case, user packets may not be sent over the tunnel, as illustrated in Figure 6-46.

Figure 6-46. Unintentionally NAT'ing User Packets Causes Them Not to Be Sent over the IPsec Tunnel


In Figure 6-46, (inbound) user traffic from the Berlin site is sent over the IPsec tunnel and successfully received at the London site.

No user traffic from network 10.1.1.0/24 to network 10.2.2.0/24 is sent over the IPsec tunnel, however.

Example 6-54 shows the configuration of the London gateway. Only the relevant configuration is shown.

Example 6-54. London Gateway's Configuration

!
! Crypto map
!
crypto map mjlnetmap 10 ipsec-isakmp
 set peer 192.168.2.2
 set transform-set mjlnettrans
 match address 101 (line 1)
!
!
! NAT outside interface
!
interface Serial1/0
 ip address 192.168.1.1 255.255.255.0
 ip nat outside
 crypto map mjlnetmap
!
!
! NAT inside interface
!
interface FastEthernet3/0
 ip address 10.1.1.1 255.255.255.0
 ip nat inside
!
!
! NAT inside source list specifies access list 102
!
ip nat inside source list 102 interface Serial1/0 overload (line 2)
!
!
! Crypto access list
!
access-list 101 permit ip 10.1.1.0 0.0.0.255 10.2.2.0 0.0.0.255 (line 3)
!
!
! Addresses to be NAT'ed
!
access-list 102 permit ip 10.1.1.0 0.0.0.255 any (line 4)
!

As you can see in highlighted lines 1 and 3, the crypto access list (101) specifies that all user (IP) traffic outbound from network 10.1.1.0/24 to network 10.2.2.0/24 should be sent over the IPsec tunnel.

But, no traffic outbound from network 10.1.1.0/24 to network 10.2.2.0/24 is being sent over the IPsec tunnel, as shown in the output of the show crypto engine connections active command (see Example 6-55).

Example 6-55. No Outbound Traffic Is Sent over the IPsec Tunnel

London#show crypto engine connections active
 ID Interface      IP-Address   State Algorithm      Encrypt Decrypt
  2 Serial1/0      192.168.1.1   set  HMAC_MD5+DES_56_CB    0  0
2000 Serial1/0     192.168.1.1   set  HMAC_MD5+DES_56_CB    0  45
2001 Serial1/0     192.168.1.1   set  HMAC_MD5+DES_56_CB    0  0
London#

The first highlighted line shows the inbound IPsec SA corresponding to the IPsec tunnel. As you can see, 45 packets have been decryptedthese are inbound user packets from the Berlin site (10.2.2.0/24).

The second highlighted line shows the outbound IPsec SA corresponding to the IPsec tunnel. No user packets from network 10.1.1.0/24 to network 10.2.2.0/24 have been sent using this IPsec SA (this is indicated by the 0 in the Encrypt column).

The reason that no user traffic (from network 10.1.1.0/24 to network 10.2.2.0/24) has been sent outbound over the IPsec tunnel is revealed if you take a look back at highlighted lines 2 and 4 in Example 6-54.

Highlighted line 2 in Example 6-54 shows that the source IP address of all user traffic specified in access list 102 (shown in highlighted line 4 in Example 6-54) is translated to the IP address configured on interface serial 1/0 (192.168.1.1).

The crypto access list specifies that all user traffic from (source) network 10.1.1.0/24 to (destination) network 10.2.2.0/24 should be sent over the IPsec tunnel, but the NAT source list specifies that the source IP address of all user traffic from source 10.1.1.0/24 should be translated to IP address 192.168.1.1.

Unfortunately, NAT happens before IPsec, so by the time any user traffic from source network 10.1.1.0/24 is matched against the crypto access list, the source IP address has already been translated (to 192.168.1.1), it does not match the source addresses in the crypto access list (10.1.1.0/24), and it is therefore not sent over the IPsec tunnel.

To solve this issue, when configuring NAT on an IPsec gateway, you must be careful to ensure that user traffic that should be sent over that IPsec tunnel is not unintentionally NAT'ed.

Access list 102 (which defines addresses to be NAT'ed [see highlighted line 4, Example 6-54]) is then modified to ensure that user traffic from network 10.1.1.0/24 to network 10.2.2.0/24 is sent over the IPsec tunnel, as shown in Example 6-56.

Example 6-56. Bypassing NAT for User Traffic from Network 10.1.1.0/24 to Network 10.2.2.0/24

London#conf t
Enter configuration commands, one per line. End with CNTL/Z.
London(config)#no access-list 102 (line 1)
London(config)#access-list 102 deny
 ip 10.1.1.0 0.0.0.255 10.2.2.0 0.0.0.255 (line 2)
London(config)#access-list 102 permit ip 10.1.1.0 0.0.0.255 any (line 3)
London(config)#exit
London#

In highlighted line 1, access list 102 is deleted.

Then, in highlighted lines 2 and 3, access list 102 is reconfigured to deny user traffic from network 10.1.1.0/24 to network 10.2.2.0 (the user traffic specified in the crypto access list [see Example 6-54, highlighted line 3]), and permit all other user traffic from network 10.1.1.0/24.

The effect of this reconfiguration is that user traffic that should be sent over the IPsec tunnel (as defined in the crypto access list) bypasses NAT. Because this user traffic bypasses NAT, it now correctly matches the crypto access list and is sent over the IPsec tunnel. All other user traffic from network 10.1.1.0/24 to any other destination is still NAT'ed.

In Example 6-57, the output of the show crypto engine connections active command shows that outbound traffic from the network 10.1.1.0/24 to network 10.2.2.0/24 is now sent over the IPsec tunnel.

Example 6-57. Outbound Traffic from Network 10.1.1.0/24 to Network 10.2.2.0/24 Is Now Sent over the IPsec Tunnel

London#show crypto engine connections active
 ID Interface      IP-Address    State Algorithm           Encrypt Decrypt
  1 Serial1/0      192.168.1.1   set   HMAC_MD5+DES_56_CB    0      0
2000 Serial1/0     192.168.1.1   set   HMAC_MD5+DES_56_CB    0      121
2001 Serial1/0     192.168.1.1   set   HMAC_MD5+DES_56_CB    121    0
London#

The first highlighted line shows inbound user traffic that has been sent over the IPsec tunnel from the Berlin site (121 packet decrypted).

The second highlighted line shows outbound user traffic that has been sent over the IPsec tunnel to the Berlin site (121 packet encrypted).

Figure 6-47 illustrates the effect of modifying access list 102.

Figure 6-47. User Traffic from Network 10.1.1.0/24 to Network 10.2.2.0/24 Is Now Sent over the IPsec Tunnel


So, now you know how to bypass dynamic NAT for user traffic that should be sent over an IPsec tunnel. But, how about bypassing static NAT?

Example 6-58 shows the configuration necessary to bypass static NAT for user traffic that should be sent over an IPsec tunnel. This configuration relates to the topology shown in Figures 6-46 and 6-47.

Example 6-58. Bypassing Static NAT for User Traffic That Should Be Sent over the IPsec Tunnel

!
! Loopback interface that is used to bypass static NAT for user traffic that should be
! sent over the IPsec tunnel
!
interface Loopback0 (line 1)
 ip address 100.1.1.1 255.255.255.0
!
!
! NAT inside interface (route map 'bypass.static.nat' configured here)
!
interface FastEthernet3/0
 ip address 10.1.1.1 255.255.255.0
 ip nat inside
 ip route-cache policy
 ip policy route-map bypass.static.nat (line 2)
!
!
! Static NAT entry
!
ip nat inside source static 10.1.1.2 192.168.1.3 (line 3)
!
!
! Access list 103 specifies user traffic that should bypass static NAT
!
access-list 103 permit ip host 10.1.1.2 10.2.2.0 0.0.0.255 (line 4)
!
!
! Route map 'bypass.static.nat' defines user traffic that should bypass static NAT
! (references access list 103), and sets the next-hop for this traffic as 100.1.1.2
! (an IP address on the same subnet as interface Loopback 0)
!
route-map bypass.static.nat permit 10 (line 5)
 match ip address 103 (line 6)
 set ip next-hop 100.1.1.2 (line 7)
!

The static NAT entry in highlighted line 3 specifies that the source address 10.1.1.2 should be translated to address 192.168.1.3.

Route map bypass.static.nat in highlighted lines 5 through 7 ensures that all traffic matching access list 103 (highlighted line 4) should be routed via the IP address 100.1.1.2 (an IP address on the same subnet as interface Loopback 0 [see highlighted line 1]). The route map is then applied to the inside interface in highlighted line 2.

Now, the effect of routing all user traffic matching access list 103 (host address 10.1.1.2 to network 10.2.2.0/24) via next hop 100.1.1.2 is that this traffic bypasses the static NAT entry (highlighted line 3). The user traffic specified in access list 103 then matches the crypto access list (which matches all traffic from network 10.1.1.0/24 to network 10.2.2.0/24), and it is sent over the IPsec tunnel.

Getting Around Issues with NAT/PAT and IPsec Tunnels

As described in the previous sections, NAT/PAT can break IPsec in a number of ways. This section describes and summarizes possible solutions that will allow you configure IPsec tunnels when there is a NAT device in the path between IPsec peers.

To allow IPsec tunnels to traverse NAT/PAT devices, you can do the following:

  • Configure static NAT entries to allow IPsec gateways on the outside network to initiate IKE. See the section "NAT/PAT Can Cause IKE Negotiation Initiated by IPsec Peers on Outside Networks to Fail" for more information on this solution.

  • Use an IPsec-aware NAT/PAT device. As described in the sections "NAT/PAT Can Cause Rekeying to Fail When NAT/PAT Is Based on IKE Cookies" and "NAT/PAT Based on SPI Selection Can Cause ESP Packets to Be Dropped," IPsec-aware NAT/PAT devices are not perfect, but they do often work well.

    Cisco IOS Software Release 12.2(13)T and 12.2(15)T introduce support for ESP through PAT on Cisco routers. See the following URLs for more information on this feature:

    http://www.cisco.com/en/US/products/sw/iosswrel/ps1839/products_feature_guide09186a0080110c03.html

    http://www.cisco.com/en/US/products/sw/iosswrel/ps1839/products_feature_guide09186a00801541de.html

  • Use ESP tunnel mode rather than transport mode. Tunnel mode can resolve issues with IKE identifiers and TCP/UDP checksums.

    The TCP/UDP checksum issue does not affect tunnel mode because in this mode the pseudo-header includes source and destination IP addresses taken not from the new outer IP header, but from the original IP header which is not modified by NAT (see Figure 6-20).

    Another way of resolving the UDP/TCP checksum issue is to configure GRE over IPsec. In this case, user packets are encapsulated in GRE, and UDP/TCP checksums are therefore not affected by NAT.

  • Use ESP rather than AH. Remember that AH is incompatible with NAT/PAT.

  • Use IPsec NAT traversal/transparency. This feature allows IPsec devices to detect NAT/PAT devices during IKE phase 1 and encapsulate IKE/ESP traffic in UDP (using port 4500).

    NAT traversal/transparency is a comprehensive solution and resolves issues with NAT/PAT devices not translating ESP packets, resolves issues with TCP/UDP checksums, and resolves the issue of IPsec peers dropping ISAKMP packets that do not use UDP port 500.

    NAT traversal/transparency is available in Cisco IOS Software Release 12.2(13)T and is enabled by default. If for some reason you do not want to use NAT traversal/transparency, you can use the no crypto ipsec nat-transparency udp-encapsulation global configuration mode command.

    Note that NAT traversal is included in the base specification for IKEv2.

    NAT traversal is an industry standard, but on Cisco ASA 5500s and VPN 3000 concentrators it is also possible to configure Cisco proprietary UDP or TCP encapsulation for IPsec on a user-defined port.

  • Use keepalives or a dynamic routing protocol to ensure that dynamic NAT/PAT translation timeouts do not cause IPsec traffic to be dropped (assuming the keepalive/update interval is less than the NAT/PAT translation timeout).

    Use the crypto isakmp nat keepalive seconds global configuration mode command to configure IPsec peers to send NAT keepalives at the interval specified.

    Alternatively, use GRE tunnel keepalives (assuming that you have configured a GRE tunnel to carry multiprotocol and multicast traffic) or ISAKMP keepalives to ensure that NAT/PAT translations do not time out.

    You can configure GRE keepalives using the keepalive seconds [retries] command under a GRE tunnel interface.

    You can configure ISAKMP keepalives using the crypto isakmp keepalive seconds [retries] command.

    Finally, you could also configure a dynamic routing protocol over a GRE/IPsec tunnel. Because dynamic routing protocols periodically send keepalives and/or updates, this ensures that NAT/PAT translations do not time out.

  • Perform NAT before IPsec to allow applications that use embedded IP addresses to function correctly.

    If the IPsec device is placed in front of the NAT device, or NAT is performed on the IPsec device itself (assuming NAT processing before IPsec), applications function correctly because NAT is also able to translate embedded IP addresses.

  • Bypass NAT for user traffic that should be sent over an IPsec tunnel, if appropriate.

    See the section "Unintentional NAT'ing of User Packets Can Cause These Packets Not to Be Sent over the IPsec Tunnel" for more information on this solution.

Allowing IPsec to Traverse a Firewall

If there is a firewall in front of an IPsec VPN gateway (as shown in Figure 6-48), you must be careful to ensure that IPsec traffic is allowed through the firewall.

Figure 6-48. Firewall in Front of an IPsec VPN Gateway


The protocols and ports that you might need to allow through a firewall (depending on your precise configuration) are as follows:

  • AH, IP protocol 51.

  • ESP, IP protocol 50.

  • IKE (ISAKMP), UDP port 500.

  • If you are using standard NAT traversal/transparency, allow UDP port 4500.

  • If you have configured Cisco proprietary UDP or TCP encapsulation for IPsec on a Cisco VPN concentrator, allow this user-defined UDP or TCP port.

  • If the IPsec tunnel terminates on the firewall, allow user traffic protocols and ports. User protocols and ports need to be permitted because IPsec traffic is processed twice on an outside interface: once in its IPsec encapsulated form, and once when IPsec encapsulation has been removed.


Previous Page
Next Page