CCIE or Null!

My journey to CCIE!

Posts Tagged ‘Cisco IPSec VPN

Verifying IPSec tunnels.

with 2 comments

I know my last few posts have been focused on either how IPSec functions or the configuration so now that we know how to configure IPSec how can we make sure our IPSec VPN is up, functional, and passing traffic? Well there are a few different commands we can issue to check on the status or our IPSec VPN:

Show crypto isakmp sa

This command will tell us the status of our negotiations, here are some of the common ISAKMP SA status’

The following four modes are found in IKE main mode

  • MM_NO_STATE* – ISAKMP SA process has started but has not continued to form (typically due to a connectivity issue with the peer)
  • MM_SA_SETUP* – Both peers agree on ISAKMP SA parameters and will move along the process
  • MM_KEY_EXCH* – Both peers exchange their DH keys and are generating their secret keys. (This state could also mean there is a mis-matched authentication type or PSK, if it does not proceed to the next step)
  • MM_KEY_AUTH* – ISAKMP SA’s have been authenticated in main mode and will proceed to QM_IDLE immediately.

The following three modes are found in IKE aggressive mode

  • AG_NO_STATE** – ISAKMP SA process has started but has not continued to form (typically do to a connectivity issue with the peer)
  • AG_INIT_EXCH** – Peers have exchanged their first set of packets in aggressive mode, but have not authenticated yet.
  • AG_AUTH** – ISAKMP SA’s have been authenticated in aggressive mode and will proceed to QM_IDLE immediately.

The following mode is found in IKE Quick Mode, phase 2

  • QM_IDLE*** – The ISAKMP SA is idle and authenticated
Here are a few more commands we can issue to get a quick glimpse of the status of any IPSec VPN’s.

  • sh crypto ipsec sa – Now this output can really daunting at first just due to the amount of information that is displayed here but there are a few key things to watch out for. Such as the #pkts encaps/encrypt/decap/decrypt, these numbers tell us how many packets have actually traversed the IPSec tunnel and also verifies we are receiving traffic back from the remote end of the VPN tunnel. This will also tell us the local and remote SPI, transform-set, DH group, & the tunnel mode for IPSec SA.

  • sh crypto session – This command will give you a quick list of all IKE and IPSec SA sessions.

Some of the common session statuses are as follows:

  • Up-Active – IPSec SA is up/active and transferring data.
  • Up-IDLE – IPSsc SA is up, but there is not data going over the tunnel
  • Up-No-IKE – This occurs when one end of the VPN tunnel terminates the IPSec VPN and the remote end attempts to keep using the original SPI, this can be avoided by issuing crypto isakmp invalid-spi-recovery
  • Down-Negotiating – The tunnel is down but still negotiating parameters to complete the tunnel.
  • Down – The VPN tunnel is down.

So using the commands mentioned above you can easily verify whether or not an IPSec tunnel is active, down, or still negotiating. Next up we will look at debugging and troubleshooting IPSec VPNs

* – Found in IKE phase I main mode

** – Found in IKE phase I aggressive mode

*** – Found in IKE phase II quick mode


Written by Stephen J. Occhiogrosso

April 30, 2012 at 6:07 AM

IPSec on a Cisco IOS router.

leave a comment »

In my previous post I covered some basics on IKE and the process on which IPSec VPN’s form and negotiate their secure connection. So now I figured I’d continue that trend and cover the configuration of an IPSec VPN between 2 Cisco IOS routers.

So let’s check out a large portion of the configuration right here:

IKE Phase 1 and Phase 2 configuration with PSK authentication.

This configuration snippet (the first 3 lines) includes the ISAKMP policy used in phase 1 negotiations, which specifies the encryption, hash, & authentication method. I also want to mention you can have multiple ISAKMP polices on the same router, the thing to remember is the ISAKMP policies will be negoatiated from the top down. So the first ISAKMP policy that matches the peer’s ISAKMP profile with the lowest sequence number is the policy that will be used. Which means it is best practice to place the more secure ISAKMP policies at the beginning of your policy, to ensure they get used over a weaker policy.

Pre-shared key IPSec authentication

Right after the ISAKMP policy we have our PSK used to authenticate the specific peer. You can specify the address 0.0.0.0 0.0.0.0 to use the same key for all IPSec negotiations. So you would not need to specify a PSK for every particular peer.

Transform Set

Next we have our transform-set which provides us with our encryption options for phase 2 negotiations. Within the transform-set is were we can specify the encapsulation mode (tunnel or transport). Similar to the ISAKMP policy we can configure multiple transform-sets with completely different parameters in each one.

Crypto Map

Now the Crypto Map is where we tie in a lot of these parameters and start linking it to the peer. The first thing we set is the peer’s address, and then we will specify the transform-set that will be used with this particular connection. I want to mention we can configure multiple transform-sets for a single peer and during the negotiations a matching transform-set will be used. The last thing in this crypto-map is the match address 100 this is where we specify what traffic gets encrypted, this is known as interesting traffic. This matches to an ACL.

So all traffic that goes between the 192.168.1.0/24 and the 192.168.2.0/24 network will get encrypted.

Now the last thing we need to do is apply that crypto map to physical interface.

Now we can only have a single crypto map applied to a physical interface, so the next question is how do we configure multiple VPNs to terminate to a single router? Well we configure multiple entries using the same crypto map, we do this by using a different sequence number for each peer.

So from the above screen shot the sequence number after the crypto map is different, these sequence numbers can go from 1 – 65355 so you have more then enough sequence numbers to terminate multiple IPSec VPNs to a router. Of course you will never want to terminate 65355’s VPNs to a single due to performance.

The next thing I want to mention is how to configure a single crypto map to form VPNs using main mode or aggressive mode. This might sounds tricky at first since you can only have a single crypto map assigned to a single interface but it’s really pretty simple, all you have to do is use the same name you used for the existing crypto map.

So to recap the pieces we need to create a policy based IPSec VPN

  1. The ISAKMP Policy
  2. The Transforms-Set
  3. The Pre-shared key
  4. The Crypto Map
  5. Access-list

Written by Stephen J. Occhiogrosso

April 9, 2012 at 8:33 AM

%d bloggers like this: