-
Notifications
You must be signed in to change notification settings - Fork 1
Configure IPsec VPN
| Step | IKEv1 | IKEv2 | |
|---|---|---|---|
| 1 | IKE (Phase 1) | ISAKMP policy | IKEv2 proposal, policy and profile |
| 2 | IPsec (Phase 2) | Transform set | Transform set |
| 3 | Set authentication detail | Set values for PSK or PKI | Set values for PSK, PKI or AAA |
| Step | Policy-based (Crypto map) |
Route-based (DMVPN & FlexVPN) |
|
|---|---|---|---|
| 4 | Define interesting traffic | Extended ACL | |
| 5 | Consolidate elements | Crypto map referring to step 1, 2 and 4 | IPsec profile referring to step 1 and 2 |
| 6 | Apply to interface | Physical interface | Virtual tunnel interface (VTI) |
| 7 | Hub-and-Spoke | NHRP and Multipoint GRE or Virtual-Template |

-
Configure IKE Phase 1 for ISAKMP SA to establish a management tunnel for both peers.
crypto isakmp policy 10 //"10" is a policy number that smaller is preferred encryption aes //Encryption algorithm authentication pre-share //Authentication based on PSK or cert group 16 //Key-exchange algorithm exit crypto isakmp key cisco123 address 61.232.0.2 //Set a pre-shared key (password) -
Configure IKE Phase 2 for IPsec SA to define how the actual data traffic will be protected.
crypto ipsec transform VPN-ESP-TS esp-aes 256 esp-sha256-hmac tunnel mode //Or set to transport mode -
Define "Interesting Traffic".
ip access-list extend VPN permit ip 172.16.0.0 0.0.0.255 192.168.2.0 0.0.0.255 //The traffic meant to VPNCrucial: These ACLs must be mirrored on each side (Site B’s is permit 192.168.2.0 to 172.16.0.0).
-
Create and bind Crypto Map. (If use VTI, configure an IPsec Profile instead.)
crypto map IPSec-SiteA_to_SiteB isakmp-ipsec set transform VPN-ESP-TS match address list VPN set peer 61.232.0.2 -
Apply crypto map to the outside (public-facing) interface.
interface Ethernet0/0 crypto map CMAP -
(Optional) Exempt VPN traffic from NAT
As NAT is happened before IPsec, the source IP of the traffic initiated from internal subnet will be translated to the outbound public IP, which causes a mismatch with the configured match address (VPN interested traffic) and no IPsec encryption will happen.-
Exclude VPN traffic from the NAT translation in the router Site-A;

-
Also, exclude VPN traffic from the router Site-B;

-
Configuring stateful failover for IPsec VPN on a Cisco ASA (Adaptive Security Appliance) ensures that VPN connections remain active when a failover occurs between primary and secondary ASAs in an Active/Standby High Availability (HA) setup.
Before enabling stateful IPsec failover, you must have a working Active/Standby failover setup. If you haven’t configured failover yet, follow these steps:
On the Primary ASA:
failover
failover lan unit primary
failover lan interface FAILOVER GigabitEthernet0/1
failover link STATE GigabitEthernet0/2
failover interface ip FAILOVER 192.168.1.1 255.255.255.0 standby 192.168.1.2
failover interface ip STATE 192.168.2.1 255.255.255.0 standby 192.168.2.2
On the Secondary ASA:
failover
failover lan unit secondary
failover lan interface FAILOVER GigabitEthernet0/1
failover link STATE GigabitEthernet0/2
failover interface ip FAILOVER 192.168.1.2 255.255.255.0 standby 192.168.1.1
failover interface ip STATE 192.168.2.2 255.255.255.0 standby 192.168.2.1
Make sure to connect the failover and stateful failover interfaces.
To ensure VPN session persistence, enable stateful failover:
failover replication http
failover replication enable
failover stateful failover
To ensure that IPsec SAs, ISAKMP SAs, and IKEv2 sessions fail over seamlessly:
crypto ikev1 enable failover
crypto ikev2 enable failover
failover stateful-sync enable
Explanation:
crypto ikev1 enable failover→ Synchronizes IKEv1 sessionscrypto ikev2 enable failover→ Synchronizes IKEv2 sessionsfailover stateful-sync enable→ Enables replication of VPN state information
To check if VPN sessions and failover settings are synchronized:
show failover state
show failover
show vpn-sessiondb detail
show crypto isakmp sa
show crypto ikev2 sa
-
Establish a VPN connection (e.g., from a remote site or AnyConnect client).
-
Manually trigger a failover:
failover active -
Verify that the VPN session remains active:
show vpn-sessiondb
If configured correctly, IPsec VPN sessions should persist without disconnecting when failover occurs.
-
Failover must be stateful (
failover stateful failover). -
Enable replication for IKEv1 and IKEv2 sessions (
crypto ikev1 enable failoverandcrypto ikev2 enable failover). - Test failover to ensure VPN session persistence.