When would you need this: When you want to create a secure tunnel to transfer data between two sites without the use of VPN concentrator or other security devices.
Special Requirements: The routers used must support IPSec. Most of Cisco routers do. Another need is that both sides use a static public IP address to connect to the Internet.
We will go through the steps to be done on one side and the same steps must be repeated on the other side too. The encryption of data will depend on a shared-key. This way, we will not need specialized CAs or RSA methodologies. If you have a hub-and-spoke topology, refer to the note in the bottom.
1. Create Internet Key Exchange (IKE) key policy. The policy used for our case is policy number 9, because this policy requires a pre-shared key.
Router(config)#crypto isakmp policy 9
Router(config-isakmp)#hash md5
Router(config-isakmp)#authentication pre-share
2. Setup the shared key that would be used in the VPN,
Router(config)#crypto isakmp key VPNKEY address XXX.XXX.XXX.XXX
where,
VPNKEY is the shared key that you will use for the VPN, and remember to set the same key on the other end.
XXX.XXX.XXX.XXX the static public IP address of the other end.
3. Now we set lifetime for the IPSec security associations,
Router(config)#crypto ipsec security-association lifetime seconds YYYYY
where YYYYY is the associations lifetime in seconds. It is usually used as 86400, which is one day.
4. Configure an extended access-list to define the traffic that is allowed to be directed through the VPN link,
Router(config)#access-list AAA permit ip SSS.SSS.SSS.SSS WIL.DCA.RDM.ASK DDD.DDD.DDD.DDD WIL.DCA.RDM.ASK
where,
AAA is the access-list number
SSS.SSS.SSS.SSS WIL.DCA.RDM.ASK is the source of the data allowed to use the VPN link.
DDD.DDD.DDD.DDD WIL.DCA.RDM.ASK is the destination of the data that need to pass though the VPN link.
5. Define the transformations set that will be used for this VPN connection,
Router(config)#crypto ipsec transform-set SETNAME BBBB CCCCC
where,
SETNAME is the name of the transformations set. You can choose any name you like.
BBBB and CCCCC is the transformation set. I recommend the use of “esp-3des esp-md5-hmac”. You can also use “esp-3des esp-sha-hmac”. Any one of these two will do the job.
[sniplet adsense]
6. After defining all the previous things, we need to create a cypto-map that associates the access-list to the other site and the transform set.
Router(config)#crypto map MAPNAME PRIORITY ipsec-isakmp
Router(config-crypto-map)#set peer XXX.XXX.XXX.XXX
Router(config-crypto-map)#set transform-set SETNAME
Router(config-crypto-map)#match address AAA
where,
MAPNAME is a name of your choice to the crypto-map
PRIORITY is the priority of this map over other maps to the same destination. If this is your only crypto-map give it any number, for example 10.
XXX.XXX.XXX.XXX the static public IP address of the other end
SETNAME is the name of the transformations set that we configured in step 5
AAA is the number of the access-list that we created to define the traffic in step 4
7. The last step is to bind the crypto-map to the interface that connects the router to the other end.
Router(config-if)#crypto map MAPNAME
where MAPNAME is the name of the crypto-map that we defined in step 6.
Now, repeat these steps on the other end, and remember to use the same key along with the same authentication and transform set.
Note: If you want to implement multiple VPN connections to multiple sites (i.e. Hub-and-Spoke topology), you can do this by repeating the steps 2 to 7 (except step 3) for each VPN connection. The different crypto-maps and their assignments differentiate between the different VPN connections. Use the same map name for all the connections to the same interface, and use different priority for each connection.
For troubleshooting purposes, you can use the following commands,
show crypto isakmp sa
show crypto ipsec sa
show crypto engine connections active
and show crypto map
Read more security tips in the Router Geek Book: Guide to Cisco Routers Configuration
Kjell Inge
November 30th, 2011 at 21:21
Thank for this excellent blog entry. Well written and to the point.
You are assuming both endpoint have static addresses. What if one endpoint use dynamic addresses?
Mohammed Alani
December 1st, 2011 at 13:12
I haven’t got such a situation before. I’ll look into it and get back to you.
Topper
December 13th, 2011 at 18:37
And what about one CISCO router in HQ and few others in branch offices?
In my case I’v got one VPN site-to-site already, but want to make second one to new office?
It is possible, but how to do it?
Null0
December 18th, 2011 at 22:38
You could try DMVPN to remote offices, would give connectivity to your central office and also allow dynamic tunnels between branch offices saving bandwidth at the central site..
Topper
December 13th, 2011 at 19:11
Sorry, miss the Note 🙂
Another crypto map
Naga
December 14th, 2011 at 11:21
What is the meaning of WIL.DCA.RDM.ASK?
Naga
December 14th, 2011 at 11:23
WIL.DCA.RDM.ASK = Wild Card Mask Ok thanks…
Sorry
Tcpip
December 23rd, 2011 at 12:05
Please can you show the configuration for ASA.
Thanks
Sam
December 24th, 2011 at 02:57
Hello,
Well done ofr above writen. Could you check with Hub and Spokes VPN IPSec with 3 Cisco 1841 routers??
I have to ask you to add voice config in other to allow it at defined hours of day.
THANK A LOT FOR N !!!!!!
Sam
whyrywhy
February 28th, 2012 at 02:41
Just curious, I’m trying to implement a hub on a VLAN. When I enter a second crypto map on the interface, the first entry disappears. Is there something I’m missing or is the hub config completely different?
Mohammed Alani
February 28th, 2012 at 21:50
Actually, it is not completely different. I did not clarify in the last note at the end of the article. If you intend to do a hub-and-spoke topology, at the hub end, use the same map name for all connections, just give the different connections different priorities. All the rest remains separate. I mean, each link can have a different password.
I will re-write the note to explain that.
whyrywhy
February 29th, 2012 at 20:58
Thanks again! I did come across the information.
If I can pick your brain some more: I have the tunnel up, and on the ASA side, traffic is being passed, but I’m not sending traffic from the 6509.
There’s no additional route statements that need to be made are there? The access list should encompass that, right?
Thanks again!
Mohammed Alani
March 1st, 2012 at 13:46
Definitely you need to have some sort of routing. Just add a static (or default) route for the traffic at the 6509 end.
Donna
March 4th, 2012 at 04:29
I have a site to site vpn currently set up where one end is dynamic and the other end is static. I want the internet traffic to also be tunneled across to the hub side as the internet will be access past a firewall from within. I am curious how this can be done? I have a default route on the spoke side that points out to the the ISP therefore right now with my access list the vpn works great however the internet acccess is using the default route vs going across the tunnel. Is there somehow this can be done? Looking for suggestions.
Mohammed Alani
March 4th, 2012 at 17:02
Donna,
If you need all the traffic to go towards the hub (as I have understood form your question) you will need to modify the access-list in step 4, such that you replace the DDD.DDD.DDD.DDD address (which is the hub’s destination network now) with “any”. This way, all traffic originating from the source network that you have identified in the access-list will go through the tunnel.
I hope this solves it.
Joe
March 9th, 2012 at 06:08
I’m looking to replace our Point to Point T1’s with a simple business DSL line in our satellite office. They currently have Cisco 1841, which has the ability to VPN. So I’d like to establish a site to site VPN between that device and my Sonicwall. Then hopefully take down the T1 and save a lot of money in the process! Is this easy to do? I’m not too familiar with the VPN process. or if the Sonicwall can be “friends” with the cisco. Thanks in advance 🙂 Great write up
Goodman
March 12th, 2012 at 19:47
I’ve got a hub and spoke situation, where 2851 cisco router is supposed to be installed at the HQ and 1841 cisco routers will be installed in 9 branches doted around the country. Will this config work or i need something special?
please help.
Regards
Muhammed Shafi
April 2nd, 2012 at 09:50
Thank you Mr. Alani
I would like to implement VPN site to site connection in my company. And I am planning to use 1941 router for HO and 881 for 13 branch Office. all branch has almost 5 or 6 users only.. are these routers enough???
What encryption method..
i didnt see any command about that..
#encryption aes or sha or md5
#group 1or 2 or 5
Mohammed Alani
April 2nd, 2012 at 22:38
Do a "show flash" in the routers and check the names of the IOS files, If the IOS file name includes "advsecurity", "spservices","entbase", "advipservices","entservices", or "adventerprise" then they support all the instructions needed to run this procedure.
JPC2012
May 9th, 2012 at 15:19
How to test if successful?
Mohammed Alani
May 10th, 2012 at 18:47
You an ping from the border router to the other end. If you need to check if the source IP address of the ping, issue “debug ip icmp” on one end, and do ping from the other end to this end, to see if the IP addresses are properly operating.
ayush
June 10th, 2012 at 11:10
Does anyone here have any idea how to configure IPSec VPN from site to
> multiple site on Cisco Router? (Like Mesh: 1. SiteA connect to siteB
> and SiteC; 2. SiteB connect to SiteA and SiteC; 3. SiteC connect to
> Site A and SiteB )
Leandro
August 6th, 2012 at 22:31
Need to insert someone static route pointing to my default-gateway link? Thanks!
umair
December 31st, 2012 at 00:26
sir i did all these config on packet tracer and live also but both network are not ping eash other
Danijel
February 24th, 2013 at 09:45
Thnx man. I like the way you explained. It really helps. Cheers! 🙂
Neil
April 3rd, 2013 at 13:58
Excellent article, the sort of template with variables document that are sorely missing on Cisco’s website. Thanks and well done
Naresh Makavana
April 7th, 2013 at 07:39
Excellent work guys… So simple and to the point… Thank you….
Milan
July 20th, 2013 at 03:09
I am trying to set VPN on C2911 for Cisco Jabber, but on the other end isn’t any kind of router that can be modified. It is just plane simple plug-and-play gateway with dynamic address that leads you to internet.
So i am asking is it possible to set this kind of task that i want, and what modifications would be?
Traffic needs to go from my gateway to C2911.
Thank you.
Ory CHHEAN
October 17th, 2014 at 13:10
Dear Sir/Madam,
I am trying to configure VPN site-to-site on Cisco router 1841 series, but cannot.
Please see:
R1#show version
Cisco IOS Software, 1841 Software (C1841-IPBASE-M), Version 12.4(3i), RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2007 by Cisco Systems, Inc.
Compiled Wed 28-Nov-07 18:17 by stshen
ROM: System Bootstrap, Version 12.4(13r)T, RELEASE SOFTWARE (fc1)
R1 uptime is 1 hour, 21 minutes
System returned to ROM by power-on
System image file is “flash:c1841-ipbase-mz.124-3i.bin”
Cisco 1841 (revision 7.0) with 114688K/16384K bytes of memory.
Processor board ID FHK123129VK
2 FastEthernet interfaces
DRAM configuration is 64 bits wide with parity disabled.
191K bytes of NVRAM.
31488K bytes of ATA CompactFlash (Read/Write)
Configuration register is 0x2102
R1#
————————————————————>
When I am attempting to configure VPN, message displayed as below.
R1(config)#crypto ?
% Unrecognized command
R1(config)#crypto
————————————————————>
So what is the solution? Please help.
Thanks for your help.
Mohammed Alani
August 5th, 2015 at 10:59
You are using “ipbase” image which does not support VPN. You will need to upgrade the IOS to a version that supports it.
Gracie
July 7th, 2017 at 12:13
I have a vpn site-site configurations on my router(2911). How do i configure a remote access vpn on the same router without having any issue