Cisco Router – Configure Site to Site IPSEC VPN


KB ID 0000933 Dtd 01/04/14


I've done thousands of firewall VPN's but not many that terminate on Cisco Routers. It's been a few years since I did one, and then I think I was a wuss and used the SDM. So when I was asked to do one last week thankfully I had the configs ready to go.

Router Site to Site VPN

I'm going to use the IP addresses above, and my tunnel will use the following settings;

  • Encryption: AES.
  • Hashing: SHA.
  • Diffie Hellman: Group 2.
  • PFS: Enabled.
  • Authentication method: Pre-Shared Key.


1. Setup a policy for phase 1 of the tunnel (ISAKMP).

R1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#crypto isakmp policy 1
R1(config-isakmp)#encr aes
R1(config-isakmp)#hash sha
R1(config-isakmp)#authentication pre-share
R1(config-isakmp)#group 2
R1(config-isakmp)#lifetime 86400
R1(config-isakmp)#crypto isakmp key SecretK3y address

2. Setup an ACL to define what traffic will be encrypted, and a 'Transform set' that will dictate the encryption and hashing for phase 2 (IPSEC).

R1(config)#ip access-list extended VPN-ACL
R1(config-ext-nacl)#permit ip
R1(config-ext-nacl)#crypto ipsec transform-set VPN-TS esp-aes esp-sha-hmac

3. Create a 'Crypto map' that is used to apply the phase 2 settings to an interface.

R1(config)#crypto map VPN-C-MAP 10 ipsec-isakmp
% NOTE: This new crypto map will remain disabled until a peer
and a valid access list have been configured.
R1(config-crypto-map)#set peer
R1(config-crypto-map)#set transform-set VPN-TS
R1(config-crypto-map)#match address VPN-ACL

4. Apply that crypto map to an interface, (usually the Internet facing one).

R1(config-crypto-map)#interface Serial0/1/0
R1(config-if)#crypto map VPN-C-MAP
*Jan 3 07:16:26.785: %CRYPTO-6-ISAKMP_ON_OFF: ISAKMP is ON

5. In most cases your router will be doing NAT, if so you will need to change the ACL that is looking after the NAT for you, look in your running config for something that looks like the following;

R1#show run
Building configuration...

Current configuration : 1249 bytes
------------output removed for the sake of space------------

ip nat inside source list 100 interface Serial0/1/0 overload
access-list 100 permit ip any

------------output removed for the sake of space------------
line aux 0

6. To stop our VPN traffic getting NATTED, we need to put a deny in that ACL, and put it before that permit statement. Remember:

  • Permit=Perform NAT
  • Deny=Don't perform NAT

On this router (unlike the ASA's that I'm more used to), there is no option to define an ACL line number. So its easier to remove the existing one, add the new line then put the original one back. Finally save the changes.

R1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#no access-list 100 permit ip any
R1(config)#access-list 100 deny ip
R1(config)#access-list 100 permit ip any
%SYS-5-CONFIG_I: Configured from console by console

R1#write mem
Building configuration...

7. Now at the other site, the config should be a mirror image. I will post it in its entirety, so you can copy and paste it into the router, I will highlight the bits you need to check and change in red.

crypto isakmp policy 1
encr aes
hash sha
authentication pre-share
group 2
lifetime 86400
crypto isakmp key SecretK3y address
ip access-list extended VPN-ACL
permit ip
crypto ipsec transform-set VPN-TS esp-aes esp-sha-hmac

crypto map VPN-C-MAP 10 ipsec-isakmp
set peer
set transform-set VPN-TS
match address VPN-ACL
interface Serial0/1/0
crypto map VPN-C-MAP

no access-list 100 permit ip any
access-list 100 deny ip
access-list 100 permit ip any

8. Test your VPN with the following commands. Note: you need to send some traffic over the VPN before it will establish!

show crypto isakmp sa
show crypto ipsec sa

Related Articles, References, Credits, or External Links


Author: Migrated

Share This Post On