Configuring Security for VPNs with IPsec

This chapter describes how to configure basic IPsec VPNs. IPsec is a framework of open standards developed by the IETF. It provides security for the transmission of sensitive information over unprotected networks such as the Internet. IPsec acts at the network layer, protecting and authenticating IP packets between participating IPsec devices (“peers”), such as Cisco routers.


Note


Security threats, as well as the cryptographic technologies to help protect against them, are constantly changing. For more information about the latest Cisco cryptographic recommendations, see the Next Generation Encryption (NGE) white paper.


Information About Configuring Security for VPNs with IPsec

Supported Standards

Cisco implements the following standards with this feature:

  • IPsec—IPsec is a framework of open standards that provides data confidentiality, data integrity, and data authentication between participating peers. IPsec provides these security services at the IP layer; IPsec uses IKE to handle negotiation of protocols and algorithms based on the local policy, and generate the encryption and authentication keys to be used by IPsec. IPsec can be used to protect one or more data flows between a pair of hosts, between a pair of security gateways, or between a security gateway and a host.


    Note


    The term IPsec is sometimes used to describe the entire protocol of IPsec data services and IKE security protocols, and is also sometimes used to describe only the data services.


  • IKE (IKEv1 and IKEv2)—A hybrid protocol that implements Oakley and SKEME key exchanges inside the Internet Security Association and Key Management Protocol (ISAKMP) framework. While IKE is used with other protocols, its initial implementation is with the IPsec protocol. IKE provides authentication of IPsec peers, negotiates IPsec security associations, and establishes IPsec keys.

The component technologies implemented for IPsec include:


Note


Cisco no longer recommends using DES, 3DES, MD5 (including HMAC variant), and Diffie-Hellman (DH) groups 1, 2 and 5; instead, you should use AES, SHA and DH Groups 14 or higher. For more information about the latest Cisco cryptographic recommendations, see the Next Generation Encryption (NGE) white paper.


  • AES—Advanced Encryption Standard. A cryptographic algorithm that protects sensitive, unclassified information. AES is a privacy transform for IPsec and IKE and has been developed to replace DES. AES is designed to be more secure than DES. AES offers a larger key size, while ensuring that the only known approach to decrypt a message is for an intruder to try every possible key. AES has a variable key length—the algorithm can specify a 128-bit key (the default), a 192-bit key, or a 256-bit key.

  • DES—Data Encryption Standard. An algorithm that is used to encrypt packet data. Cisco software implements the mandatory 56-bit DES-CBC with Explicit IV. Cipher Block Chaining (CBC) requires an initialization vector (IV) to start encryption. The IV is explicitly given in the IPsec packet. For backwards compatibility, Cisco IOS IPsec also implements the RFC 1829 version of ESP DES-CBC.

Cisco IOS also implements Triple DES (168-bit) encryption, depending on the software versions available for a specific platform. Cisco no longer recommends Triple DES (3DES).


Note


Cisco IOS images with strong encryption (including, but not limited to 56-bit data encryption feature sets) are subject to United States government export controls, and have a limited distribution. Images to be installed outside the United States require an export license. Customer orders might be denied or subject to delay due to United States government regulations. Contact your sales representative or distributor for more information, or send an e-mail to export@cisco.com.


  • SHA-2 and SHA-1 family (HMAC variant)—Secure Hash Algorithm (SHA) 1 and 2. Both SHA-1 and SHA-2 are hash algorithms used to authenticate packet data and verify the integrity verification mechanisms for the IKE protocol. HMAC is a variant that provides an additional level of hashing. SHA-2 family adds the SHA-256 bit hash algorithm and SHA-384 bit hash algorithm. This functionality is part of the Suite-B requirements that comprises four user interface suites of cryptographic algorithms for use with IKE and IPSec that are described in RFC 4869. Each suite consists of an encryption algorithm, a digital signature algorithm, a key agreement algorithm, and a hash or message digest algorithm. See the Configuring Security for VPNs with IPsec feature module for more detailed information about Cisco IOS Suite-B support. SHA-2 for ISAKMP is supported in Cisco IOS XE 15.3(3)S and later.

  • Diffie-Hellman—A public-key cryptography protocol that allows two parties to establish a shared secret over an unsecure communications channel. Diffie-Hellman is used within IKE to establish session keys. It supports 768-bit (the default), 1024-bit, 1536-bit, 2048-bit, 3072-bit, and 4096-bit DH groups. It also supports a 2048-bit DH group with a 256-bit subgroup, and 256-bit and 384-bit elliptic curve DH (ECDH). Cisco recommends using 2048-bit or larger DH key exchange, or ECDH key exchange.

  • MD5 (Hash-based Message Authentication Code (HMAC) variant)—Message digest algorithm 5 (MD5) is a hash algorithm. HMAC is a keyed hash variant used to authenticate data.

IPsec as implemented in Cisco software supports the following additional standards:

  • AH—Authentication Header. A security protocol, which provides data authentication and optional anti-replay services. AH is embedded in the data to be protected (a full IP datagram).

  • ESP—Encapsulating Security Payload. A security protocol, which provides data privacy services and optional data authentication, and anti-replay services. ESP encapsulates the data to be protected.

Supported Encapsulation

IPsec works with the following serial encapsulations: Frame Relay, High-Level Data-Links Control (HDLC), and PPP.

IPsec also works with Generic Routing Encapsulation (GRE) and IPinIP Layer 3, Data Link Switching+ (DLSw+), and Source Route Bridging (SRB) tunneling protocols; however, multipoint tunnels are not supported. Other Layer 3 tunneling protocols may not be supported for use with IPsec.

IPsec Functionality Overview

IPsec provides the following network security services. (In general, the local security policy dictates the use of one or more of these services.)

  • Data confidentiality—The IPsec sender can encrypt packets before transmitting them across a network.

  • Data integrity—The IPsec receiver can authenticate packets sent by the IPsec sender to ensure that the data has not been altered during transmission.

  • Data origin authentication—The IPsec receiver can authenticate the source of the sent IPsec packets. This service is dependent upon the data integrity service.

  • Anti-replay—The IPsec receiver can detect and reject replayed packets.

IPsec provides secure tunnels between two peers, such as two routers. You define which packets are considered sensitive and should be sent through these secure tunnels, and you define the parameters that should be used to protect these sensitive packets by specifying the characteristics of these tunnels. When the IPsec peer recognizes a sensitive packet, the peer sets up the appropriate secure tunnel and sends the packet through the tunnel to the remote peer. (The use of the term tunnel in this chapter does not refer to using IPsec in tunnel mode.)

More accurately, these tunnels are sets of security associations (SAs) that are established between two IPsec peers. The SAs define the protocols and algorithms to be applied to sensitive packets and specify the keying material to be used by the two peers. SAs are unidirectional and are established per security protocol (AH or ESP).

Once established, the set of SAs (outbound to the peer) is then applied to the triggering packet and to subsequent applicable packets as those packets exit the router. “Applicable” packets are packets that match the same access list criteria that the original packet matched. For example, all applicable packets could be encrypted before being forwarded to the remote peer. The corresponding inbound SAs are used when processing the incoming traffic from that peer.

Multiple IPsec tunnels can exist between two peers to secure different data streams, with each tunnel using a separate set of SAs. For example, some data streams only need to be authenticated, while other data streams must both be encrypted and authenticated.

IKEv1 Transform Sets

An Internet Key Exchange version 1 (IKEv1) transform set represents a certain combination of security protocols and algorithms. During the IPsec SA negotiation, the peers agree to use a particular transform set for protecting a particular data flow.

IKEv2 Transform Sets

An Internet Key Exchange version 2 (IKEv2) proposal is a set of transforms used in the negotiation of IKEv2 SA as part of the IKE_SA_INIT exchange. An IKEv2 proposal is regarded as complete only when it has at least an encryption algorithm, an integrity algorithm, and a Diffie-Hellman (DH) group configured. If no proposal is configured and attached to an IKEv2 policy, then the default proposal is used in the negotiation. The default proposal is a collection of commonly used algorithms which are as follows:

encryption aes-cbc-128 3des
integrity sha1 md5
group 5 2

Although the crypto ikev2 proposal command is similar to the crypto isakmp policy priority command, the IKEv2 proposal differs as follows:

  • An IKEv2 proposal allows configuration of one or more transforms for each transform type.

  • An IKEv2 proposal does not have any associated priority.


Note


To use IKEv2 proposals in negotiation, they must be attached to IKEv2 policies. If a proposal is not configured, then the default IKEv2 proposal is used with the default IKEv2 policy.


How to Configure IPsec VPNs

Creating Crypto Access Lists

Procedure

  Command or Action Purpose

Step 1

enable

Example:

Router> enable

Enables privileged EXEC mode.

  • Enter your password if prompted.

Step 2

configure terminal

Example:

Router# configure terminal

Enters global configuration mode.

Step 3

Do one of the following: access-list access-list-number {deny | permit } protocol source source-wildcard destination destination-wildcard [log ] or ip access-list extended name

Example:

Router(config)# access-list 100 permit ip 10.0.68.0 0.0.0.255 10.1.1.0 0.0.0.255
Router(config)# ip access-list extended vpn-tunnel

Specifies conditions to determine which IP packets are protected.

  • You specify conditions using an IP access list designated by either a number or a name. The access-list command designates a numbered extended access list; the ip access-list extended command designates a named access list.

  • Enable or disable crypto for traffic that matches these conditions.

Tip

 

Cisco recommends that you configure “mirror image” crypto access lists for use by IPsec and that you avoid using the any keyword.

Step 4

Repeat Step 3 for each crypto access list you want to create.

What to do next

After at least one crypto access list is created, a transform set needs to be defined as described in Configuring Transform Sets for IKEv1 and IKEv2 Proposals.

Next the crypto access lists need to be associated to particular interfaces when you configure and apply crypto map sets to the interfaces. (Follow the instructions in Creating Crypto Map Sets and Applying Crypto Map Sets to Interfaces).

Configuring Transform Sets for IKEv1 and IKEv2 Proposals

Perform this task to define a transform set that is to be used by the IPsec peers during IPsec security association negotiations with IKEv1 and IKEv2 proposals.

Restrictions

If you are specifying SEAL encryption, note the following restrictions:

  • Your router and the other peer must not have a hardware IPsec encryption.

  • Your router and the other peer must support IPsec.

  • Your router and the other peer must support the k9 subsystem.

  • SEAL encryption is available only on Cisco equipment. Therefore, interoperability is not possible.

  • Unlike IKEv1, the authentication method and SA lifetime are not negotiable in IKEv2, and because of this, these parameters cannot be configured under the IKEv2 proposal.

Configuring Transform Sets for IKEv1

Procedure
  Command or Action Purpose

Step 1

enable

Example:
Router> enable

Enables privileged EXEC mode.

  • Enter your password if prompted.

Step 2

configure terminal

Example:
Router# configure terminal

Enters global configuration mode.

Step 3

crypto ipsec transform-set transform-set-name transform1 [transform2 [transform3 ]]

Example:
Router(config)# crypto ipsec transform-set aesset esp-aes 256 esp-sha-hmac

Defines a transform set and enters crypto transform configuration mode.

  • There are complex rules defining the entries that you can use for transform arguments. These rules are explained in the command description for the crypto ipsec transform-set command, and the table in “About Transform Sets” section provides a list of allowed transform combinations.

Step 4

mode [tunnel | transport ]

Example:
Router(cfg-crypto-tran)# mode transport

(Optional) Changes the mode associated with the transform set.

  • The mode setting is applicable only to traffic whose source and destination addresses are the IPsec peer addresses; it is ignored for all other traffic. (All other traffic is in tunnel mode only.)

Step 5

end

Example:
Router(cfg-crypto-tran)# end

Exits crypto transform configuration mode and enters privileged EXEC mode.

Step 6

clear crypto sa [peer {ip-address | peer-name } | sa map map-name | sa entry destination-address protocol spi ]

Example:
Router# clear crypto sa

(Optional) Clears existing IPsec security associations so that any changes to a transform set takes effect on subsequently established security associations.

Manually established SAs are reestablished immediately.

  • Using the clear crypto sa command without parameters clears out the full SA database, which clears out active security sessions.

  • You may also specify the peer, map, or entry keywords to clear out only a subset of the SA database.

Step 7

show crypto ipsec transform-set [tag transform-set-name ]

Example:
Router# show crypto ipsec transform-set

(Optional) Displays the configured transform sets.

What to do next

After you have defined a transform set, you should create a crypto map as specified in Creating Crypto Map Sets.

Configuring Transform Sets for IKEv2

Procedure
  Command or Action Purpose

Step 1

enable

Example:
Router> enable

Enables privileged EXEC mode.

  • Enter your password if prompted.

Step 2

configure terminal

Example:
Router# configure terminal

Enters global configuration mode.

Step 3

crypto ikev2 proposal proposal-name

Example:
Router(config)# crypto ikev2 proposal proposal-1

Specifies the name of the proposal and enters crypto IKEv2 proposal configuration mode.

  • The proposals are referred in IKEv2 policies through the proposal name.

Step 4

encryption transform1 [transform2 ] ...

Example:
Router(config-ikev2-proposal)# encryption aes-cbc-128

(Optional) Specifies one or more transforms of the following encryption type:

  • AES-CBC 128—128-bit AES-CBC

  • AES-CBC 192—192-bit AES-CBC

  • AES-CBC 256—256-bit AES-CBC

  • 3DES—168-bit DES (No longer recommended. AES is the recommended encryption algorithm).

Step 5

integrity transform1 [transform2 ] ...

Example:
Router(config-ikev2-proposal)# integrity sha1

(Optional) Specifies one or more transforms of the following integrity type:

  • The sha256 keyword specifies SHA-2 family 256-bit (HMAC variant) as the hash algorithm.

  • The sha384 keyword specifies SHA-2 family 384-bit (HMAC variant) as the hash algorithm.

  • The sha512 keyword specifies SHA-2 family 512-bit (HMAC variant) as the hash algorithm

  • The sha1 keyword specifies the SHA-1 (HMAC variant) as the hash algorithm.

  • The md5 keyword specifies MD5 (HMAC variant) as the hash algorithm. (No longer recommended. SHA-1 is the recommended replacement.)

Step 6

group transform1 [transform2 ] ...

Example:
Router(config-ikev2-proposal)# group 14

(Optional) Specifies one or more transforms of the possible DH group type:

  • 1—768-bit DH (No longer recommended.)

  • 2—1024-bit DH (No longer recommended)

  • 5—1536-bit DH (No longer recommended)

  • 14—Specifies the 2048-bit DH group.

  • 15—Specifies the 3072-bit DH group.

  • 16—Specifies the 4096-bit DH group.

  • 19—Specifies the 256-bit elliptic curve DH (ECDH) group.

  • 20—Specifies the 384-bit ECDH group.

  • 24—Specifies the 2048-bit DH/DSA group.

Step 7

end

Example:
Router(config-ikev2-proposal)# end

Exits crypto IKEv2 proposal configuration mode and returns to privileged EXEC mode.

Step 8

show crypto ikev2 proposal

Example:
Router# show crypto ikev2 proposal

(Optional) Displays the parameters for each IKEv2 proposal.

Creating Crypto Map Sets

Creating Static Crypto Maps

When IKE is used to establish SAs, the IPsec peers can negotiate the settings they use for the new security associations. This means that you can specify lists (such as lists of acceptable transforms) within the crypto map entry.

Perform this task to create crypto map entries that use IKE to establish SAs. To create IPv6 crypto map entries, you must use the ipv6 keyword with the crypto map command. For IPv4 crypto maps, use the crypto map command without the ipv6 keyword.


Note


Security threats, as well as the cryptographic technologies to help protect against them, are constantly changing. For more information about the latest Cisco cryptographic recommendations, see the Next Generation Encryption (NGE) white paper.


Procedure
  Command or Action Purpose

Step 1

enable

Example:
Router> enable

Enables privileged EXEC mode.

  • Enter your password if prompted.

Step 2

configure terminal

Example:
Router# configure terminal

Enters global configuration mode.

Step 3

crypto map [ipv6 ] map-name seq-num [ipsec-isakmp ]

Example:
Router(config)# crypto map static-map 1 ipsec-isakmp

Creates or modifies a crypto map entry, and enters crypto map configuration mode.

  • For IPv4 crypto maps, use the command without the ipv6 keyword.

Step 4

match address access-list-id

Example:
Router(config-crypto-m)# match address vpn-tunnel

Names an extended access list.

  • This access list determines the traffic that should be protected by IPsec and the traffic that should not be protected by IPsec security in the context of this crypto map entry.

Step 5

set-peer {hostname | ip-address }

Example:
Router(config-crypto-m)# set-peer 192.168.101.1

Specifies a remote IPsec peer—the peer to which IPsec protected traffic can be forwarded.

  • Repeat for multiple remote peers.

Step 6

crypto ipsec security-association dummy {pps rate | seconds seconds }

Example:
Router(config-crypto-m)# set security-association dummy seconds 5

Enables generating dummy packets. These dummy packets are generated for all flows created in the crypto map.

Step 7

set transform-set transform-set-name1 [transform-set-name2...transform-set-name6 ]

Example:
Router(config-crypto-m)# set transform-set aesset

Specifies the transform sets that are allowed for this crypto map entry.

  • List multiple transform sets in the order of priority (highest priority first).

Step 8

set security-association lifetime {seconds seconds | kilobytes kilobytes | kilobytes disable }

Example:
Router(config-crypto-m)# set security-association lifetime seconds 2700

(Optional) Specifies a SA lifetime for the crypto map entry.

  • By default, the SAs of the crypto map are negotiated according to the global lifetimes, which can be disabled.

Step 9

set security-association level per-host

Example:
Router(config-crypto-m)# set security-association level per-host

(Optional) Specifies that separate SAs should be established for each source and destination host pair.

  • By default, a single IPsec “tunnel” can carry traffic for multiple source hosts and multiple destination hosts.

Caution

 

Use this command with care because multiple streams between given subnets can rapidly consume resources.

Step 10

set pfs [group1 | group14 | group15 | group16 | group19 | group2 | group20 | group24 | group5]

Example:
Router(config-crypto-m)# set pfs group14

(Optional) Specifies that IPsec either should ask for password forward secrecy (PFS) when requesting new SAs for this crypto map entry or should demand PFS in requests received from the IPsec peer.

  • Group 1 specifies the 768-bit Diffie-Hellman (DH) identifier (default). (No longer recommended).

  • Group 2 specifies the 1024-bit DH identifier. (No longer recommended).

  • Group 5 specifies the 1536-bit DH identifier. (No longer recommended)

  • Group 14 specifies the 2048-bit DH identifier.

  • Group 15 specifies the 3072-bit DH identifier.

  • Group 16 specifies the 4096-bit DH identifier.

  • Group 19 specifies the 256-bit elliptic curve DH (ECDH) identifier.

  • Group 20 specifies the 384-bit ECDH identifier.

  • Group 24 specifies the 2048-bit DH/DSA identifier

  • By default, PFS is not requested. If no group is specified with this command, group 1 is used as the default.

Step 11

end

Example:
Router(config-crypto-m)# end

Exits crypto map configuration mode and returns to privileged EXEC mode.

Step 12

show crypto map [interface interface | tag map-name ]

Example:
Router# show crypto map

Displays your crypto map configuration.

Certain configuration changes take effect only when negotiating subsequent SAs. If you want the new settings to take immediate effect, you must clear the existing SAs so that they are reestablished with the changed configuration. If the router is actively processing IPsec traffic, clear only the portion of the SA database that would be affected by the configuration changes (that is, clear only the SAs established by a given crypto map set). Clearing the full SA database should be reserved for large-scale changes, or when the router is processing very little other IPsec traffic.

To clear IPsec SAs, use the clear crypto sa command with appropriate parameters. (Omitting all parameters clears out the full SA database, which clears active security sessions.)

What to do next

After you have successfully created a static crypto map, you must apply the crypto map set to each interface through which IPsec traffic flows. To complete this task, see Applying Crypto Map Sets to Interfaces.

Creating Dynamic Crypto Maps

Dynamic crypto map entries specify crypto access lists that limit traffic for which IPsec SAs can be established. A dynamic crypto map entry that does not specify an access list is ignored during traffic filtering. A dynamic crypto map entry with an empty access list causes traffic to be dropped. If there is only one dynamic crypto map entry in the crypto map set, it must specify the acceptable transform sets.

Perform this task to create dynamic crypto map entries that use IKE to establish the SAs.


Note


IPv6 addresses are not supported on dynamic crypto maps.



Note


Security threats, as well as the cryptographic technologies to help protect against them, are constantly changing. For more information about the latest Cisco cryptographic recommendations, see the Next Generation Encryption (NGE) white paper.


Procedure
  Command or Action Purpose

Step 1

enable

Example:
Router> enable

Enables privileged EXEC mode.

  • Enter your password if prompted.

Step 2

configure terminal

Example:
Router# configure terminal

Enters global configuration mode.

Step 3

crypto dynamic-map dynamic-map-name dynamic-seq-num

Example:
Router(config)# crypto dynamic-map test-map 1

Creates a dynamic crypto map entry and enters crypto map configuration mode.

Step 4

set transform-set transform-set-name1 [transform-set-name2...transform-set-name6 ]

Example:
Router(config-crypto-m)# set transform-set aesset

Specifies the transform sets allowed for the crypto map entry.

  • List multiple transform sets in the order of priority (highest priority first). This is the only configuration statement required in dynamic crypto map entries.

Step 5

match address access-list-id

Example:
Router(config-crypto-m)# match address 101

(Optional) Specifies the list number or name of an extended access list.

  • This access list determines which traffic should be protected by IPsec and which traffic should not be protected by IPsec security in the context of this crypto map entry.

    Note

     

    Although access lists are optional for dynamic crypto maps, they are highly recommended.

  • If an access list is configured, the data flow identity proposed by the IPsec peer must fall within a permit statement for this crypto access list.

  • If an access list is not configured, the device accepts any data flow identity proposed by the IPsec peer. However, if an access list is configured but the specified access list does not exist or is empty, the device drops all packets. This is similar to static crypto maps, which require access lists to be specified.

  • Care must be taken if the any keyword is used in the access list, because the access list is used for packet filtering as well as for negotiation.

  • You must configure a match address; otherwise, the behavior is not secure, and you cannot enable TED because packets are sent in the clear (unencrypted.)

Step 6

set-peer {hostname | ip-address }

Example:
Router(config-crypto-m)# set-peer 192.168.101.1

(Optional) Specifies a remote IPsec peer. Repeat this step for multiple remote peers.

Note

 

This is rarely configured in dynamic crypto map entries. Dynamic crypto map entries are often used for unknown remote peers.

Step 7

set security-association lifetime {seconds seconds | kilobytes kilobytes | kilobytes disable }

Example:
Router(config-crypto-m)# set security-association lifetime seconds 720

(Optional) Overrides (for a particular crypto map entry) the global lifetime value, which is used when negotiating IP Security SAs.

Note

 

To minimize the possibility of packet loss when rekeying in high bandwidth environments, you can disable the rekey request triggered by a volume lifetime expiry.

Step 8

set pfs [group1 | group14 | group15 | group16 | group19 | group2 | group20 | group24 | group5]

Example:
Router(config-crypto-m)# set pfs group14

(Optional) Specifies that IPsec should ask for PFS when requesting new security associations for this crypto map entry or should demand PFS in requests received from the IPsec peer.

  • Group 1 specifies the 768-bit Diffie-Hellman (DH) identifier (default). (No longer recommended).

  • Group 2 specifies the 1024-bit DH identifier. (No longer recommended).

  • Group 5 specifies the 1536-bit DH identifier. (No longer recommended)

  • Group 14 specifies the 2048-bit DH identifier.

  • Group 15 specifies the 3072-bit DH identifier.

  • Group 16 specifies the 4096-bit DH identifier.

  • Group 19 specifies the 256-bit elliptic curve DH (ECDH) identifier.

  • Group 20 specifies the 384-bit ECDH identifier.

  • Group 24 specifies the 2048-bit DH/DSA identifier

  • By default, PFS is not requested. If no group is specified with this command, group1 is used as the default.

Step 9

exit

Example:
Router(config-crypto-m)# exit

Exits crypto map configuration mode and returns to global configuration mode.

Step 10

exit

Example:
Router(config)# exit

Exits global configuration mode.

Step 11

show crypto dynamic-map [tag map-name ]

Example:
Router# show crypto dynamic-map

(Optional) Displays information about dynamic crypto maps.

Step 12

configure terminal

Example:
Router# configure terminal

Enters global configuration mode.

Step 13

crypto map map-name seq-num ipsec-isakmp dynamic dynamic-map-name [discover ]

Example:
Router(config)# crypto map static-map 1 ipsec-isakmp dynamic test-map discover

(Optional) Adds a dynamic crypto map to a crypto map set.

  • You should set the crypto map entries referencing dynamic maps to the lowest priority entries in a crypto map set.

Note

 

You must enter the discover keyword to enable TED.

Step 14

exit

Example:
Router(config)# exit

Exits global configuration mode.

Certain configuration changes take effect only when negotiating subsequent SAs. If you want the new settings to take immediate effect, you must clear the existing SAs so that they are reestablished with the changed configuration. If the router is actively processing IPsec traffic, clear only the portion of the SA database that would be affected by the configuration changes (that is, clear only the SAs established by a given crypto map set). Clearing the entire SA database must be reserved for large-scale changes, or when the router is processing minimal IPsec traffic.

To clear IPsec SAs, use the clear crypto sa command with appropriate parameters. (Omitting all parameters clears the full SA database, which clears active security sessions.)

What to do next

After you have successfully created a crypto map set, you must apply the crypto map set to each interface through which IPsec traffic flows. To complete this task, see Applying Crypto Map Sets to Interfaces.

Creating Crypto Map Entries to Establish Manual SAs

Perform this task to create crypto map entries to establish manual SAs (that is, when IKE is not used to establish the SAs). To create IPv6 crypto maps entries, you must use the ipv6 keyword with the crypto map command. For IPv4 crypto maps, use the crypto map command without the ipv6 keyword.

Procedure
  Command or Action Purpose

Step 1

enable

Example:
Router> enable

Enables privileged EXEC mode.

  • Enter your password if prompted.

Step 2

configure terminal

Example:
Router# configure terminal

Enters global configuration mode.

Step 3

crypto map [ipv6 ] map-name seq-num [ipsec-manual ]

Example:
Router(config)# crypto map mymap 10 ipsec-manual

Specifies the crypto map entry to be created or modified and enters crypto map configuration mode.

  • For IPv4 crypto maps, use the crypto map command without the ipv6 keyword.

Step 4

match address access-list-id

Example:
Router(config-crypto-m)# match address 102

Names an IPsec access list that determines which traffic should be protected by IPsec and which traffic should not be protected by IPsec in the context of this crypto map entry.

  • The access list can specify only one permit entry when IKE is not used.

Step 5

set peer {hostname | ip-address }

Example:
Router(config-crypto-m)# set peer 10.0.0.5

Specifies the remote IPsec peer. This is the peer to which IPsec protected traffic should be forwarded.

  • Only one peer can be specified when IKE is not used.

Step 6

set transform-set transform-set-name

Example:
Router(config-crypto-m)# set transform-set someset

Specifies which transform set should be used.

  • This must be the same transform set that is specified in the remote peer’s corresponding crypto map entry.

Note

 

Only one transform set can be specified when IKE is not used.

Step 7

Do one of the following: set session-key inbound ah spi hex-key-string or set session-key outbound ah spi hex-key-string

Example:
Router(config-crypto-m)# set session-key inbound ah 256 98765432109876549876543210987654
Router(config-crypto-m)# set session-key outbound ah 256 fedcbafedcbafedcfedcbafedcbafedc

Sets the AH security parameter indexes (SPIs) and keys to apply to inbound and outbound protected traffic if the specified transform set includes the AH protocol.

  • This manually specifies the AH security association to be used with protected traffic.

Step 8

Do one of the following: set session-key inbound ah esp spi cipher hex-key-string [authenticator hex-key-string ] or set session-key outbound ah esp spi cipher hex-key-string [authenticator hex-key-string ]

Example:
Router(config-crypto-m)# set session-key inbound esp 256 cipher 0123456789012345
Router(config-crypto-m)# set session-key outbound esp 256 cipher abcdefabcdefabcd

Sets the Encapsulating Security Payload (ESP) Security Parameter Indexes (SPI) and keys to apply to inbound and outbound protected traffic if the specified transform set includes the ESP protocol.

Or

Specifies the cipher keys if the transform set includes an ESP cipher algorithm. Specifies the authenticator keys if the transform set includes an ESP authenticator algorithm.

  • This manually specifies the ESP security association to be used with protected traffic.

Step 9

exit

Example:
Router(config-crypto-m)# exit

Exits crypto map configuration mode and returns to global configuration mode.

Step 10

exit

Example:
Router(config)# exit

Exits global configuration mode.

Step 11

show crypto map [interface interface | tag map-name ]

Example:
Router# show crypto map

Displays your crypto map configuration.

For manually established SAs, you must clear and reinitialize the SAs for the changes to take effect. To clear IPsec SAs, use the clear crypto sa command with appropriate parameters. (Omitting all parameters clears the entire SA database, which clears active security sessions.)

What to do next

After you have successfully created a crypto map set, you must apply the crypto map set to each interface through which IPsec traffic flows. To complete this task, see Applying Crypto Map Sets to Interfaces.

Applying Crypto Map Sets to Interfaces

You must apply a crypto map set to each interface through which IPsec traffic flows. Applying the crypto map set to an interface instructs the device to evaluate the interface’s traffic against the crypto map set and to use the specified policy during connection or security association negotiation on behalf of traffic to be protected by the crypto map.

Perform this task to apply a crypto map to an interface.

Procedure

  Command or Action Purpose

Step 1

enable

Example:

Router> enable

Enables privileged EXEC mode.

  • Enter your password if prompted.

Step 2

configure terminal

Example:

Router# configure terminal

Enters global configuration mode.

Step 3

interface type/number

Example:

Router# (config)# interface Gi 0/0/1

Configures an interface and enters interface configuration mode.

Step 4

crypto map map-name

Example:

Router(config-if)# crypto map mymap

Applies a crypto map set to an interface.

Step 5

exit

Example:

Router(config-if)# exit

Exits interface configuration mode and returns to global configuration mode.

Step 6

crypto map map-name local-address interface-id

Example:

Router(config)# crypto map mymap local-address loopback0

(Optional) Permits redundant interfaces to share the same crypto map using the same local identity.

Step 7

exit

Example:

Router(config)# exit

(Optional) Exits global configuration mode.

Step 8

show crypto map [interface interface ]

Example:

Router# show crypto map

Displays your crypto map configuration.