Octet

VPNs and tunnels

0 of 38 nailed

Core15

  1. What is a VPN, and what is the difference between site-to-site and remote access?

    Say this first

    A VPN carries private traffic across a network you do not trust, usually the internet, inside a tunnel. The tunnel adds a new outer header so the private addresses can cross the public network, and a security protocol such as IPsec, TLS or WireGuard adds encryption, integrity and peer authentication. Site-to-site joins whole networks: two gateways keep a tunnel up and the hosts behind them do not know it exists. Remote access joins one user device to the company network: a client on the laptop builds the tunnel to a headend, with per-user authentication.

    Go deeper

    Site-to-site

    • The tunnel ends on routers or firewalls at each site. Hosts need no software.
    • Usually IPsec, often as a routed tunnel interface (VTI or GRE over IPsec) so a routing protocol can run across it.
    • The gateways authenticate each other with pre-shared keys or certificates.
    • At scale it becomes hub-and-spoke, DMVPN or an SD-WAN overlay.

    Remote access

    • A client on the endpoint: Cisco Secure Client (AnyConnect), GlobalProtect, FortiClient, WireGuard, or the IKEv2 client built into Windows, macOS, iOS and Android.
    • User authentication through AAA (RADIUS, LDAP, SAML) with MFA, often plus a device posture check.
    • The headend assigns an inner IP address from a pool and pushes DNS servers and routes.
    • A split tunnel or full tunnel decision.

    Other things called a VPN

    An MPLS L3VPN is private by separation (VRFs and labels in the provider core), not by encryption. A consumer "VPN service" is remote access to a provider's internet exit point.

    Traps

    • Saying a VPN is "just encryption". The tunnel and the inner vs outer addressing are the core idea. Plain GRE is a VPN tunnel with no security at all.
    How did you do?Book 3.3 Internet (IP)Book 8.5 Example SystemsOwn page
  2. What is IPsec, and which security services does it provide?

    Say this first

    IPsec is a framework of protocols that protects IP packets at the network layer, so every application above it is covered without changes. It provides confidentiality (encryption), integrity, data origin authentication and anti-replay protection. The parts are IKE, which authenticates the peers and agrees keys; ESP (and rarely AH), which protects the packets; and security associations, which record what was agreed for each direction.

    Go deeper

    Service by service

    ServiceHow IPsec delivers it
    ConfidentialityESP cipher, for example AES
    IntegrityHMAC (SHA-256 and up) or an AEAD cipher such as AES-GCM
    Origin authenticationKeys only the two authenticated peers know, agreed after a PSK or certificate check in IKE
    Anti-replayESP sequence numbers checked against a sliding window

    Why "framework"

    The algorithms are pluggable and negotiated per tunnel: cipher, integrity, Diffie-Hellman group, lifetimes. The architecture is RFC 4301; ESP is RFC 4303; IKEv2 is RFC 7296.

    Where you meet it

    Site-to-site VPNs, remote-access clients, cloud VPN gateways, and as the authentication method for OSPFv3.

    Traps

    • Saying IKE encrypts the user data. IKE negotiates and authenticates; ESP encrypts the data packets.
    How did you do?Book 8.5 Example SystemsOwn page
  3. What is GRE, and how much overhead does it add?

    Say this first

    GRE (Generic Routing Encapsulation) wraps a packet inside a new IP header so it can cross another network. It is IP protocol 47. The basic GRE header is 4 bytes, so GRE over IPv4 adds 24 bytes: 20 for the new IP header and 4 for GRE. It carries multicast and other protocols, which is why routing protocols run over it, but it has no encryption or authentication of its own.

    Go deeper

    Header

    The basic header holds flags, a version and a protocol type (the EtherType of the payload, 0x0800 for IPv4). Optional fields add 4 bytes each: checksum, key (used to tell tunnels apart) and sequence number. RFC 2784 defines GRE and RFC 2890 adds the key and sequence fields.

    Why people use it

    • Carries multicast and broadcast, so OSPF, EIGRP and PIM work across it.
    • Carries IPv6 over an IPv4 core, and other payloads.
    • Gives you a tunnel interface with an IP address that you route into like any link.

    IOS basics

    Cisco IOS
    interface Tunnel0
     ip address 172.16.0.1 255.255.255.252
     tunnel source GigabitEthernet0/0/0
     tunnel destination 203.0.113.2

    tunnel mode gre ip is the default. On a 1500-byte underlay the tunnel IP MTU defaults to 1476.

    Line protocol

    A GRE tunnel interface comes up when the tunnel source is up and the router has a route to the tunnel destination that does not point back into the tunnel. GRE has no handshake, so up/up does not prove the far end is alive.

    Traps

    • Calling GRE secure. It is clear text; anyone on the path can read it and inject packets.
    • Forgetting the 24 bytes when sizing the tunnel MTU and TCP MSS.
    How did you do?Book 3.3 Internet (IP)Own page
  4. Why would you run GRE over IPsec instead of plain IPsec?

    Say this first

    Classic IPsec with a crypto map only protects unicast IP that matches an ACL. It has no interface to route into and cannot carry routing protocol multicast. GRE provides a real tunnel interface that carries multicast, and IPsec then encrypts the GRE packets. The result is dynamic routing across an encrypted tunnel, and an IPsec policy that is a single rule: GRE between the two public addresses.

    Go deeper

    How the layers fit

    1. A packet routed into Tunnel0 gets a GRE header and an outer IP header with the public tunnel source and destination.
    2. IPsec protects that GRE packet. The traffic selector is GRE, host to host: local 198.51.100.1/32 protocol 47 to remote 203.0.113.2/32 protocol 47.
    3. Transport mode is the usual choice because GRE already provides the outer header with the right addresses. That saves 20 bytes per packet.

    Modern IOS configuration

    tunnel protection ipsec profile NAME on the GRE tunnel interface. No crypto map and no crypto ACL to maintain.

    When a plain VTI is enough

    A static VTI (tunnel mode ipsec ipv4) is also a routed interface and runs routing protocols, with less overhead because there is no GRE header. Choose GRE over IPsec when you need multipoint tunnels (DMVPN), non-IPv4 payloads over one tunnel, or interop with a peer that expects GRE.

    Traps

    • Saying IPsec alone can run OSPF. A crypto map cannot. A VTI can, because it is an interface.
    How did you do?Book 8.5 Example SystemsBook 3.3 Internet (IP)Own page
  5. What is the difference between AH and ESP?

    Say this first

    Both protect IP packets. AH (IP protocol 51) gives integrity and origin authentication over the whole packet, including the fields of the outer IP header that do not change in transit, but it does not encrypt. ESP (IP protocol 50) encrypts and authenticates, but its integrity check does not cover the outer IP header. Because AH signs the addresses, any NAT breaks it. Practically every deployment uses ESP.

    Go deeper

    ESP packet layout

    FieldSize
    SPI4 bytes
    Sequence number4 bytes
    IV16 bytes for AES-CBC, 8 for AES-GCM
    Payloadthe protected packet or segment
    Padding0 to 255 bytes, to fill the cipher block
    Pad length and next header2 bytes
    ICV (integrity check)12 bytes for HMAC-SHA1-96, 16 for HMAC-SHA-256-128 and GCM

    Everything from the payload through the next header field is encrypted. The SPI and sequence number are in clear because the receiver needs them to find the SA.

    Why AH is rare

    • No confidentiality.
    • NAT rewrites the source address, so the AH check fails.
    • If you ever need integrity without encryption, ESP with a null cipher does that and survives NAT traversal.

    Traps

    • Saying AH and ESP use port 51 and port 50. They are IP protocol numbers. Only with NAT-T is ESP put inside UDP 4500.
    • Saying ESP authenticates the entire packet. In tunnel mode it covers the original packet, not the new outer header.
    How did you do?Book 8.5 Example SystemsOwn page
  6. Explain IPsec transport mode versus tunnel mode.

    Say this first

    Tunnel mode protects the entire original IP packet and puts it behind a new IP header that carries the gateway addresses. Transport mode keeps the original IP header and protects only what follows it. Gateways protecting traffic for other hosts use tunnel mode. Transport mode is for host-to-host protection, or when another protocol such as GRE has already added the outer header.

    Go deeper

    On the wire

    Output
    Original:            [IP 10.1.0.10 > 10.2.0.20][TCP][data]
    Tunnel mode:         [IP 198.51.100.1 > 203.0.113.2][ESP][IP 10.1.0.10 > 10.2.0.20][TCP][data][trailer][ICV]
    Transport mode:      [IP 10.1.0.10 > 10.2.0.20][ESP][TCP][data][trailer][ICV]
    GRE over IPsec,
    transport mode:      [IP 198.51.100.1 > 203.0.113.2][ESP][GRE][IP 10.1.0.10 > 10.2.0.20][TCP][data][trailer][ICV]

    What changes

    • Tunnel mode hides the real source and destination; an observer only sees the two gateways.
    • Transport mode exposes the real addresses but saves 20 bytes.
    • On IOS a transform set is tunnel mode unless you add mode transport under it.

    Traps

    • Saying transport mode does not encrypt the payload. It encrypts everything after the IP header.
    How did you do?Book 8.5 Example SystemsOwn page
  7. Which protocols and ports must a firewall allow for an IPsec VPN to come up?

    Say this first

    UDP 500 for IKE, and ESP (IP protocol 50) for the data. When NAT traversal is in use, both IKE and ESP move to UDP 4500, so allow that too. AH (IP protocol 51) only if someone really uses AH. If any device in the path does NAT, plan on UDP 500 and UDP 4500 only.

    Go deeper

    TrafficProtocol and portWhen
    IKEv1 and IKEv2UDP 500always, to start
    IKE and ESP with NAT-TUDP 4500NAT detected on the path, or NAT-T forced
    ESPIP protocol 50no NAT on the path
    AHIP protocol 51rare

    On an IOS router with an outside ACL

    Cisco IOS
    ip access-list extended OUTSIDE-IN
     permit udp host 203.0.113.2 host 198.51.100.1 eq isakmp
     permit udp host 203.0.113.2 host 198.51.100.1 eq non500-isakmp
     permit esp host 203.0.113.2 host 198.51.100.1

    isakmp is UDP 500 and non500-isakmp is UDP 4500.

    GRE inside IPsec

    When GRE is protected by IPsec, the firewall never sees protocol 47; it only sees ESP or UDP 4500.

    Traps

    • Saying "ESP uses port 50". ESP has no ports; it is IP protocol 50.
    How did you do?Book 8.5 Example SystemsOwn page
  8. Walk me through IKE phase 1 and phase 2.

    Say this first

    Phase 1 builds an authenticated, encrypted control channel between the two gateways, the IKE SA (the ISAKMP SA in IKEv1). They agree on encryption, hash, Diffie-Hellman group, authentication method and lifetime, run Diffie-Hellman and prove their identity with a pre-shared key or a certificate. Phase 2 runs inside that channel and negotiates the IPsec SAs that carry user data: the transform set, the traffic to protect (proxy IDs), lifetimes and optional PFS. It produces a pair of one-way IPsec SAs.

    Go deeper

    Phase 1 parameters

    Hash, Authentication method, DH Group, Lifetime, Encryption. Some people remember it as HAGLE.

    Phase 2 parameters

    • Protocol and algorithms: ESP cipher and integrity (the transform set)
    • Mode: tunnel or transport
    • Proxy IDs (traffic selectors): local and remote networks
    • PFS group, if any
    • Lifetime in seconds and kilobytes

    Cisco IOS defaults

    The ISAKMP SA lifetime defaults to 86400 seconds. IPsec SA lifetimes default to 3600 seconds and 4,608,000 kilobytes.

    Where to look

    show crypto isakmp sa for IKEv1 phase 1, show crypto ikev2 sa for IKEv2, and show crypto ipsec sa for the IPsec SAs.

    Traps

    • Saying user data flows over the phase 1 SA. The IKE SA only carries IKE messages.
  9. What is a security association, and what is the SPI for?

    Say this first

    An SA is the set of agreed parameters for one direction of protected traffic: protocol, cipher, keys, lifetime, sequence counter and the traffic it applies to. IPsec SAs are one-way, so a working tunnel has at least two, one inbound and one outbound, for each proxy ID pair. The SPI is a 32-bit number in every ESP or AH header that tells the receiver which of its inbound SAs, and so which keys, to use. The receiver chooses the SPI for its own inbound SA.

    Go deeper

    Two kinds of SA

    • The IKE SA is bidirectional and only carries IKE control messages.
    • IPsec SAs (Child SAs in IKEv2) are unidirectional and carry data.

    Lookups

    The receiver finds the SA by SPI, together with the destination address and protocol. Policy lives in the SPD (what to protect, bypass or discard); live SAs and keys live in the SAD.

    The SPIs mirror between peers

    Output
    R1# show crypto ipsec sa | include spi
         current outbound spi: 0x5E3A91C4(1580896708)
          spi: 0x9B07D2E1(2600981217)
          spi: 0x5E3A91C4(1580896708)

    The first spi: line is under "inbound esp sas", the second under "outbound esp sas". On the peer R2, 0x5E3A91C4 is its inbound SPI and 0x9B07D2E1 its outbound SPI.

    Rekey

    New SAs with new SPIs are built before the old ones expire, so for a short time both pairs exist.

    Traps

    • Saying a tunnel has one SA. IPsec SAs come in pairs, one per direction, per selector pair.
    How did you do?Book 8.5 Example SystemsOwn page
  10. What is Diffie-Hellman used for in IPsec, and which groups should you use?

    Say this first

    Diffie-Hellman lets the two peers compute the same secret over an untrusted network without ever sending it, and the IKE keys are derived from that secret. The group sets the math and the strength. Groups 1, 2 and 5 (768, 1024 and 1536-bit MODP) are too weak. Group 14 (2048-bit MODP) is the minimum; the elliptic-curve groups 19 (256-bit) and 20 (384-bit) give better strength for less CPU. Both peers must agree on the group.

    Go deeper

    GroupTypeUse
    1, 2, 5768, 1024, 1536-bit MODPdo not use
    142048-bit MODPacceptable minimum
    15, 163072, 4096-bit MODPstrong but slow
    19256-bit ECP (NIST P-256)recommended
    20384-bit ECP (NIST P-384)recommended, typical for high-assurance policies
    21521-bit ECPstrong
    242048-bit MODP with 256-bit subgroupdeprecated

    Points to make

    • DH alone gives no authentication. The PSK or certificate check in IKE stops a man in the middle.
    • DH runs in phase 1 and again in phase 2 if PFS is enabled.
    • The Logjam research (2015) showed that weak and widely shared DH groups are realistic targets, which is why 1024-bit groups were dropped.

    Traps

    • Saying Diffie-Hellman encrypts the traffic. It only produces shared key material.
  11. Which encryption and integrity algorithms would you choose for a new IPsec tunnel?

    Say this first

    For ESP, AES-GCM with 256-bit (or 128-bit) keys, which encrypts and authenticates in one pass, or AES-CBC with HMAC-SHA-256 or stronger where GCM is not available. For the IKE SA, AES-256 with SHA-256 or SHA-384 and DH group 19 or 20, with 14 as the minimum. Avoid DES, 3DES, MD5 and SHA-1, and DH groups 1, 2 and 5. Authenticate with certificates at scale, or long random pre-shared keys.

    Go deeper

    IOS-XE example

    Cisco IOS
    crypto ikev2 proposal PROP-STRONG
     encryption aes-gcm-256
     prf sha384
     group 20
    crypto ipsec transform-set TS-GCM esp-gcm 256
     mode tunnel

    With AES-GCM in an IKEv2 proposal there is no separate integrity algorithm, so you set the PRF explicitly.

    Why these

    • GCM is an AEAD cipher: less overhead and fast on hardware that accelerates it.
    • 3DES and other 64-bit block ciphers are open to birthday attacks on long sessions (Sweet32, 2016).
    • Check the platform's crypto hardware: an algorithm it does not accelerate can drop throughput a lot.

    Traps

    • Calling 3DES strong because it is "triple". Its 64-bit block is the problem, and it is deprecated.
    How did you do?Book 8.2 Cryptographic Building BlocksOwn page
  12. What is DMVPN, and what problem does it solve?

    Say this first

    DMVPN (Dynamic Multipoint VPN) is a Cisco design where one hub configuration serves hundreds of spokes and spokes can build direct tunnels to each other on demand. It combines multipoint GRE (one tunnel interface, many peers), NHRP (spokes register their public address with the hub and look each other up), an IPsec profile that encrypts the GRE, and a routing protocol across the tunnel. Spokes can have dynamic public addresses, and adding a spoke does not change the hub.

    Go deeper

    The pieces

    • mGRE: tunnel mode gre multipoint, no tunnel destination. NHRP supplies the destinations.
    • NHRP: the overlay's address resolution. It maps a tunnel address to the public (NBMA) address to send the GRE packet to.
    • IPsec: tunnel protection ipsec profile, with wildcard keys or certificates so any spoke can connect.
    • Routing: EIGRP, OSPF or BGP over the tunnel.

    Why not static tunnels

    A full mesh of N sites needs N(N-1)/2 tunnels: 1225 for 50 sites, each configured on both ends. With DMVPN every spoke configures only the hub, the hub configures no spokes, and spoke-to-spoke tunnels appear when traffic needs them and time out when it stops.

    Traps

    • Saying DMVPN needs a static tunnel per spoke on the hub. The hub has one mGRE interface for all of them.
    How did you do?Book 3.3 Internet (IP)Own page
  13. SSL VPN or IPsec client for remote access? How do they differ?

    Say this first

    An SSL (TLS) VPN runs over TCP 443, usually with DTLS on UDP 443 for performance, so it passes through almost any hotel or guest network. It can be clientless through a browser portal or use a full tunnel client. An IPsec client uses IKE on UDP 500 and ESP or UDP 4500, which some networks block, but it is standards based, and IKEv2 clients are built into Windows, macOS, iOS and Android. Both can give full network access with per-user AAA and posture checks.

    Go deeper

    SSL/TLS VPNIPsec client (IKEv2)
    TransportTCP 443, plus DTLS on UDP 443UDP 500 and 4500, or ESP
    Passes restrictive networksalmost alwayssometimes blocked
    Clientless browser modeyes, for web appsno
    Clientvendor client (Cisco Secure Client, GlobalProtect, FortiClient)built into the OS, or vendor
    User authenticationAAA, SAML, MFA, certificatesEAP, certificates

    TCP over TCP

    If the tunnel itself runs over TCP and carries TCP, both layers retransmit on loss and throughput collapses on lossy links. That is why SSL VPN clients prefer DTLS over UDP and fall back to TLS only when UDP is blocked.

    Vendor notes

    Cisco Secure Client uses TLS plus DTLS by default and can use IKEv2. GlobalProtect tries an IPsec tunnel on UDP 4501 first and falls back to SSL.

    Traps

    • Saying SSL VPN is always clientless. Most deployments use a full tunnel client.
    How did you do?Book 8.5 Example SystemsOwn page
  14. What is split tunneling, and what are the risks?

    Say this first

    With split tunneling, only traffic for company networks goes through the VPN and everything else goes straight to the internet. Full tunnel sends everything through the VPN. Split tunnel saves headend bandwidth and gives users faster SaaS and video, but internet traffic skips the company's web filtering and logging, and the laptop is on the internet and the company network at the same time. A common middle ground is full tunnel with exclusions for trusted, high-volume SaaS.

    Go deeper

    Variants

    • Split include: only the listed company prefixes use the tunnel.
    • Split exclude: everything uses the tunnel except listed prefixes, such as collaboration media.
    • Dynamic split by domain in some clients, for SaaS whose addresses change often.
    • Local LAN access: allows the home printer while the tunnel is up.

    DNS is part of the design

    Split DNS sends queries for company domains through the tunnel to internal resolvers and the rest to the local resolver. Without it, internal names fail or leak to public resolvers.

    Historical note

    When most staff moved to home working in 2020, many full-tunnel headends saturated and companies moved collaboration traffic to split exclude.

    Traps

    • Treating split tunnel as only a bandwidth setting. It is a security decision about where internet traffic is inspected.
    How did you do?Book 8.5 Example SystemsOwn page
  15. What is WireGuard, and how is it different from IPsec?

    Say this first

    WireGuard is a small, modern VPN protocol that runs over UDP only. It uses one fixed set of algorithms (Curve25519 for key exchange, ChaCha20-Poly1305 for encryption, BLAKE2s for hashing) instead of negotiating ciphers, and each peer is identified by a public key. A one round trip handshake creates session keys that rotate every two minutes. Configuration is a few lines per peer. It has no built-in user authentication, address assignment or policy engine, which IPsec and SSL VPN products provide around their protocols.

    Go deeper

    Facts to have ready

    • UDP on any port; 51820 is only the convention used in the documentation and examples.
    • Overhead: 60 bytes over IPv4 (20 IP, 8 UDP, 32 WireGuard), 80 over IPv6. wg-quick sets the interface MTU to the outgoing link MTU minus 80, so 1420 on a 1500-byte link.
    • Silent: it does not answer packets that are not authenticated by a known key, so a port scan sees nothing.
    • Roaming: a peer's endpoint is updated to the source address of its latest authenticated packet.
    • PersistentKeepalive (often 25 seconds) keeps NAT mappings open for peers behind NAT.
    • In the Linux kernel since 5.6 (2020), with implementations for Windows, macOS, BSD and many routers.
    • No cipher negotiation: if an algorithm is broken, the protocol version changes instead.

    A minimal peer

    Output
    [Interface]
    Address = 172.16.99.1/30
    ListenPort = 51820
    PrivateKey = (this host's private key)
    
    [Peer]
    PublicKey = (the peer's public key)
    Endpoint = 203.0.113.20:51820
    AllowedIPs = 172.16.99.2/32, 10.2.0.0/24

    Traps

    • Saying WireGuard negotiates ciphers or runs over TCP. It does neither.
    How did you do?Book 8.5 Example SystemsOwn page

Working16

  1. What is the difference between IKEv1 main mode and aggressive mode?

    Say this first

    Main mode uses six messages: two to agree the policy, two for the Diffie-Hellman values and nonces, and two, already encrypted, to exchange identities and authenticate. Aggressive mode squeezes that into three messages, so the identities go out before encryption is in place. With a pre-shared key, the aggressive-mode hash can be captured and attacked offline, so main mode is preferred. Aggressive mode exists for peers with dynamic addresses where the responder needs the identity to pick the right key.

    Go deeper

    Main mode

    MsgDirectionContent
    1initiator to responderSA proposals
    2responder to initiatorchosen proposal
    3initiator to responderDH public value, nonce (plus NAT-D hashes with NAT-T)
    4responder to initiatorDH public value, nonce (plus NAT-D)
    5initiator to responderencrypted: identity, authentication
    6responder to initiatorencrypted: identity, authentication

    Aggressive mode

    MsgDirectionContent
    1initiator to responderSA proposals, DH value, nonce, identity
    2responder to initiatorchosen SA, DH value, nonce, identity, authentication hash
    3initiator to responderauthentication hash

    The PSK catch in main mode

    With a PSK, the keys that protect messages 5 and 6 are derived from the PSK, so the responder must choose the key before it has seen the peer's identity. It can only choose by source IP address. That is why main mode with PSK and dynamic peer addresses needs a wildcard key (crypto isakmp key KEY address 0.0.0.0), and why certificates or IKEv2 are the better answer.

    Traps

    • Saying aggressive mode uses weaker ciphers. Same ciphers; the weakness is identity exposure and offline cracking of the PSK.
    How did you do?Book 8.4 Authentication ProtocolsOwn page
  2. Describe the IKEv2 exchanges. How many messages does it take to bring up a tunnel?

    Say this first

    Four messages. IKE_SA_INIT (two messages) negotiates the IKE SA algorithms, exchanges Diffie-Hellman values and nonces, and detects NAT. IKE_AUTH (two messages, encrypted) exchanges identities and authentication and also creates the first Child SA, the IPsec SA, with its traffic selectors. After that, CREATE_CHILD_SA exchanges add Child SAs or rekey, and INFORMATIONAL exchanges carry deletes, errors and liveness checks.

    Go deeper

    ExchangeMessagesCarries
    IKE_SA_INIT1 and 2SA proposals, KE, nonces, NAT detection notifies, optional certificate request
    IKE_AUTH3 and 4encrypted: identities, AUTH, certificates, Child SA proposal, TSi and TSr
    CREATE_CHILD_SA2 per exchangenew Child SA, rekey of a Child SA or the IKE SA, optional KE for PFS
    INFORMATIONAL2 per exchangeDelete, Notify, or an empty message used as a liveness check

    Reliability

    Every exchange is a request and a response with a message ID. Only the initiator of an exchange retransmits, so lost packets are handled cleanly.

    Anti-DoS cookie

    A responder under load can answer IKE_SA_INIT with a COOKIE notify and keep no state. The initiator repeats its first message with the cookie, proving its source address is real. That makes the setup six messages.

    Longer cases

    EAP authentication for remote-access users adds round trips inside IKE_AUTH. The standard is RFC 7296.

    Traps

    • Saying IKEv2 still has main mode and aggressive mode.
  3. Why is IKEv2 better than IKEv1? Give concrete differences.

    Say this first

    IKEv2 does the job in four messages instead of six plus three. NAT traversal and dead peer detection are built in instead of bolted on. It has cookies against DoS floods, EAP for remote-access user authentication, asymmetric authentication (each side may use a different method), reliable request-response exchanges, and traffic selector narrowing. Lifetimes are not negotiated, each peer rekeys on its own timer, which removes a class of mismatches.

    Go deeper

    TopicIKEv1IKEv2
    Messages to the first IPsec SA9 (main + quick) or 6 (aggressive + quick)4
    NAT traversalextension, RFC 3947built in
    Dead peer detectionextension, RFC 3706built in liveness check
    Remote-access user authXAUTH, vendor extensionEAP, standard
    Authentication methodsame on both sidescan differ per side
    DoS protectionnonecookies
    Lifetimesproposed in negotiationlocal only
    Selector mismatchfailsresponder can narrow
    MobilitynoneMOBIKE (RFC 4555)

    Both use UDP 500 and 4500. They are different protocols: a v1 peer and a v2 peer cannot form a tunnel with each other, so both ends must be configured for the same version.

    Traps

    • Saying IKEv2 is "IKEv1 with stronger ciphers". The ciphers are the same; the protocol design is what changed.
    How did you do?Book 8.5 Example SystemsOwn page
  4. How does NAT traversal work in IPsec, and why is it needed?

    Say this first

    ESP has no ports, so a PAT device cannot tell flows apart, and any NAT breaks AH. NAT-T first detects NAT during IKE: each side sends hashes of the addresses and ports it believes it is using, and if what the peer receives does not match, there is a NAT in the path. The peers then move IKE to UDP 4500 and put every ESP packet inside a UDP 4500 header, which NAT devices handle like any UDP flow. Small keepalives hold the NAT mapping open.

    Go deeper

    IKEv1 (RFC 3947 and RFC 3948)

    1. Messages 1 and 2: vendor ID payloads show both sides support NAT-T.
    2. Messages 3 and 4: NAT-D payloads carry a hash of each side's address and port.
    3. If a received hash does not match what the receiver computes, NAT is present. From message 5 on, IKE uses UDP 4500.
    4. Data travels as IP, UDP 4500, ESP. IKE messages on UDP 4500 start with four zero bytes (the non-ESP marker); ESP never has an SPI of zero, so the receiver can tell them apart.

    IKEv2

    The same idea is built in: NAT_DETECTION_SOURCE_IP and NAT_DETECTION_DESTINATION_IP notifies in IKE_SA_INIT, then the switch to UDP 4500 from IKE_AUTH on.

    Keepalives

    A one-byte UDP packet (0xFF) refreshes the NAT mapping. On IOS: crypto isakmp nat keepalive 20.

    Cost

    8 more bytes per packet for the UDP header. Leave room for it in the tunnel MTU.

    Traps

    • Saying NAT-T only moves IKE to UDP 4500. ESP moves into UDP 4500 too.
    How did you do?Book 8.5 Example SystemsOwn page
  5. What is Perfect Forward Secrecy in IPsec, and what does it cost?

    Say this first

    With PFS, each set of phase 2 keys comes from a fresh Diffie-Hellman exchange instead of from the phase 1 key material. If an attacker later obtains one set of keys, they cannot derive the keys of other SAs, so traffic recorded in other periods stays safe. The cost is one extra DH computation per phase 2 negotiation and rekey, and both peers must agree on the PFS group or phase 2 fails.

    Go deeper

    Configuration on IOS

    Cisco IOS
    crypto ipsec profile VTI-PROF
     set transform-set TS-AES256
     set pfs group19
     set ikev2-profile IKEV2-PROF

    For a crypto map, set pfs group19 goes under the crypto map entry.

    How it works

    • IKEv1: quick mode messages 1 and 2 carry KE payloads, and the new DH secret feeds the IPsec keys.
    • IKEv2: the first Child SA, built in IKE_AUTH, has no DH of its own. PFS applies when Child SAs are created or rekeyed with CREATE_CHILD_SA.

    Choosing the group

    Use the same group as phase 1 or a stronger one. A strong phase 1 group with a weak PFS group gives the IPsec keys only the weak protection.

    Traps

    • Calling PFS a phase 1 setting. It is negotiated for the IPsec (Child) SAs.
    How did you do?Book 8.3 Key PredistributionOwn page
  6. How do IPsec lifetimes and rekeying work, and what are the Cisco defaults?

    Say this first

    Every SA expires after a time or a traffic volume, whichever comes first, and is replaced before it expires so traffic does not stop. On IOS the IKE SA lifetime defaults to 86400 seconds, and IPsec SAs to 3600 seconds or 4,608,000 kilobytes. In IKEv1 lifetimes are proposed during negotiation; in IKEv2 they are not negotiated and each peer rekeys on its own timer.

    Go deeper

    Seeing the clock

    Output
    sa timing: remaining key lifetime (k/sec): (4607862/3412)

    This line in show crypto ipsec sa shows the kilobytes and seconds left on that SA.

    Changing it on IOS

    Cisco IOS
    crypto isakmp policy 10
     lifetime 28800
    crypto ipsec security-association lifetime seconds 3600
    crypto ipsec security-association lifetime kilobytes 4608000
    crypto ikev2 profile IKEV2-PROF
     lifetime 86400

    Matching rules

    • IKEv1 phase 1 on IOS: a policy matches when the peer's proposed lifetime is equal to or shorter than the local one, and the shorter value is used.
    • IKEv2: no negotiation. The side with the shorter lifetime starts the rekey.

    Why a volume limit

    It caps how much data one key protects and forces a rekey before the 32-bit ESP sequence number can wrap. Very fast links use extended sequence numbers (64-bit) for that reason.

    Traps

    • Insisting lifetimes must match or the tunnel fails. Mismatches are tolerated in most cases; they change who rekeys and when.
    How did you do?Book 8.5 Example SystemsOwn page
  7. Compare crypto maps with virtual tunnel interfaces. Which would you deploy today?

    Say this first

    A crypto map is policy-based: it is applied to the physical outside interface and an ACL decides which traffic is encrypted to which peer. A VTI is route-based: a tunnel interface with tunnel protection, and anything routed into it is encrypted. I would deploy VTIs. They run routing protocols, take per-tunnel QoS, ACLs and NAT, use one simple any-to-any selector, and show up in the routing table and interface counters like any link. Crypto maps stay for interop with peers that only do policy-based VPNs.

    Go deeper

    Crypto mapStatic VTI
    Modelpolicy-basedroute-based
    What gets encryptedtraffic matching the crypto ACLtraffic routed into the tunnel
    Routing protocolsno (needs GRE)yes
    Selectorsone SA pair per ACL lineone pair, 0.0.0.0/0 both sides
    MonitoringSA countersinterface counters, SNMP, line protocol
    Failoverseveral set peer entries plus DPDrouting over two tunnels

    Crypto map

    Cisco IOS
    crypto map VPNMAP 10 ipsec-isakmp
     set peer 203.0.113.2
     set transform-set TS-AES256
     match address VPN-TRAFFIC
    interface GigabitEthernet0/0/0
     crypto map VPNMAP

    VTI

    Cisco IOS
    interface Tunnel0
     ip address 172.16.12.1 255.255.255.252
     tunnel source GigabitEthernet0/0/0
     tunnel mode ipsec ipv4
     tunnel destination 203.0.113.2
     tunnel protection ipsec profile VTI-PROF
    ip route 10.2.0.0 255.255.255.0 Tunnel0

    Traps

    • Building the VTI and forgetting the route. Nothing is encrypted until the remote prefixes point into the tunnel.
    How did you do?Book 8.5 Example SystemsOwn page
  8. What are proxy IDs or traffic selectors, and why must the crypto ACLs mirror each other?

    Say this first

    Proxy IDs (IKEv1) or traffic selectors (IKEv2) are the local and remote networks, and optionally the protocol and ports, that a phase 2 SA protects. Each side proposes them from its own policy and the other side must accept them. If my ACL says 10.1.0.0/24 to 10.2.0.0/24, the peer's must say 10.2.0.0/24 to 10.1.0.0/24, a mirror image. A mismatch leaves phase 1 up and phase 2 failing.

    Go deeper

    Mirrored crypto ACLs

    Cisco IOS
    ! R1 (HQ)
    ip access-list extended VPN-TRAFFIC
     permit ip 10.1.0.0 0.0.0.255 10.2.0.0 0.0.0.255
    ! R2 (branch)
    ip access-list extended VPN-TRAFFIC
     permit ip 10.2.0.0 0.0.0.255 10.1.0.0 0.0.0.255

    Rules

    • Each permit line becomes its own SA pair.
    • Avoid permit ip any any in a crypto map ACL: it tries to encrypt everything leaving the interface, including internet traffic.
    • A route-based peer proposes 0.0.0.0/0 to 0.0.0.0/0. A policy-based peer must be configured to match.

    Names by vendor

    PlatformTerm
    Cisco IOScrypto ACL, proxy identities
    Palo AltoProxy ID on the IPsec tunnel
    FortiOSphase 2 selectors
    Junosproxy-identity or traffic-selector

    Traps

    • Saying the ACLs must be identical. They must be mirror images, source and destination swapped.
    How did you do?Book 8.5 Example SystemsOwn page
  9. What is NAT exemption for a VPN, and what happens if you forget it?

    Say this first

    On IOS and most firewalls, outbound NAT happens before the packet is checked against the VPN policy. If LAN-to-LAN traffic is translated to the public address first, it no longer matches the crypto ACL or proxy ID and leaves unencrypted, where it is lost. NAT exemption is a rule that says traffic from my LAN to the remote LAN is not translated. Forget it on one side and you get a tunnel that is up with traffic flowing in one direction only.

    Go deeper

    IOS

    Cisco IOS
    ip access-list extended NAT-ACL
     10 deny   ip 10.1.0.0 0.0.0.255 10.2.0.0 0.0.0.255
     20 permit ip 10.1.0.0 0.0.0.255 any
    ip nat inside source list NAT-ACL interface GigabitEthernet0/0/0 overload

    The deny line must come before the permit. A standard ACL cannot do this because it cannot match on destination.

    Why a VTI mostly avoids it

    With a VTI, VPN traffic exits through Tunnel0. Tunnel0 is not an ip nat outside interface, so the PAT rule on Gi0/0/0 never applies to it.

    The symptom

    Routerencapsdecaps
    Side with exemptionrising0
    Side without exemption0rising

    show ip nat translations on the broken side shows entries whose outside address is in the remote LAN.

    Firewalls

    On a Cisco ASA it is identity NAT, for example nat (inside,outside) source static LAN LAN destination static REMOTE REMOTE no-proxy-arp route-lookup. On zone-based firewalls with route-based tunnels, putting the tunnel interface in its own zone keeps the internet source NAT rule from matching.

    Traps

    • Putting the deny line after the permit line. ACLs are read top down, so it never matches.
    How did you do?Book 8.5 Example SystemsOwn page
  10. What is dead peer detection, and how do you configure it?

    Say this first

    DPD lets a gateway find out that its peer has gone away, so it can delete the stale SAs and fail over or rebuild, instead of encrypting traffic into SAs nobody is listening to. In IKEv1 it is an extension (R-U-THERE and R-U-THERE-ACK messages, RFC 3706); in IKEv2 it is built in as an empty INFORMATIONAL exchange. Periodic mode probes on a timer; on-demand mode probes only when there is traffic to send and nothing has been received.

    Go deeper

    IOS

    Cisco IOS
    ! IKEv1, global: probe every 10 s, retry every 3 s, always
    crypto isakmp keepalive 10 3 periodic
    ! IKEv2, per profile: only when needed
    crypto ikev2 profile IKEV2-PROF
     dpd 10 3 on-demand

    Choosing the mode

    • On-demand costs nothing on an idle tunnel but only notices failure when traffic needs to go.
    • Periodic detects failure on idle tunnels too, which matters for failover designs.

    Where it fits

    • With crypto maps listing two peers (set peer twice), DPD is what triggers failover to the second peer.
    • With VTIs, the routing protocol or BFD over the tunnel usually moves traffic faster; DPD cleans up the SAs.

    Traps

    • Confusing DPD with GRE keepalives. GRE keepalives test the GRE tunnel; DPD tests the IKE peer.
    How did you do?Book 8.5 Example SystemsOwn page
  11. Pre-shared keys or certificates for IPsec authentication? What are the trade-offs?

    Say this first

    PSKs are simple and fine for a handful of tunnels, but every key is distributed and rotated by hand, a leaked key exposes every tunnel that shares it, and wildcard keys for dynamic peers are a big weakness. Certificates scale: each device has its own key pair signed by a CA, peers are checked against the CA and revocation, and adding a device touches nothing else. The price is running a PKI: enrollment, renewal, CRL or OCSP availability, and correct clocks everywhere.

    Go deeper

    PSK hygiene

    • Long and random, unique per peer where possible.
    • A weak PSK can be attacked offline from captured exchanges, and IKEv1 aggressive mode makes that easy.

    Certificates on IOS, the moving parts

    • crypto pki trustpoint with enrollment (SCEP or manual), subject name and revocation policy.
    • In the IKEv2 profile: authentication local rsa-sig, authentication remote rsa-sig and pki trustpoint NAME.
    • revocation-check crl none means check the CRL, but accept the certificate if the CRL cannot be fetched. Decide that on purpose.

    Operational traps

    • Clock: certificates have validity dates. Without NTP, a router whose clock is wrong rejects valid certificates.
    • CRL reachability: if the CRL lives behind the tunnel it protects, a strict check can block the tunnel that would fetch it.

    Traps

    • One PSK shared by every branch. One leak or one departing admin exposes the whole network.
  12. The VPN shows up, but no traffic passes. How do you troubleshoot it?

    Say this first

    "Up" usually means the IKE SA is up. I check that IPsec SAs exist and read the encaps and decaps counters on both ends while sending test traffic. Encaps at zero means the traffic never reaches the encryption: routing, the crypto ACL or NAT exemption on the sending side. Encaps rising but the peer's decaps at zero means the packets die in transit: an ACL or ISP filter on ESP or UDP 4500. Decaps rising but no replies means the remote side: its NAT exemption, its route back, or a host firewall.

    Go deeper

    Commands, in order

    Cisco IOS
    show crypto session detail
    show crypto ipsec sa peer 203.0.113.2
    show ip route 10.2.0.0
    show ip nat translations
    show access-lists

    Reading the counters for traffic from site 1 to site 2

    R1 encapsR2 decapsR2 encapsR1 decapsWhere it breaks
    00anyanyR1 never sends into the tunnel: route, crypto ACL, NAT
    rising0anyanyin transit: ESP or UDP 4500 blocked
    risingrising00R2 return path: NAT exemption, route back, crypto ACL
    risingrisingrisingrisingtunnel works; look at hosts, inside firewalls, MTU

    Test traffic from the right source

    A ping from the router itself is sourced from the outside interface and does not match the crypto ACL. Use ping 10.2.0.10 source GigabitEthernet0/0/1.

    With a VTI

    Check that the route to the remote LAN points into Tunnel0, and look at the tunnel interface counters as well as the SA counters.

    Traps

    • Testing with a plain ping from the router and concluding the tunnel is broken.
    How did you do?Book 8.5 Example SystemsOwn page
  13. How does NHRP work in DMVPN?

    Say this first

    NHRP maps an overlay tunnel address to the underlay (NBMA) address that GRE packets must be sent to. Each spoke has the hub configured as its next hop server and sends it a registration: my tunnel address is 172.16.0.2 and my public address is 198.51.100.2. The hub builds its table from those registrations. When a spoke needs another spoke's public address, it sends a resolution request, and the answer lets it build a direct tunnel. Entries are refreshed and expire with a hold time.

    Go deeper

    Hub

    Cisco IOS
    interface Tunnel0
     ip nhrp network-id 1
     ip nhrp map multicast dynamic

    map multicast dynamic copies multicast (routing hellos) to every spoke that has registered.

    Spoke

    Cisco IOS
    interface Tunnel0
     ip nhrp network-id 1
     ip nhrp nhs 172.16.0.1 nbma 192.0.2.1 multicast

    That one-line form replaces the older three lines: ip nhrp map 172.16.0.1 192.0.2.1, ip nhrp map multicast 192.0.2.1 and ip nhrp nhs 172.16.0.1.

    Message types

    Registration request and reply, resolution request and reply, purge, error, and in phase 3 the redirect (traffic indication).

    Details interviewers like

    • The network ID is local to the router, but it must be set because it enables NHRP on the interface. Keeping it the same everywhere avoids confusion.
    • ip nhrp authentication is a clear-text string of up to 8 characters. It separates DMVPN clouds; it is not security.
    • ip nhrp holdtime defaults to 7200 seconds on IOS, and spokes re-register before it runs out.

    Traps

    • Calling NHRP a routing protocol. It resolves addresses; a routing protocol still provides the prefixes.
    How did you do?Book 3.3 Internet (IP)Own page
  14. Explain DMVPN phase 1, phase 2 and phase 3.

    Say this first

    Phase 1 is hub-and-spoke only: spokes use point-to-point GRE to the hub and all spoke-to-spoke traffic goes through the hub. Phase 2 adds direct spoke-to-spoke tunnels: spokes use mGRE, the routing protocol keeps the remote spoke as next hop, and the spoke resolves that next hop with NHRP. The catch is that the hub cannot summarize. Phase 3 keeps spoke-to-spoke but lets the hub summarize: the hub sends an NHRP redirect when traffic hairpins through it, and the spoke installs a shortcut for the specific prefix.

    Go deeper

    Phase 1Phase 2Phase 3
    Spoke tunnelpoint-to-point GREmGREmGRE
    Spoke to spokethrough the hubdirect, triggered by the next hop in the routing tabledirect, triggered by a hub redirect
    Hub summarizationyesnoyes, even just a default
    Key commandsEIGRP: no next-hop-self, no split horizon; OSPF: broadcast, hub is DRhub ip nhrp redirect, spokes ip nhrp shortcut
    Hierarchical hubsnoawkwardsupported

    Why phase 3 is the default choice today

    Spokes carry only a summary or default plus the shortcuts they use, routing tables stay small, and the hub design can grow into regions without changing spokes.

    Traps

    • Saying phase 3 means three tunnels or three hubs. The phases are design generations.
    How did you do?Book 3.3 Internet (IP)Own page
  15. What is cryptokey routing in WireGuard, and what does AllowedIPs do?

    Say this first

    Each peer is a public key plus a list of AllowedIPs. For outgoing packets, WireGuard picks the peer whose AllowedIPs best match the destination, like a routing table, and encrypts to that peer. For incoming packets, after decryption it checks that the inner source address is inside the AllowedIPs of the peer that sent it and drops the packet otherwise. So AllowedIPs is both the route and the source filter, and one prefix can belong to only one peer on an interface.

    Go deeper

    Site-to-site example

    OnPeerAllowedIPs
    GW1 (LAN 10.1.0.0/24)GW2172.16.99.2/32, 10.2.0.0/24
    GW2 (LAN 10.2.0.0/24)GW1172.16.99.1/32, 10.1.0.0/24

    If GW2 forgets 10.1.0.0/24, packets from GW1's LAN arrive, decrypt, and are dropped because their source is not allowed for that peer.

    Kernel routing still matters

    The kernel decides which interface a packet uses. wg-quick adds routes for each AllowedIPs entry; with plain ip link add wg0 type wireguard you add them yourself.

    Behaviours worth knowing

    • AllowedIPs = 0.0.0.0/0 makes that peer the default for everything, the usual full-tunnel client.
    • Adding a prefix to one peer removes it from any other peer on the same interface.
    • For dynamic routing, a common pattern is one peer per wg interface with 0.0.0.0/0, and BGP or OSPF programming the kernel routes.

    Traps

    • Calling AllowedIPs "just an ACL". It also decides which peer an outgoing packet is encrypted to.
    How did you do?Book 8.5 Example SystemsOwn page
  16. What do `ip mtu` and `ip tcp adjust-mss` on a tunnel interface actually do?

    Say this first

    ip mtu 1400 is the largest IP packet the router sends into the tunnel before encapsulation. A bigger packet with DF clear is fragmented before encryption, so the far gateway does not have to reassemble anything; one with DF set is dropped and the router sends an ICMP "fragmentation needed" message with MTU 1400 so the sender can shrink its packets. ip tcp adjust-mss 1360 rewrites the MSS option in TCP SYN and SYN-ACK packets crossing the interface, so TCP never sends segments larger than 1360 bytes of data: 1360 plus 20 bytes of IP and 20 of TCP is 1400. MSS clamping keeps TCP working even when ICMP is blocked.

    Go deeper

    The usual pair

    Cisco IOS
    interface Tunnel0
     ip mtu 1400
     ip tcp adjust-mss 1360

    Fragment before or after encryption

    • Before: the inner packet is split, each fragment is encrypted on its own, and the destination host reassembles. Cheap for the VPN routers.
    • After: the ESP packet is split, and the receiving gateway must reassemble before it can decrypt. Expensive, and some platforms do it in software.

    Path MTU discovery black holes

    Hosts send with DF set and wait for ICMP type 3 code 4. If a firewall drops those messages, large packets vanish silently: small requests work, big transfers hang. MSS clamping hides this for TCP.

    Other platforms

    • IPv6 inside the tunnel: ipv6 tcp adjust-mss 1340 (60 bytes of IPv6 and TCP headers).
    • Linux:
      Shell
      iptables -t mangle -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu

    Traps

    • Setting ip mtu only and assuming TCP is fine. Without MSS clamping, TCP depends on ICMP getting back to the sender.

Expert7

  1. What happens in IKEv1 quick mode, message by message?

    Say this first

    Quick mode is phase 2: three messages, all protected by the ISAKMP SA. The initiator sends its proposals (transform sets with the SPI it wants for its inbound SA), a nonce, its proxy IDs and a DH value if PFS is on. The responder checks the proxy IDs against its own policy, picks a proposal and answers with its SPI, nonce and DH value. The third message is a hash that confirms the initiator has the keys, after which both sides use the new inbound and outbound SAs.

    Go deeper

    The three messages

    MsgDirectionPayloads
    1initiator to responderHASH(1), SA proposals with initiator SPI, nonce, optional KE, proxy IDs
    2responder to initiatorHASH(2), chosen SA with responder SPI, nonce, optional KE, proxy IDs
    3initiator to responderHASH(3)

    Keys

    IPsec keys are derived from the phase 1 key material (SKEYID_d) plus both nonces and the SPI, or also from a fresh DH secret when PFS is on.

    SPIs

    Each side chooses the SPI for its own inbound SA and tells the peer, so the outbound SPI on one router is the inbound SPI on the other.

    One quick mode per selector pair

    A crypto ACL with three lines to three remote subnets triggers three quick modes and three SA pairs, and each pair is rekeyed separately.

    Traps

    • Saying quick mode happens once per tunnel. It happens once per proxy ID pair and again at every rekey.
    How did you do?Book 8.5 Example SystemsOwn page
  2. What is IPsec anti-replay, and why can QoS cause anti-replay drops?

    Say this first

    Every ESP packet carries a sequence number. The receiver keeps a sliding window, 64 packets by default on IOS, and drops packets whose number it has already seen or that fall behind the window. That stops an attacker from replaying captured packets. But the sequence number is assigned at encryption, before the output queue. If QoS then sends voice ahead of queued bulk data, some bulk packets arrive more than 64 behind the newest one and are dropped as replays, even though they are genuine.

    Go deeper

    Other causes of reordering

    Per-packet load sharing across two paths, or a provider network that reorders under load.

    Evidence

    IOS logs %CRYPTO-4-PKT_REPLAY_ERR with the connection ID and sequence number of the dropped packet.

    Fixes on IOS

    Cisco IOS
    ! global
    crypto ipsec security-association replay window-size 1024
    ! or per crypto map entry
    crypto map VPNMAP 10 ipsec-isakmp
     set security-association replay window-size 1024

    A wider window tolerates more reordering. Disabling the check (set security-association replay disable) works but removes the protection.

    Traps

    • Assuming replay errors mean an attack. On real networks they are almost always QoS or path reordering.
  3. In DMVPN phase 3, what happens when spoke A first sends traffic to a host behind spoke B?

    Say this first

    Spoke A has only the hub's summary, so the first packets go to the hub. The hub sees a packet arrive on Tunnel0 and leave on Tunnel0, forwards it, and sends spoke A an NHRP redirect. Spoke A sends an NHRP resolution request for the destination, which the hub forwards to spoke B. Spoke B answers spoke A directly with its public address and the matching prefix from its routing table, which brings up IPsec between the spokes. Spoke A installs a shortcut for that prefix, and later packets go spoke to spoke.

    Go deeper

    Walk-through with addresses

    DeviceTunnelNBMALAN
    Hub R1172.16.0.1192.0.2.110.1.0.0/24
    Spoke A R2172.16.0.2198.51.100.210.2.0.0/24
    Spoke B R3172.16.0.3203.0.113.210.3.0.0/24
    1. R2 sends to 10.3.0.10 using the hub's summary 10.0.0.0/8 via 172.16.0.1.
    2. R1 forwards it to R3 and, because it hairpinned on Tunnel0, sends R2 a redirect.
    3. R2 sends a resolution request for 10.3.0.10. It is routed through R1 to R3.
    4. R3 replies directly to R2: 10.3.0.0/24 is at 172.16.0.3, NBMA 203.0.113.2. IKE and IPsec come up between R2 and R3.
    5. R2 installs the shortcut. On IOS 15.2 and later it appears as an NHRP route (code H, administrative distance 250), or as a next hop override (marked %) on an existing route.
    6. Unused shortcuts age out, and traffic falls back to the hub path.

    Commands

    Hub: ip nhrp redirect. Spokes: ip nhrp shortcut.

    Traps

    • Saying spoke B's resolution reply comes back through the hub. In phase 3 it goes directly to spoke A.
    How did you do?Book 3.3 Internet (IP)Own page
  4. Which routing protocol settings does DMVPN need with EIGRP, OSPF and BGP?

    Say this first

    EIGRP: in phase 2, turn off split horizon and next-hop-self on the hub tunnel so spokes learn each other's prefixes with the remote spoke as next hop; in phase 3, summarize from the hub instead. Make spokes EIGRP stubs. OSPF: the default point-to-point network type on tunnels allows one neighbor, so use broadcast with spokes at priority 0 in phase 2, or point-to-multipoint in phase 3. BGP: dynamic neighbors on the hub with bgp listen range, iBGP with the hub as route reflector or eBGP with a private AS per spoke, and in phase 3 just a summary or default to the spokes.

    Go deeper

    EIGRP on the hub

    Cisco IOS
    ! Phase 2
    interface Tunnel0
     no ip split-horizon eigrp 100
     no ip next-hop-self eigrp 100
    ! Phase 3
    interface Tunnel0
     ip summary-address eigrp 100 10.0.0.0 255.0.0.0

    Spokes: eigrp stub connected under router eigrp 100.

    OSPF

    • Point-to-point (the tunnel default) accepts one neighbor, so a hub with several spokes flaps.
    • Broadcast (hello 10, dead 40) keeps the next hop, needs the hub as DR.
    • Point-to-multipoint (hello 30, dead 120) sets the hub as next hop, fine for phase 3.
    • All spokes share one area, so every spoke flap triggers SPF on every spoke. This limits scale.

    BGP on the hub

    Cisco IOS
    router bgp 65000
     bgp listen range 172.16.0.0/24 peer-group SPOKES
     neighbor SPOKES peer-group
     neighbor SPOKES remote-as 65000
     address-family ipv4
      neighbor SPOKES activate
      neighbor SPOKES route-reflector-client

    A route reflector does not change the next hop by default, which is what phase 2 needs.

    Traps

    • Summarizing on the hub in a phase 2 design. Spoke-to-spoke tunnels stop forming.
    How did you do?Book 3.4 RoutingOwn page
  5. How do you work out the usable MTU inside a VTI or GRE over IPsec tunnel?

    Say this first

    Subtract every header the tunnel adds from the underlay MTU. GRE adds 24 bytes. ESP adds 8 bytes of header, the IV, 2 bytes of trailer, the ICV and padding to the cipher block; tunnel mode adds a 20-byte outer IP header and NAT-T adds 8 bytes of UDP. With AES-256-CBC and HMAC-SHA-256 on a 1500-byte path, a VTI carries up to 1438 bytes, GRE over IPsec in transport mode 1434, in tunnel mode 1414, and in tunnel mode behind NAT only 1398. The usual ip mtu 1400 with MSS 1360 fits every case except that last one.

    Go deeper

    The ESP pieces (AES-256-CBC, HMAC-SHA-256)

    PieceBytes
    ESP header (SPI and sequence)8
    IV16
    Pad length and next header2
    Padding0 to 15, so payload plus trailer is a multiple of 16
    ICV16

    Worked example: VTI, no NAT

    1500 minus 20 (outer IP), 8 (ESP header), 16 (IV) and 16 (ICV) leaves 1440 for the encrypted part. 1440 is a multiple of 16, and 2 bytes go to the trailer, so the largest inner packet is 1438. IOS shows this as plaintext mtu 1438 in show crypto ipsec sa.

    Largest inner packet on a 1500-byte underlay

    TunnelNo NATBehind NAT (NAT-T)
    Plain GRE1476not used (PAT cannot carry GRE)
    VTI (IPsec tunnel mode)14381422
    GRE over IPsec, transport mode14341418
    GRE over IPsec, tunnel mode14141398

    Adjustments

    • AES-GCM uses an 8-byte IV and pads only to 4 bytes, so it leaves slightly more room.
    • A PPPoE underlay is 1492, not 1500: take 8 more bytes off every number.
    • For GRE over IPsec in tunnel mode behind NAT, use ip mtu 1380 and ip tcp adjust-mss 1340.

    Traps

    • Quoting "IPsec adds 50 to 60 bytes" as a fixed number. It depends on cipher, integrity, mode, NAT-T and padding.
    How did you do?Book 3.3 Internet (IP)Book 8.5 Example SystemsOwn page
  6. What is recursive routing on a GRE tunnel, and how do you prevent it?

    Say this first

    It happens when the router learns the route to the tunnel destination through the tunnel itself, usually because a routing protocol running over the tunnel advertises the WAN subnets. To send a GRE packet the router routes the outer header, finds the tunnel again, and would encapsulate forever. IOS detects it, logs %TUN-5-RECURSIVEROUTING and takes the tunnel down; the routing protocol drops, the route disappears, the tunnel comes back, and it flaps. The fix: never advertise the underlay into the overlay, pin the tunnel destination with a static host route, or put the underlay in a front-door VRF.

    Go deeper

    Why metrics do not save you

    The tunnel destination 203.0.113.2 is normally reached by a static default route. If OSPF over the tunnel advertises 203.0.113.0/30, that /30 beats the /0 by longest prefix match, whatever the administrative distance or cost.

    Prevention

    • Advertise only LAN and tunnel subnets: precise network statements or ip ospf 1 area 0 per interface, never network 0.0.0.0 255.255.255.255 area 0.
    • Add a /32 static route to the tunnel destination via the ISP next hop. A /32 always wins.
    • Use a front-door VRF so the outer lookup happens in a separate table:
      Cisco IOS
      vrf definition INTERNET
       address-family ipv4
       exit-address-family
      interface GigabitEthernet0/0/0
       vrf forwarding INTERNET
       ip address 198.51.100.1 255.255.255.252
      ip route vrf INTERNET 0.0.0.0 0.0.0.0 198.51.100.2
      interface Tunnel0
       tunnel source GigabitEthernet0/0/0
       tunnel destination 203.0.113.2
       tunnel vrf INTERNET

    A quieter variant

    Learning a default route over the tunnel that replaces the default the tunnel destination depended on causes the same loop.

    Traps

    • Trying to fix it by raising the OSPF cost on the tunnel. Longest prefix match is checked before any metric.
    How did you do?Book 3.4 RoutingOwn page
  7. How would you design redundant site-to-site IPsec between a branch and two data centers?

    Say this first

    Two route-based tunnels from the branch, one to each data center, ideally over two ISPs, each a VTI with its own IKE and IPsec SAs. A routing protocol over both (BGP is the usual choice) makes failover a routing decision. Prefer one path with local preference or metrics, detect failure fast with BFD or tuned timers, and keep DPD on to clean up SAs. With crypto maps you only get several set peer entries and DPD-driven failover, which is slower and harder to reason about.

    Go deeper

    Branch with two ISPs

    • Tunnel1 sourced from the ISP A interface to DC1, Tunnel2 from the ISP B interface to DC2.
    • Pin each tunnel's underlay to its ISP: a /32 static route to each headend via the matching ISP, or one front-door VRF per ISP.

    Routing

    • eBGP over the VTIs with private ASNs. Prefer DC1 with local preference on routes received from it, and steer return traffic with AS-path prepending or MED toward DC2.
    • BFD on the tunnel interfaces, where the platform supports it, gives sub-second detection. BGP timers alone take much longer.
    • Watch for asymmetric routing through stateful firewalls in the data centers.

    Same idea elsewhere

    • DMVPN: two hubs, spokes with two NHS entries or two tunnels.
    • Cloud: an AWS Site-to-Site VPN connection provides two tunnels to different endpoints; run BGP over both.

    Prove it

    Test failover and failback during a change window, and watch for traffic that keeps using stale SAs.

    Traps

    • Calling two tunnels over the same ISP and the same router redundant. Count the single points of failure.
    How did you do?Book 4.1 Global InternetOwn page