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.

Cisco IOS XE198.51.100.20IPsec VPN server203.0.113.10IOS XE 17 · examplecrypto ikev2 proposal PROP-HUB encryption aes-gcm-256 prf sha256interface Tunnel10 tunnel protection ipsec profile IPSEC-HUB

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):

SettingCisco router (branch)VPN server
Public IP / IKE identity198.51.100.20203.0.113.10
Networks behind it192.168.10.0/2410.10.0.0/16
Tunnel inside address169.254.100.2/30169.254.100.1/30
IKE versionIKEv2IKEv2
IKE proposalAES-256-GCM, PRF SHA-256, DH group 20 (ECP-384)AES-256-GCM, PRF SHA-256, DH group 20 (ECP-384)
ESP proposalAES-256-GCM, PFS group 20AES-256-GCM, PFS group 20
LifetimesIKE SA 28800 s, child SA 3600 sIKE SA 28800 s, child SA 3600 s
AuthenticationPre-shared keyPre-shared key
Traffic selectors0.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 detectionOnOn

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), status READY. The detailed form shows the negotiated Encr: AES-GCM, keysize: 256, PRF: SHA256, DH group 20 and the 28800-second lifetime.
  • show crypto ipsec sa: local and remote ident 0.0.0.0/0/0/0 for the VTI, an inbound and an outbound ESP SA with esp-gcm 256, status ACTIVE, and #pkts encaps and #pkts decaps both 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 via Tunnel10.

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.

FAQ

Cisco IPsec VPN on IOS XE: common questions

Why does a Cisco IKEv2 proposal with AES-GCM need a prf line?

AES-GCM is an AEAD cipher with built-in integrity, so the proposal has no integrity statement. IOS XE then requires an explicit prf statement, such as prf sha256, alongside encryption aes-gcm-256 and group 20. Without it the IKEv2 proposal is incomplete and is not used, which typically shows up as NO_PROPOSAL_CHOSEN during IKE_SA_INIT.

Do I need a crypto map for a Cisco IKEv2 VTI tunnel?

No. A route-based tunnel on IOS XE uses a Tunnel interface with tunnel mode ipsec ipv4 and tunnel protection ipsec profile, plus a static route into it. There is no crypto ACL and no crypto map. You only need a crypto map for the policy-based variant, when the peer insists on specific subnets. The IPsec configuration examples compare both models.

Do I need a NAT exemption for an IPsec VTI on Cisco IOS XE?

No. Traffic to the remote networks is routed out of the tunnel interface, which is not a NAT outside interface, so PAT on GigabitEthernet1 never translates it. Do not put ip nat outside on the tunnel. The policy-based crypto map variant is different: NAT runs before encryption, so a deny line for the VPN subnets must come first in the PAT ACL.

How do I check that a Cisco IKEv2 IPsec tunnel is up?

Generate traffic first, then run show crypto ikev2 sa (status READY), show crypto ipsec sa peer (ESP SAs ACTIVE with #pkts encaps and #pkts decaps both rising) and show crypto session (UP-ACTIVE). show interfaces Tunnel10 should show line protocol up. Encaps rising while decaps stays at zero means packets leave but nothing comes back from the server.

What ip tcp adjust-mss value should I use on a Cisco IPsec tunnel?

The example uses ip mtu 1400 and ip tcp adjust-mss 1360 on the tunnel interface. 1360 bytes leaves room for the ESP header, IV, padding, a new IP header and NAT-T. If traffic also crosses PPPoE or another tunnel, lower both values further. Typical symptoms of a missing clamp: ping and SSH work, but web pages, file copies or RDP sessions stall.

Why does IKEv2 authentication fail on a Cisco router behind NAT?

Behind NAT, the router's IKE identity defaults to its private address, while the server expects the public one, so you get AUTHENTICATION_FAILED. Set identity local address 198.51.100.20 in the IKEv2 profile so the identity matches. The upstream device must also forward UDP 500 and 4500; IKEv2 detects the NAT and moves to UDP 4500 automatically. More in IPsec troubleshooting.