IPSEC tunnels with crypto maps

IPSEC = Black magic?

IPSEC tunnels may seem like some kind of black magic that firewalls just happen to figure out how they work. Especially when you start looking at IPSEC configuration at cli level. I expect the topic to come up at the CCIE lab and probably with several twists and definitely some DMVPN as well.


IKE = Internet Key Exchange, protocol used to set up a Seurity Association (SA).

ISAKMP = Internet Security Association and Key Management Protocol, is apart of IKE and is a protocol framework that defines mechanics for authentication and key exchange. Confusingly vendors uses the terms isakmp and ike phase 1 interchangebly, probably becuase the only implementation of IKE in Cisco routers is with isakmp.

IKE Phase 1 = Authenticates the IPSEC peers and sets up a secure IKE Security Association(SA) and sets up a secure channel for next phase.

IKE Phase 2 = Negotiates the IPSEC SA parameters configured in each end and sets up same IPSEC SA’s on each device. For Cisco devices one SA is negotiated per entry in the Crypto ACL.

Tunnel mode = Encapsulates the whole IP packet into a new one with new source/destination addresses.

Transport Mode = Keeps the original IP-header and encrypts only the payload. This ofcourse consumes less overhead.

Diffie-Hellman = Or “DH Group” is a technique used to generate a shared secret between to parties, this is done in a way where the secrets would never be sent or transferred but created with the remote peer. This enables two routers to together create a new key and then use this key to encrypt traffic and therefore, the key will never be exposed even if traffic gets recorded there is no way to figure out what was sent. When Diffie Hellman is used even in the phase2 that is what we call PFS or perfect forward secrecy.

Configuration steps

The steps needed to configure an IPSEC tunnel in Cisco IOS are:

  1. Configure a matching isakmp policy including;
    1. Hash – MD5 or SHA
    2. Authentication – pre-shared key or RSA
    3. DH group – which Diffie Hellman group to use.
    4. Lifetime
    5. Encryption – AES/DES/3DES
  2. If pre-shared key is used – configure a key for the peer.
  3. Transform-set – Tells the router how which crypto to use for phase 2
  4. ACL to match traffic to be encrypted – I’ll come back to this!
  5. Configure a Crypto Map containing;
    1. Peer
    2. Transform-set to use
    3. Which ACL to use.
  6. Apply the Crypto map to the outgoing interface.

I tried to show the configuration and what to match in the picture here:


Back to the step 4, “ACL to match traffic to be encrypted”.
The ACL used in the crypto map is used to match which traffic to encrypt. It has to match the opposite ends crypto map where each entry states one SA. The ACL shall not be an exact copy – it has to be a mirrored acl in the other side, matching the local networks in the direction towards the other end via the tunnel. 

For example with the tipology above:

SiteA has on its side and on the SiteB the network resides.

SiteA’s Crypto map ACL would look like:
permit ip
( ->

And the other side would have the opposite in its crypt map ACL:
permit ip
( ->

Leave a Reply

Your email address will not be published. Required fields are marked *