IKE identities

Tell the peer who you are

Lesson 6 of 20 · 11 min · Module 2: Who is on the other end

A gateway does not only present a key. It also presents a name, and the other side looks that name up to decide which key and which tunnel apply.

Start this lesson →

Free. No installation: you write and run the code in your browser, and it is checked automatically.

By the end, you’ll be able to…

  • Explain what the local and the remote identity are for
  • Say why an address is a poor identity behind NAT
  • Configure name identities on a tunnel

The idea

Each gateway sends an identity in IKE_AUTH. By default it is the gateway's own address. That stops working when the address the gateway has is not the address the peer sees, which is the case behind NAT, and when the address can change. A name such as hq.example.com stays the same in both situations.

id local gw1.example.net
id remote gw2.example.net

01An identity is a label, not a route

The identity only has to match what the other administrator configured. It can be an address, a domain name, or an email-style name. It does not need to resolve in DNS; it is compared as text.

02Why the default breaks behind NAT

This gateway has the private address 192.168.100.2 and reaches the internet through a NAT device. By default it would present 192.168.100.2 as its identity, while the branch knows it under a different one. Setting the identity explicitly on both sides removes the dependency on addresses.

03Identities on real devices

Both directions are configured: who am I, and whom do I expect.

# FortiGate
config vpn ipsec phase1-interface
    edit "to-branch"
        set localid "hq.example.com"
        set peertype one
        set peerid "branch.example.com"
    next
end

# Cisco IOS
crypto ikev2 profile BRANCH
 identity local fqdn hq.example.com
 match identity remote fqdn branch.example.com

# strongSwan (swanctl.conf)
local  { auth = psk
         id = hq.example.com }
remote { auth = psk
         id = branch.example.com }

Your turn

The head-office gateway now sits behind a NAT device, and the tunnel fails in IKE_AUTH. The branch expects this gateway to identify itself as hq.example.com, and it identifies itself as branch.example.com. Add the two identity lines.

What the checks look for

  • This gateway presents the identity the branch expects
  • It expects the identity the branch presents
  • Authentication succeeds
  • The tunnel carries the traffic between the offices
Try it in the editor →

Take this with you

Identities are labels that both administrators agree on. Use names, set both directions, and the tunnel no longer depends on addresses.

Go a little further

Remove the id remote line and run the lab. Read the message: this time it is this gateway that rejects the peer.

Learn VPN & IPsec Foundations for free

20 short lessons with real code and instant checks.

See the whole course →