Cisco IPsec VPN configuration: IKEv2 VTI example for IOS XE
A copy-pasteable IKEv2 VTI configuration for a Cisco ISR, CSR 1000v or Catalyst 8000 connecting a branch office to an IPsec VPN server, with the show commands to prove it works.
The short answer
A current Cisco IPsec VPN configuration on IOS XE uses IKEv2 and a virtual tunnel interface (VTI). You build it in five pieces: an IKEv2 proposal and policy, a keyring with the pre-shared key, an IKEv2 profile, an IPsec transform set and profile, and a Tunnel interface protected by that profile. A static route then sends the remote networks into the tunnel. No crypto ACL, no crypto map.
This guide gives a complete, copy-pasteable example for Cisco IOS XE 17.x on an ISR 1000/4000, a CSR 1000v or a Catalyst 8000 (physical or 8000V). The router is a branch office that connects to an IPsec VPN server. If you want the background first, read IKEv1 or IKEv2 and what IPsec is.
The example network and the values that must match
The branch router has the public address 198.51.100.20 on GigabitEthernet1 and the LAN 192.168.10.0/24 on GigabitEthernet2. The VPN server is at 203.0.113.10 with 10.10.0.0/16 behind it. The tunnel interfaces use a /30 from the link-local range.
Every value in this table must be the same on both sides, or the mirror image of it (local on one side is remote on the other):
| Setting | Cisco router (branch) | VPN server |
|---|---|---|
| Public IP / IKE identity | 198.51.100.20 | 203.0.113.10 |
| Networks behind it | 192.168.10.0/24 | 10.10.0.0/16 |
| Tunnel inside address | 169.254.100.2/30 | 169.254.100.1/30 |
| IKE version | IKEv2 | IKEv2 |
| IKE proposal | AES-256-GCM, PRF SHA-256, DH group 20 (ECP-384) | AES-256-GCM, PRF SHA-256, DH group 20 (ECP-384) |
| ESP proposal | AES-256-GCM, PFS group 20 | AES-256-GCM, PFS group 20 |
| Lifetimes | IKE SA 28800 s, child SA 3600 s | IKE SA 28800 s, child SA 3600 s |
| Authentication | Pre-shared key | Pre-shared key |
| Traffic selectors | 0.0.0.0/0 to 0.0.0.0/0 (route-based) | 0.0.0.0/0 to 0.0.0.0/0 (route-based) |
| Dead peer detection | On | On |
The traffic selector row matters more than people expect. A Cisco VTI negotiates 0.0.0.0/0 on both sides by default, so the server must be configured as a route-based (VTI) tunnel as well. If the other side insists on specific subnets, use the policy-based variant further down.
Use a long random pre-shared key (32 characters or more, generated, not typed) and never reuse it between tunnels. Replace the pre-shared-key placeholder below with the same key on both sides.
Full example configuration for Cisco IOS XE
Enter these blocks in configuration mode, in this order. Names such as PROP-HUB are only labels; rename them if your naming convention differs, but keep the references consistent.
1. IKEv2 proposal and policy
The proposal lists the algorithms for the IKE SA. With an AEAD cipher such as AES-GCM there is no separate integrity algorithm, so IOS XE requires an explicit prf statement instead of integrity. Leave it out and the proposal is incomplete and is not used.
! Example configuration for a Cisco IOS XE 17.x router (branch side)
! --- IKEv2 proposal and policy ---
crypto ikev2 proposal PROP-HUB
encryption aes-gcm-256
prf sha256
group 20
!
crypto ikev2 policy POL-HUB
match address local 198.51.100.20
proposal PROP-HUB
2. Keyring and IKEv2 profile
The keyring holds the pre-shared key for the server. The IKEv2 profile ties together who the peer is, how both sides authenticate, the IKE SA lifetime and dead peer detection. dpd 10 3 periodic sends a liveness check every 10 seconds and retries every 3 seconds when there is no answer.
! --- Keyring and IKEv2 profile ---
crypto ikev2 keyring KR-HUB
peer VPN-SERVER
address 203.0.113.10
pre-shared-key
!
crypto ikev2 profile IKEV2-HUB
match identity remote address 203.0.113.10 255.255.255.255
identity local address 198.51.100.20
authentication remote pre-share
authentication local pre-share
keyring local KR-HUB
lifetime 28800
dpd 10 3 periodic
3. IPsec transform set and IPsec profile
The transform set defines ESP. esp-gcm 256 is AES-256-GCM with built-in integrity, so no esp-sha256-hmac is added. The IPsec profile adds PFS, the child SA lifetime and the link to the IKEv2 profile.
! --- IPsec transform set and profile ---
crypto ipsec transform-set TS-HUB esp-gcm 256
mode tunnel
!
crypto ipsec profile IPSEC-HUB
set transform-set TS-HUB
set pfs group20
set security-association lifetime seconds 3600
set ikev2-profile IKEV2-HUB
4. Tunnel interface
The tunnel interface is where encryption happens: anything routed into Tunnel10 is encrypted and sent to 203.0.113.10. The ip mtu and ip tcp adjust-mss lines prevent fragmentation problems; more on that under common problems.
! --- Tunnel interface (VTI) ---
interface Tunnel10
description IPsec to VPN server 203.0.113.10
ip address 169.254.100.2 255.255.255.252
ip mtu 1400
ip tcp adjust-mss 1360
tunnel source GigabitEthernet1
tunnel mode ipsec ipv4
tunnel destination 203.0.113.10
tunnel protection ipsec profile IPSEC-HUB
5. Routing
A static route sends the server-side networks into the tunnel. If you run BGP or OSPF over the tunnel instead, peer with 169.254.100.1 and skip the static route.
! --- Routing ---
ip route 10.10.0.0 255.255.0.0 Tunnel10
6. NAT and interface ACLs
Most branch routers also do PAT for internet access, with ip nat outside on GigabitEthernet1. With a VTI you do not need a NAT exemption: traffic to 10.10.0.0/16 is routed out of Tunnel10, which is not a NAT outside interface, so it is never translated. Do not put ip nat outside on the tunnel.
If GigabitEthernet1 has an inbound ACL, it must allow UDP 500 and UDP 4500 from 203.0.113.10, and ESP (IP protocol 50) if there is no NAT between the peers:
! --- Lines to add to an existing inbound ACL on the outside interface ---
ip access-list extended OUTSIDE-IN
permit udp host 203.0.113.10 host 198.51.100.20 eq isakmp
permit udp host 203.0.113.10 host 198.51.100.20 eq non500-isakmp
permit esp host 203.0.113.10 host 198.51.100.20
Finish with end and write memory. The tunnel comes up when traffic or DPD triggers it; a ping from the LAN is the quickest way.
Policy-based variant with a crypto map
Some VPN servers and older firewalls only do policy-based IPsec, where the tunnel carries exactly the subnet pairs in the configuration. On IOS XE that is a crypto map with a crypto ACL. You can keep the proposal, policy, keyring, IKEv2 profile and transform set from above and replace steps 4 and 5 with this:
! Example configuration: policy-based (crypto map) variant
ip access-list extended VPN-HUB
permit ip 192.168.10.0 0.0.0.255 10.10.0.0 0.0.255.255
!
crypto map CMAP-HUB 10 ipsec-isakmp
set peer 203.0.113.10
set transform-set TS-HUB
set pfs group20
set security-association lifetime seconds 3600
set ikev2-profile IKEV2-HUB
match address VPN-HUB
!
interface GigabitEthernet1
crypto map CMAP-HUB
!
! NAT exemption: deny VPN traffic before the PAT permit
ip access-list extended NAT-PAT
deny ip 192.168.10.0 0.0.0.255 10.10.0.0 0.0.255.255
permit ip 192.168.10.0 0.0.0.255 any
!
ip nat inside source list NAT-PAT interface GigabitEthernet1 overload
Here the NAT exemption is required. NAT runs before encryption, so without the deny line the traffic is translated to 198.51.100.20, no longer matches VPN-HUB and leaves unencrypted. The crypto ACL must also be the exact mirror of the subnets on the server. For new tunnels, prefer the VTI: one interface per peer, plain routing, and no ACL to keep in sync. The article on IPsec VPN configuration examples compares both models across vendors.
Verify the tunnel
Generate some traffic first, for example ping 10.10.0.1 source GigabitEthernet2 (use an address that answers on the server side). Then check each layer from the bottom up:
show crypto ikev2 sa
show crypto ikev2 sa detailed
show crypto ipsec sa peer 203.0.113.10
show crypto session remote 203.0.113.10
show interfaces Tunnel10
show ip route 10.10.0.0
show crypto ikev2 sa: one entry with local 198.51.100.20/500 and remote 203.0.113.10/500 (or 4500 with NAT), statusREADY. Thedetailedform shows the negotiatedEncr: AES-GCM, keysize: 256, PRF: SHA256, DH group 20 and the 28800-second lifetime.show crypto ipsec sa: local and remote ident0.0.0.0/0/0/0for the VTI, an inbound and an outbound ESP SA withesp-gcm 256, statusACTIVE, and#pkts encapsand#pkts decapsboth increasing as you ping. Encaps rising while decaps stays at zero means your packets leave but nothing comes back: look at the server side and at routing there.show crypto session:Session status: UP-ACTIVE.show interfaces Tunnel10:line protocol is up. A VTI only goes up once the IPsec SA exists.show ip route 10.10.0.0: the static route viaTunnel10.
When the tunnel does not come up at all, debug crypto ikev2 (with terminal monitor) shows the negotiation. Turn it off with undebug all as soon as you have what you need. The IPsec troubleshooting guide walks through reading the output.
Common problems
Proposal mismatch
The debug shows NO_PROPOSAL_CHOSEN during IKE_SA_INIT (IKE proposal) or IKE_AUTH (ESP proposal). Compare the table above with the server, value by value. Typical causes: the server offers AES-CBC with SHA-256 integrity while the router only offers GCM; DH group 14 on one side and 20 on the other; PFS enabled on only one side. On IOS XE, also check that the proposal has its prf line. If you add a second proposal to the policy, the order matters: the initiator lists them in order of preference.
Identity or key mismatch
AUTHENTICATION_FAILED means the pre-shared key differs, or one side does not recognise the identity the other sent. The router sends its IP address as its identity; the server must expect 198.51.100.20 as the remote ID, and the router expects 203.0.113.10 (match identity remote address). If the server is configured with an FQDN or a different ID, change identity local and match identity remote to match.
NAT in front of the router
If the router sits behind another device that translates its address, IKEv2 detects the NAT and moves to UDP 4500 automatically. Two things then need attention: the upstream device must forward UDP 500 and 4500 to the router, and the router's identity is still its private address unless you set identity local address 198.51.100.20 (as in the example) so it matches what the server expects.
MTU and MSS
Symptoms: ping works, SSH works, but web pages, file copies or RDP sessions stall. Encryption adds an ESP header, an IV, padding and a new IP header, so full-size 1500-byte packets no longer fit. The fix on IOS XE is MSS clamping on the tunnel interface:
interface Tunnel10
ip mtu 1400
ip tcp adjust-mss 1360
1360 bytes leaves room for the IPsec overhead plus NAT-T. If traffic also crosses PPPoE or another tunnel on the way, lower both values further.
The tunnel is up but traffic does not flow
Check routing on both sides (the server needs a route to 192.168.10.0/24 through its tunnel interface), any firewall rules on the server, and that hosts in 192.168.10.0/24 use this router as their gateway.
Running the server side
The other end of this Cisco IPsec VPN configuration can be any standards-based IKEv2 peer. If you run it on TunnelYard, each customer gets a dedicated IPsec server with its own static public IP, policy-based tunnels (use the crypto-map variant above, with AES-CBC rather than AES-GCM), and a guided tunnel setup with a Cisco preset that exports a matching peer configuration for you to review and apply. Live tunnel status and per-tunnel logs help when one of the problems above shows up. See the features and one static IP for every branch.