Configuring Site To Site IPSec VPN Tunnel Between Cisco Routers
Configuring Site To Site IPSec VPN Tunnel Between Cisco Routers
Configuring Site To Site IPSec VPN Tunnel Between Cisco Routers
Site-to-Site IPSec VPN Tunnels are used to allow the secure transmission of data, voice and video between two sites (e.g
offices or branches). The VPN tunnel is created over the Internet public network and encrypted using a number of
advanced encryption algorithms to provide confidentiality of the data transmitted between the two sites.
This article will show how to setup and configure two Cisco routers to create a permanent secure site-to-site VPN tunnel
over the Internet, using the IP Security (IPSec) protocol. In this article we assume both Cisco routers have a static public
IP address. Readers interested in configuring support for dynamic public IP address endpoint routers can refer to
our Configuring Site to Site IPSec VPN with Dynamic IP Endpoint Cisco Routers article.
IPSec VPN tunnels can also be configured using GRE (Generic Routing Encapsulation) Tunnels with IPsec. GRE tunnels
greatly simply the configuration and administration of VPN tunnels and are covered in our Configuring Point-to-Point GRE
VPN Tunnels article. Lastly, DMVPNs – a new VPN trend that provide major flexibility and almost no administration
overhead can also be examined by reading our Understanding Cisco Dynamic Multipoint VPN (DMVPN), Dynamic
Multipoint VPN (DMVPN) Deployment Models & Architectures and Configuring Cisco Dynamic Multipoint VPN (DMVPN) -
Hub, Spokes , mGRE Protection and Routing - DMVPN Configuration articles.
ISAKMP (Internet Security Association and Key Management Protocol) and IPSec are essential to building and encrypting
the VPN tunnel. ISAKMP, also called IKE (Internet Key Exchange), is the negotiation protocol that allows two hosts to
agree on how to build an IPsec security association. ISAKMP negotiation consists of two phases: Phase 1 and Phase 2.
Phase 1 creates the first tunnel, which protects later ISAKMP negotiation messages. Phase 2 creates the tunnel that
protects data. IPSec then comes into play to encrypt the data using encryption algorithms and provides authentication,
encryption and anti-replay services.
Our example setup is between two branches of a small company, these are Site 1 and Site 2. Both the branch routers
connect to the Internet and have a static IP Address assigned by their ISP as shown on the diagram:
Site 1 is configured with an internal network of 10.10.10.0/24, while Site 2 is configured with network 20.20.20.0/24. The
goal is to securely connect both LAN networks and allow full communication between them, without any restrictions.
CONFIGURE ISAKMP (IKE) - (ISAKMP PHASE 1)
IKE exists only to establish SAs (Security Association) for IPsec. Before it can do this, IKE must negotiate an SA (an
ISAKMP SA) relationship with the peer.
We should note that ISAKMP Phase 1 policy is defined globally. This means that if we have five different remote sites and
configured five different ISAKMP Phase 1 policies (one for each remote router), when our router tries to negotiate a VPN
tunnel with each site it will send all five policies and use the first match that is accepted by both ends.
Next we are going to define a pre shared key for authentication with our peer (R2 router) by using the following command:
The peer’s pre shared key is set to firewallcx and its public IP Address is 1.1.1.2. Every time R1 tries to establish a VPN
tunnel with R2 (1.1.1.2), this pre shared key will be used.
We’ve named our crypto map CMAP. The ipsec-isakmp tag tells the router that this crypto map is an IPsec crypto map.
Although there is only one peer declared in this crypto map (1.1.1.2), it is possible to have multiple peers within a given
crypto map.
Note that you can assign only one crypto map to an interface.
As soon as we apply crypto map on the interface, we receive a message from the router that confirms isakmp is on:
“ISAKMP is ON”.
At this point, we have completed the IPSec VPN configuration on the Site 1 router.
We now move to the Site 2 router to complete the VPN configuration. The settings for Router 2 are identical, with the only
difference being the peer IP Addresses and access lists:
This is easily done by inserting a deny statement at the beginning of the NAT access lists as shown below:
The first icmp echo (ping) received a timeout, but the rest received a reply, as expected. The time required to bring up the
VPN Tunnel is sometimes slightly more than 2 seconds, causing the first ping to timeout.
To verify the VPN Tunnel, use the show crypto session command: