IPSec VPN is a security feature that allow you to create secure communication link (also called VPN Tunnel) between two different networks located at different sites. Cisco IOS routers can be used to setup VPN tunnel between two sites. Traffic like data, voice, video, etc. can be securely transmitted through the VPN tunnel. In this post, I will show steps to Configure Site to Site IPSec VPN Tunnel in Cisco IOS Router.

Diagram below shows our simple scenario. The two sites have static public IP address as shown in the diagram. R1 is configured with and R2 is configured with IP address. As of now, both routers have very basic setup like, IP addresses, NAT Overload, default route, hostnames, SSH logins, etc.

There are two phases in IPSec configuration called Phase 1 and Phase 2. Let’s start the configuration with R1. Before you start configuring the IPSec VPN, make sure both routers can reach each other. I have already verified that both routers can ping each other so let’s start the VPN configuration.

Step 1. Configuring IPSec Phase 1 (ISAKMP Policy)

Here is the details of each commands used above:

  • crypto isakmp policy 5– This command creates ISAKMP policy number 5. You can create multiple policies, for example 7, 8, 9 with different configuration. Routers participating in Phase 1 negotiation tries to match a ISAKMP policy matching against the list of policies one by one. If any policy is matched, the IPSec negotiation moves to Phase 2.
  • hash sha– SHA algorithm will be used.
  • authentication pre-share– Authentication method is pre-shared key.
  • group 2– Diffie-Hellman group to be used is group 2.
  • encryption 3des– 3DES encryption algorithm will be used for Phase 1.
  • lifetime 86400– Phase 1 lifetime is 86400 seconds.
  • crypto isakmp key cisco@123 address– The Phase 1 password is cisco@123 and remote peer IP address is

Step 2. Configuring IPSec Phase 2 (Transform Set)

Here is the detail of command used above,

  • crypto ipsec transform-set MY-SET– Creates transform-set called MY-SET
  • esp-aes– AES encryption method and ESP IPSec protocol will be used.
  • esp-md5-hmac– MD5 hashing algorithm will be used.
  • crypto ipsec security-association lifetime seconds– This is the amount to time that the phase 2 session exists before re-negotiation.

Step 3. Configuring Extended ACL for interesting traffic.

This ACL defines the interesting traffic that needs to go through the VPN tunnel. Here, traffic originating from network to network will go via VPN tunnel. This ACL will be used in Step 4 in Crypto Map.

Step 4. Configure Crypto Map.

Here is the detail of command used above:

  • crypto map IPSEC-STE-TO-STE-VPN 10 ipsec-isakmp– Creates new crypto map with sequence number 10. You can create more sequence numbers with same crypto map name if you have multiple sites.
  • match address VPN-TRAFFIC– Its matches interesting traffic from ACL named VPN-TRAFFIC.
  • set peer– This is public IP address of R2.
  • set transform-set MY-SET– This links the transform-set in this crypto map configuration.

Step 5.  Apply Crypto Map to outgoing interface of R1.

Step 6. Exclude VPN traffic from NAT Overload.

Above ACL 101 will exclude interesting traffic from NAT.

Now, repeat same steps in R2.

Step 1. Configuring IPSec Phase 1 (ISAKMP Policy).


Step 2. Configuring IPSec Phase 2 (Transform Set)

Step 3. Configuring Extended ACL for interesting traffic.

Step 4. Configure Crypto Map.

Step 5. Apply Crypto Map to outgoing interface

Step 6. Exclude VPN traffic from NAT Overload.


Verification and testing.

To test the VPN connection let’s ping from R1 to PC2.


As you can see, the ping from R1 to PC2 is successful. Don’t forget to ping from inside IP address while testing the VPN tunnel from the router. You can also ping from PC1 to PC2.

To verify the IPSec Phase 1 connection, type show crypto isakmp sa as shown below.