WAN, MPLS and VPN

Wide area networks, from circuit to tunnel

I design and fix the links between sites: the circuits underneath, MPLS (Multiprotocol Label Switching) from carriers, and the IPsec, GRE and DMVPN tunnels I build on top. This page shows how each one works, how I keep traffic moving when a link fails, and how I find the fault when it does not.

  • MPLS L3VPN
  • IPsec and IKEv2
  • GRE
  • DMVPN
  • IP SLA
  • WAN QoS
  • Carrier Ethernet
  • Remote access
A branch and a data centre joined two ways A branch and a data centre are joined by an MPLS service as the main path, with labelled packets crossing the provider core. Underneath, an IPsec tunnel over the internet is ready as the backup path. MPLS PROVIDER INTERNET P labels swapped IPsec tunnel BranchCE router Data centreWAN edge
Live view · MPLS as the main path, an IPsec tunnel as the backup
Circuits

Choosing the right circuit for each site

Every wide area network (WAN) starts with the circuits underneath it. I pick each one for the job it does: the main path, the backup, or the link between data centres. Choose a service to compare them.

Six ways to join two sites Two sites joined six different ways: a dedicated leased line, shared broadband, a 4G or 5G mobile network, and a carrier Ethernet line with a third site joining an E-LAN. The last two are a provider MPLS network, and DWDM with several wavelengths on one fibre. A panel shows bandwidth, service level, encryption and best use for each. Dedicated and symmetrical SHARED ACCESS NETWORK Contended and best effort MOBILE NETWORK Speed depends on signal Site Cjoins the E-LAN E-Line A to B, E-LAN adds Site C PROVIDER MPLSPEPE Any site to any site One fibre pair, many wavelengths Site Abranch Site Bdata centre Bandwidth Service level Encryption Best for 10 Mb/s to 10 Gb/ssame speed both waysSLA on uptimeand fix timeNone by defaultadd IPsec or MACsecMain sites andinternet breakout Full fibre, 1 Gb/sor more downstreamBest effortslower fix timesNonealways tunnel over itSmall sites, backupand SD-WAN transport Varies with signaland cell loadBest effortdata caps and CGNATNonealways tunnel over itDay one, failoverand moving sites 10 Mb/s to 100 Gb/sLayer 2 hand offSLA on latency,loss and uptimeNone by defaultMACsec if neededCampus and datacentre links Any to any IP VPNport speed per siteSLA plus QoSclasses for voicePrivate, butnot encryptedVoice and criticalapplications Many wavelengths10 to 400 Gb/s eachYour own or managedfibre, lowest latencyOptical or MACsecencryption optionsLinks betweendata centres Typical UK figures. Every carrier contract differs.

Swipe sideways to see the whole diagram.

Leased line and dedicated internet access (DIA). An uncontended circuit, the same speed in both directions, with a service level agreement (SLA) on availability and fix time. I use it for hubs, data centres and central internet breakout. It is not encrypted, so anything sensitive still rides inside IPsec (Internet Protocol Security) or MACsec (media access control security).

Broadband. Full fibre to the premises (FTTP) is fast and cheap, but contended and best effort, with slower fixes. Many lines use PPPoE (Point to Point Protocol over Ethernet), which takes 8 bytes and leaves a 1,492 byte MTU (maximum transmission unit). I treat it as an untrusted transport: always tunnel over it, and never let one broadband line be the only path for a site that matters.

4G and 5G. Ideal on day one before fixed lines arrive, as a failover path and for sites that move. Speed depends on signal and cell load, plans often have data caps, and most services sit behind carrier grade NAT (CGNAT), so nothing can connect in. IPsec over it needs NAT traversal.

Carrier Ethernet. The MEF (Metro Ethernet Forum, now the Mplify Alliance) defines the service types. E-Line is point to point, as an Ethernet private line or a VLAN (virtual local area network) based virtual private line. E-LAN is multipoint, with every site in one Layer 2 network, and E-Tree is hub and spoke. I route over these links rather than stretching Layer 2, to keep failure domains small.

MPLS IP VPN. The carrier runs a Layer 3 VPN (virtual private network): any site reaches any site, with QoS (quality of service) classes and an SLA (service level agreement). It is private but not encrypted. I still use it where voice or regulated traffic needs a carrier SLA, often alongside internet circuits in an SD-WAN (software defined wide area network).

DWDM. Dense wavelength division multiplexing puts many wavelengths on one fibre pair, each its own high speed link. A ROADM (reconfigurable optical add drop multiplexer) adds or drops wavelengths without manual patching. It gives the lowest latency between data centres, where latency is set mostly by fibre distance.

Animation

Start from the applications

I size the WAN (wide area network) from what crosses it. That means bandwidth at the busiest hour, latency and loss limits for voice and video, the number of sites, how much routing control we need, and what the security policy says about encryption.

Diversity you can prove

Two circuits are only diverse if they use separate ducts, exchanges and points of presence. Two carriers on the same last mile cable fail together, so I ask for route diversity evidence in writing.

Check the hand off

MTU, VLAN tagging or QinQ (IEEE 802.1ad), speed and duplex, and whether LACP (Link Aggregation Control Protocol) or CDP (Cisco Discovery Protocol) pass through. A carrier link can stay up while the far end is dead, so I run BFD (Bidirectional Forwarding Detection) or Ethernet OAM (operations, administration and maintenance) over it.

Carrier service types

ServiceWhat it isWatch out for
Ethernet private line (EPL)Point to point on a dedicated port at each endSingle path unless you buy a protected service
Ethernet virtual private line (EVPL)Point to point, several services sharing one port, split by VLANVLAN numbers agreed with the carrier, and shared port bandwidth
E-LAN or VPLS (virtual private local area network service)Multipoint Layer 2: every site in one broadcast domainA loop or broadcast storm at one site reaches every site. I route over it and set storm control
MPLS L3VPN (Layer 3 VPN)Carrier routes your traffic between sites in a private VRF (virtual routing and forwarding table)Routing policy at the carrier edge, and the AS (autonomous system) number plan
DWDM (dense wavelength division multiplexing) wavelengthA dedicated wavelength on carrier or owned fibreProtected or unprotected, and the real fibre route
Failover

Failing over when the fault is out of sight

A branch with two links only helps if the router knows when the main one has stopped working. I use IP SLA probes and object tracking on Cisco routers, so failover follows real reachability, not just the light on the port.

Failing over when the fault is beyond the next hop A branch router has a default route through ISP A and a floating default route through ISP B or 4G. An IP SLA probe checks a target inside ISP A every 10 seconds. When ISP A fails in its core, the branch interface stays up, but the probes time out, the tracked route is withdrawn and the floating route takes over. When the probes succeed again the primary route returns after a delay. Branch routertwo uplinks ISP A edge203.0.113.1 ISP A coreprobe target ISP B or 4G192.0.2.1 ISP B networkbackup path Data centreand the internet Gi0/0/0 still up/up Probe every 10 s, replies arrive Carrier core fails, link stays up Probes time out, track 1 goes down Floating route now carries traffic Replies again, track 1 up after 30 s Routing table · show ip route 0.0.0.0 S* 0.0.0.0/0 [1/0] via 203.0.113.1track 1 upfloating route via 192.0.2.1 at distance 250 waits S* 0.0.0.0/0 [1/0] via 203.0.113.1track 1 uptraffic still sent to ISP A and lost in its core S* 0.0.0.0/0 [1/0] via 203.0.113.1track 1 down after 10 sthe tracked route is about to be withdrawn S* 0.0.0.0/0 [250/0] via 192.0.2.1track 1 downthe floating route is now in the table S* 0.0.0.0/0 [1/0] via 203.0.113.1track 1 up after 30 sprimary is back, the floating route waits again

Swipe sideways to see the whole diagram.

Step 1
  1. The branch router sends an ICMP (Internet Control Message Protocol) echo every 10 seconds to a target inside ISP (internet service provider) A, beyond the next hop and sourced from the primary interface. While replies arrive, track object 1 stays up and the default route through ISP A stays in the table.

  2. ISP A fails inside its own network. My interface and the carrier's edge router are still up, so a plain static route would keep sending traffic into a black hole. This is the failure that catches simple designs out.

  3. Probes time out. After the delay I set, 10 seconds here, track 1 goes down. The delay stops one lost probe from moving all the traffic.

  4. The tracked route is withdrawn, so the floating static route with administrative distance 250 is installed. Traffic now leaves through ISP B or the 4G router. The same track object can lower an HSRP (Hot Standby Router Protocol) priority, so the gateway moves with the routing.

  5. When probes succeed again, the track waits 30 seconds before coming back up. A slower return than failover stops a flapping circuit from moving traffic back and forth.

The configuration behind this animation, on Cisco IOS XE

ip sla 1
 icmp-echo 198.51.100.1 source-interface GigabitEthernet0/0/0
 frequency 10
ip sla schedule 1 life forever start-time now
!
track 1 ip sla 1 reachability
 delay down 10 up 30
!
ip route 198.51.100.1 255.255.255.255 203.0.113.1
ip route 0.0.0.0 0.0.0.0 203.0.113.1 track 1
ip route 0.0.0.0 0.0.0.0 192.0.2.1 250
!
! check it
show ip sla statistics 1
show track 1
show ip route 0.0.0.0

Probe beyond the next hop

Pinging the carrier's own router proves very little. I probe something inside the carrier or at the far site, and pin the probe to the primary path with a host route.

Tie routing and gateways together

If a site has two routers running HSRP (Hot Standby Router Protocol), the same track object lowers the priority on the router that lost its WAN, so users follow the working path.

Dynamic routing does this better

Where the carrier runs BGP (Border Gateway Protocol) with me, the routes disappear on their own when the far side fails. I add BFD so that happens in under a second instead of after the BGP hold timer.

Collect the evidence automatically

An EEM (Embedded Event Manager) applet watches for the track going down, then saves the interface, route and probe output with a timestamp. The evidence for the carrier ticket exists before anyone logs in.

MPLS

How MPLS moves a packet with labels, not lookups

MPLS (Multiprotocol Label Switching) forwards on short labels instead of full IP lookups, and lets one carrier network keep thousands of customers apart. My home lab runs this exact design: two P (provider core) routers, five PE (provider edge) routers and two customers in separate VRFs. You can see it on the home lab topology.

How MPLS L3VPN carries a customer packet Two customer edge routers connect to provider edge routers PE1 and PE2, joined through core routers P1 and P2. CE B advertises its network into a VRF on PE2. PE2 sends it to PE1 as a VPNv4 route with a route distinguisher, a route target and a VPN label. LDP hands out transport labels hop by hop. A packet from CE A gets two labels at PE1, the top label is swapped at P1, popped at P2, and PE2 uses the VPN label to forward it to CE B. A bar shows the four fields of an MPLS label. PROVIDER MPLS CORE MP-BGP VPNv4 session PE1London P1core P2core PE2New York CE AITS Ltd London CE BITS Ltd New York P1: use 16 P2: use 17 PE2: implicit null CE B advertises 10.2.0.0/16 into VRF ITS on PE2 VPNv4 route 65000:1:10.2.0.0/16 · RT 65000:1 · VPN label 33 LDP: each router tells its neighbour which label to use PE1 pushes two labels: transport 16 on top of VPN 33 P1 swaps 16 for 17. It never reads the IP header P2 pops the top label. PE2 reads 33 and picks VRF ITS Each MPLS label is 4 bytes, between the Layer 2 and IP headers Label · 20 bits TC S TTL · 8 bits 10.2.0.0/16 VPNv4 IP 16 | 33 17 | 33 33 IP

Swipe sideways to see the whole diagram.

Step 1
  1. CE B, the customer edge router in New York, sends its network to PE2, the provider edge, using eBGP, OSPF (Open Shortest Path First) or a static route. PE2 keeps it in VRF ITS (a virtual routing and forwarding table for that customer), so other customers never see it.

  2. PE2 sends the route to PE1 over MP-BGP (multiprotocol BGP). A route distinguisher makes it unique, a route target says which VRFs may import it, and a VPN label (33) tells PE2 which VRF to use later. Large providers use route reflectors instead of a full mesh.

  3. LDP (Label Distribution Protocol) builds labels for each PE loopback, hop by hop. P1 asks for 16 and P2 asks for 17. PE2 advertises implicit null, which tells P2 to pop the label before the last hop: penultimate hop popping (PHP).

  4. A packet from London reaches PE1 as plain IP. PE1 finds the route in VRF ITS and pushes two labels: the VPN label 33 inside, and the transport label 16 on top to reach PE2.

  5. P1 only looks at the top label. It swaps 16 for 17 and forwards. The core routers carry no customer routes at all, which is why one core can carry thousands of customers with overlapping addresses.

  6. P2 pops the transport label, as PE2 asked. PE2 reads the VPN label 33, knows it belongs to VRF ITS, removes it and forwards the original IP packet to CE B.

Route distinguishers and route targets PE1 holds two customer VRFs that both use 10.1.1.0/24. In the VPNv4 table each copy carries its own route distinguisher, so they stay separate. Route targets decide which VRFs on PE2 import each route. In the shared services view, a shared VRF exports its own route target and both customer VRFs import it. Because both customers use the same range, one of them is translated by NAT before it reaches the shared VRF. PE1 · London VPNv4 table PE2 · New York VRF ITS10.1.1.0/24 VRF GAP10.1.1.0/24 VRF ITSimports RT 65000:1 VRF GAPimports RT 65000:2 VRF SharedDNS and backup 65000:1:10.1.1.0/24RT 65000:1 65000:2:10.1.1.0/24RT 65000:2 65000:99:10.99.0.0/24RT 65000:99 Same address twice, made unique by the RD Route targets decide which VRF imports a route Both import the shared RT, and GAP is NATed because it overlaps

Swipe sideways to see the whole diagram.

Route distinguisher (RD). Both customers use 10.1.1.0/24. PE1 adds an 8 byte RD, so the routes become 65000:1:10.1.1.0/24 and 65000:2:10.1.1.0/24, two different 12 byte VPNv4 (the VPN address family for IPv4) routes. The RD only makes routes unique. It does not decide where they go.

Route target (RT). Each route carries export route targets as extended communities. A VRF imports any route whose RT is on its import list. ITS imports 65000:1 and GAP imports 65000:2, so the customers stay apart even on shared PE routers. The PEs must send extended communities to each other. IOS adds send-community extended when the VPNv4 neighbour is activated, so I check nobody has removed it.

Shared services. A shared VRF exports 65000:99 and both customer VRFs import it. The shared VRF imports the customers' routes so it can reply. That only works when every imported range is unique. Here both customers use 10.1.1.0/24, so one of them is NATed before it reaches the shared VRF.

Animation

How each site talks to the carrier

CE to PE routingHow it worksWhere I use it
Static routesSimple and predictable, but the carrier cannot tell me when its side failsSmall single homed sites, with IP SLA tracking
eBGPEach site has its own AS, or every site shares one private ASMy default. With one shared AS the PE needs as-override or the CE needs allowas-in, or BGP drops the routes as a loop
OSPF or EIGRP (Enhanced Interior Gateway Routing Protocol)The carrier joins my IGP (interior gateway protocol) at each siteWhere the customer cannot run BGP. Needs care with domain IDs, the down bit and sham links
BFD on the sessionDetects a dead neighbour in under a secondEvery dynamic CE to PE session, because the BGP hold timer is 180 seconds by default

Data centres and newer cores

Handing a data centre fabric to the WAN

The simplest handoff is VRF lite: one sub interface and one routing session per zone between the border leaf and the PE router. The boundary is clean and a firewall fits in easily, but the configuration grows with every VRF. A combined border can instead turn EVPN (Ethernet VPN) routes into L3VPN routes, with fewer links but a more complex shared device.

One mapping everywhere

Whichever handoff I use, each zone maps to the same VRF and L3VPN at every site, DSCP (Differentiated Services Code Point) maps to the MPLS traffic class the same way, and both teams agree the MTU. The data centre team owns up to the border leaf and the WAN team owns the PE. More on the data centre fabrics page.

Segment routing

Segment routing removes LDP: the IGP (interior gateway protocol) carries the labels itself, so there is one protocol fewer to run. It can keep the MPLS data plane or carry the path in IPv6 (Internet Protocol version 6) headers (SRv6), and topology independent loop free alternates give fast reroute without RSVP (Resource Reservation Protocol) tunnels.

IPsec

How an IPsec tunnel comes up, step by step

IPsec (Internet Protocol Security) protects traffic between two sites over a network I do not trust. IKE (Internet Key Exchange) agrees the keys first, then ESP (Encapsulating Security Payload) protects every packet. Knowing exactly what each message does is what makes VPN faults quick to find.

How IKE builds an IPsec tunnel Two routers exchange IKE messages down a ladder. IKEv1 uses six main mode messages to build phase 1, then three quick mode messages for phase 2. IKEv2 builds the IKE SA and the first IPsec SA in four messages, with later rekeys. When a NAT sits between the routers, IKEv2 detects it in the first exchange, moves to UDP 4500 and wraps ESP inside UDP. Router Ainitiator Router Bresponder 1 · proposals: cipher, hash, DH group, authentication2 · one proposal chosen3 · Diffie-Hellman public value and nonce4 · Diffie-Hellman public value and nonce5 · identity and proof, now encrypted6 · identity and proof, now encrypted7 · quick mode: proxy IDs, transform set, nonce8 · accepted proxy IDs and transform set9 · acknowledgement: IPsec SAs readyPhase 1main modePhase 2quick mode IKE_SA_INIT: proposals, DH value, nonceIKE_SA_INIT: chosen proposal, DH value, nonceIKE_AUTH: identity, proof, first child SAIKE_AUTH: identity, proof, first child SA Tunnel ready after four messageslater · CREATE_CHILD_SA: rekey or add an SACREATE_CHILD_SA reply NAT IKE_SA_INIT on UDP 500, with NAT detectionreply: the hashes show a NAT in the pathIKE_AUTH moves to UDP 4500IKE_AUTH reply on UDP 4500 ESP inside UDP 4500, both wayskeepalives hold the NAT entry open

Swipe sideways to see the whole diagram.

IKEv1. Phase 1 main mode takes six messages: agree the proposal, swap Diffie-Hellman values, then prove identity inside the new encrypted channel. That builds the IKE SA (security association), shown as QM_IDLE on Cisco. Phase 2 quick mode then agrees the proxy IDs and transform set and builds a pair of one way IPsec SAs. Aggressive mode does phase 1 in three messages but exposes the identity, so I do not use it.

IKEv2. Four messages build both the IKE SA and the first child SA. NAT traversal, dead peer detection (DPD) and certificate or EAP (Extensible Authentication Protocol) authentication are built in, and failures come back as clear notifications such as NO_PROPOSAL_CHOSEN or TS_UNACCEPTABLE. It is not backwards compatible, so both ends must agree. I use it for every new tunnel.

NAT traversal (NAT-T). ESP is IP protocol 50 and has no ports, so a NAT device cannot track it. IKE detects the NAT in its first exchange, both sides move to UDP (User Datagram Protocol) 4500 and wrap ESP in UDP, and keepalives hold the NAT entry open. Firewalls in the path must allow UDP 500, UDP 4500 and ESP.

Animation
What IPsec adds to every packet Four packet layouts. A plain packet has an IP header, a TCP header and data. ESP tunnel mode adds a new IP header, an ESP header, an initialisation vector, a trailer and an integrity check value, and encrypts the original packet. GRE over IPsec in transport mode adds a GRE header inside ESP. NAT traversal adds a UDP header on port 4500. IP20TCP20Dataup to 1,460A normal 1,500 byte packet: no overhead New IP20ESP8IV8IP20TCP20DataTrailerpad + 2ICV16encryptedcovered by the integrity checkTunnel mode with AES-256-GCM adds about 54 to 57 bytes IP20ESP8IV8GRE4 or 8IP20TCP20DataTrailerpad + 2ICV16encryptedcovered by the integrity checkGRE over IPsec in transport mode adds about 58 to 65 bytes New IP20UDP4500ESP8IV8IP20TCP20DataTrailerpad + 2ICV16encryptedcovered by the integrity checkNAT traversal adds 8 more bytes for the UDP header Not to scale. Byte counts are for IPv4. on the wire

Swipe sideways to see the whole diagram.

A plain packet. A 1,500 byte IPv4 (Internet Protocol version 4) packet carries 20 bytes of IP header, 20 bytes of TCP (Transmission Control Protocol) header and up to 1,460 bytes of data. That 1,460 is the TCP maximum segment size (MSS) on an ordinary Ethernet path.

ESP tunnel mode. The whole original packet is encrypted and wrapped in a new IP header. ESP (Encapsulating Security Payload, IP protocol 50) adds its header, an initialisation vector (IV), padding, a 2 byte trailer and a 16 byte integrity check value (ICV). AH (protocol 51) gives integrity only and breaks with NAT, so I do not use it.

GRE over IPsec. GRE (Generic Routing Encapsulation, protocol 47) adds 4 bytes, or 8 with a tunnel key as DMVPN (Dynamic Multipoint Virtual Private Network) uses, plus the 20 byte delivery header. IPsec then protects it in transport mode, so no second IP header is needed. GRE carries multicast, which is why routing protocols can run over it.

With NAT traversal. A UDP header on port 4500 sits in front of ESP so NAT devices can track the flow. It costs another 8 bytes, which matters when the path is already close to its limit.

Animation

The crypto settings I use

SettingWhat I use todayWhat I remove
IKE versionIKEv2 (Internet Key Exchange version 2)IKEv1 (Internet Key Exchange version 1) aggressive mode
EncryptionAES-256-GCM, which also gives integrityDES (Data Encryption Standard) and 3DES
Integrity and PRF (pseudorandom function)SHA-256 or stronger where GCM (Galois/Counter Mode) is not usedMD5 (Message Digest 5) and SHA-1
Diffie-HellmanGroups 19, 20 or 21 (elliptic curve), at least group 14Groups 1, 2 and 5
AuthenticationCertificates at scale, long random pre shared keys for a few tunnelsShort or reused pre shared keys
Perfect forward secrecyOn, with the same strong groupOff, or a weak group on phase 2 only
LifetimesCisco defaults: 86,400 seconds for the IKE SA, 3,600 for IPsec SAsMismatched lifetimes between vendors

Route based, not policy based

A policy based VPN uses a crypto ACL (access control list) and a crypto map: one pair of SAs per subnet pair, and no routing protocols. A route based VPN uses a virtual tunnel interface (VTI): anything routed into it is encrypted, OSPF or BGP can run over it, and it shows up in monitoring like any link. I build route based tunnels.

Mixing the two

When a route based end meets a policy based end, the proxy IDs must match exactly, or phase 2 fails with TS_UNACCEPTABLE. I set specific proxy IDs on the route based side, for example on a Palo Alto firewall, and keep a record of every pair.

Dead peer detection

DPD (dead peer detection) sends a check when no traffic has arrived for a while, so a dead peer is noticed and the SAs are cleared. Without it, a tunnel can look up for hours while nothing passes.

A route based IKEv2 tunnel on Cisco IOS XE. Keys and addresses are examples.

crypto ikev2 proposal PROP-GCM
 encryption aes-gcm-256
 prf sha384
 group 20
crypto ikev2 policy POL-1
 proposal PROP-GCM
crypto ikev2 keyring KR-DC
 peer DC
  address 203.0.113.10
  pre-shared-key <long random key>
crypto ikev2 profile IKEV2-DC
 match identity remote address 203.0.113.10 255.255.255.255
 authentication remote pre-share
 authentication local pre-share
 keyring local KR-DC
 dpd 10 3 on-demand
crypto ipsec transform-set TS-GCM esp-gcm 256
 mode tunnel
crypto ipsec profile IPSEC-DC
 set transform-set TS-GCM
 set pfs group20
 set ikev2-profile IKEV2-DC
!
interface Tunnel10
 ip address 172.16.10.1 255.255.255.252
 ip mtu 1400
 ip tcp adjust-mss 1360
 tunnel source GigabitEthernet0/0/0
 tunnel destination 203.0.113.10
 tunnel mode ipsec ipv4
 tunnel protection ipsec profile IPSEC-DC

Which encryption on which link

LinkWhat I useWhy
Any to any MPLS L3VPNGETVPN (Group Encrypted Transport VPN) with a key serverEncrypts with group keys and keeps the original IP header, so carrier routing and QoS still work
Dark fibre, owned DWDM or carrier Ethernet between data centresMACsec (IEEE 802.1AE), or WAN MACsec on carrier EthernetLine rate AES (Advanced Encryption Standard) with GCM in hardware, at most 32 extra bytes per frame, decrypted at each hop
Routed WAN, internet and cloud backup pathsIPsecWorks over any IP path and meets the PCI DSS (Payment Card Industry Data Security Standard) rule for strong cryptography over public networks, but costs more per Gbps and adds the bytes counted in the MTU section
Between data centre fabrics over any routed networkCloudSec between fabric border gateways or ACI (Application Centric Infrastructure) spinesEncrypts the VXLAN (Virtual Extensible Local Area Network) overlay itself, so the transport in between can be anything
Application to applicationTLS (Transport Layer Security) 1.2 or 1.3, and mutual TLS between servicesStill needed end to end, because link encryption stops at every device
Every optionKeys from a key management system, rotated on a scheduleEncryption also hides traffic from intrusion detection, so I plan where inspection happens
GRE and DMVPN

Tunnels that build themselves on demand

GRE gives me a tunnel that can carry routing protocols. DMVPN adds multipoint GRE, NHRP (Next Hop Resolution Protocol) and IPsec, so a hub with one configuration serves every spoke and spokes talk directly when they need to. My home lab uses DMVPN as the backup path between its three sites.

DMVPN builds spoke to spoke tunnels on demand A hub and two spokes are joined across the internet by multipoint GRE tunnels protected by IPsec. The spokes register their tunnel and real addresses with the hub. In phase 1 all spoke to spoke traffic passes through the hub. In phase 3 the hub sends a redirect, spoke 1 asks for spoke 2's real address, spoke 2 answers, and a direct encrypted tunnel forms between the spokes. INTERNET · REAL (NBMA) ADDRESSES HubNHS · 10.0.0.1 Spoke 110.0.0.11 Spoke 210.0.0.12 NHRP cache: 10.0.0.11 is 198.51.100.11, 10.0.0.12 is 192.0.2.12 Phase 1: every spoke to spoke packet through the hub Hub sends an NHRP redirect to spoke 1 Spoke 2 answers with its real address Direct encrypted tunnel, shortcut route installed 198.51.100.11192.0.2.12203.0.113.1

Swipe sideways to see the whole diagram.

Step 1
  1. Each spoke registers its tunnel address and its real internet address, the NBMA (non broadcast multiple access) address, with the hub, which is the NHRP (Next Hop Resolution Protocol) server. The hub needs no per spoke configuration, which is why DMVPN (Dynamic Multipoint VPN) scales to hundreds of sites.

  2. In phase 1, and at the start of every new flow in phase 3, spoke to spoke traffic goes through the hub. It works, but the hub carries everything and adds latency.

  3. In phase 3 the hub notices traffic going out the same tunnel it came in on, and sends an NHRP redirect to spoke 1: there is a better path. This needs ip nhrp redirect on the hub.

  4. Spoke 1 sends a resolution request, which the hub forwards to spoke 2. Spoke 2 replies straight to spoke 1 with its real address. This needs ip nhrp shortcut on the spokes.

  5. Spoke 1 builds an IPsec protected GRE tunnel straight to spoke 2 and installs a shortcut route. The hub can now advertise just a summary or a default route, which phase 2 cannot do.

The three DMVPN phases

PhaseSpoke to spoke trafficRouting at the hubNotes
1Always through the hubCan summariseSimple hub and spoke. With EIGRP, turn off split horizon on the hub
2Direct, once resolvedMust keep each spoke's next hop: no summariesEIGRP needs no ip split-horizon eigrp and no ip next-hop-self eigrp on the hub. OSPF needs broadcast type with the hub as DR (designated router) and spokes at priority 0
3First packets via the hub, then directCan summarise to a defaultRedirect on the hub, shortcut on the spokes. OSPF point to multipoint works. My default for new builds

Plain GRE

GRE adds 24 bytes and carries multicast, so OSPF and EIGRP can run over it. It does not encrypt anything. Keepalives such as keepalive 10 3 bring the tunnel down when the far end stops answering.

The recursive routing trap

If the route to the tunnel destination is learned through the tunnel itself, the tunnel flaps with %TUN-5-RECURDOWN. I keep the destination reachable only through the underlay, with a static route or a filter.

Same key everywhere

Every DMVPN router in a cloud needs the same tunnel key, and the same NHRP authentication string if one is set. A mismatch looks like a spoke that never registers. The NHRP network ID only matters on the router itself, but I keep it the same everywhere so configurations read alike.

DMVPN phase 3 on Cisco IOS XE, hub and spoke

! hub
interface Tunnel0
 ip address 10.0.0.1 255.255.255.0
 ip nhrp network-id 100
 ip nhrp map multicast dynamic
 ip nhrp redirect
 ip mtu 1400
 ip tcp adjust-mss 1360
 tunnel source GigabitEthernet0/0/0
 tunnel mode gre multipoint
 tunnel key 100
 tunnel protection ipsec profile DMVPN
! spoke
interface Tunnel0
 ip address 10.0.0.11 255.255.255.0
 ip nhrp network-id 100
 ip nhrp nhs 10.0.0.1 nbma 203.0.113.1 multicast
 ip nhrp shortcut
 ip mtu 1400
 ip tcp adjust-mss 1360
 tunnel source GigabitEthernet0/0/0
 tunnel mode gre multipoint
 tunnel key 100
 tunnel protection ipsec profile DMVPN
! check it
show dmvpn
show ip nhrp
show crypto session
MTU

Every tunnel costs bytes, so I count them

The maximum transmission unit (MTU) is the largest packet a link carries without splitting it. Tunnels eat into it, and getting it wrong causes one of the most confusing faults there is. Try the calculator with the layers you plan to stack.

Tunnel MTU calculator

Pick the path and the layers you stack on it. The numbers are worst case for IPv4, including the largest padding each cipher can add.

Overhead, worst case65 bytes
Largest inner packet1,435 bytes
Largest TCP segment (MSS)1,395 bytes
My standard ip mtu 1400 and MSS 1360Fits, with 35 bytes to spare

This is a DMVPN style tunnel: GRE with a key, protected by IPsec in transport mode.

Why large transfers hang

Every tunnel adds headers, so a full size packet no longer fits the path. If the do not fragment bit is set, the router drops it and should send back ICMP type 3 code 4. When a firewall blocks that message, path MTU discovery (PMTUD) fails silently: pings and logins work, file copies and large web pages stall.

Clamp TCP, allow ICMP

On each tunnel I set ip mtu and ip tcp adjust-mss so TCP never sends a segment that is too big, and I allow ICMP type 3 code 4 through firewalls. MSS clamping only helps TCP, so UDP applications need the right MTU as well.

Test it the same way every time

A ping with the do not fragment bit at decreasing sizes finds the real limit: ping 10.2.1.10 source Vlan10 size 1400 df-bit on Cisco, or ping -f -l 1372 on Windows, where 1,372 plus 28 bytes of headers makes 1,400.

WAN QoS

Deciding what waits when the link is full

Quality of service (QoS) cannot add bandwidth. It decides who goes first and who waits when a link is congested, which on a WAN is most busy afternoons. I design it as a small set of classes, applied the same way at every site.

Quality of service on a WAN link Traffic enters a classifier that marks voice, video, business and other traffic with DSCP values. Each class gets its own queue. A scheduler serves the voice queue first as a low latency queue, gives the other classes guaranteed shares and drops early from the default queue with WRED. A shaper then smooths the output to the 200 Mb/s contracted rate on a 1 Gb/s port. voice video business other Classifymark DSCP EF 46 · voice AF41 · video AF21 · business apps 0 · everything else ScheduleLLQ, CBWFQ Shape200 Mb/s Mark at the trust boundary, then trust the marking One queue per class Voice first, policed to its share in congestion Each class keeps a guaranteed share Port runs at 1 Gb/s, contract is 200 Mb/s: shape to 200 10% priority 30% 30% 25% WRED drops early Shares are indicative. Queuing only acts when the link is congested.

Swipe sideways to see the whole diagram.

Step 1
  1. At the edge of my network I classify traffic and set a DSCP (Differentiated Services Code Point) value. I use EF (expedited forwarding) 46 for voice, AF41 (assured forwarding, class 4) for video, AF21 (assured forwarding, class 2) for business applications and 0 for the rest. Markings from user devices are not trusted unless I choose to.

  2. Class based weighted fair queuing (CBWFQ) gives each class its own queue and a guaranteed share of the link when it is congested. When the link is not busy, nothing is held back.

  3. Low latency queuing (LLQ) adds a strict priority queue for voice. It is always served first, so jitter stays low. During congestion it is policed to its configured rate, so voice can never starve everything else. I keep all priority classes to about a third of the link.

  4. The other classes get their guaranteed shares. In the default class, weighted random early detection (WRED) drops a few packets before the queue is full, so TCP flows slow down gradually instead of all at once.

  5. The carrier port runs at 1 Gb/s but the contract is 200 Mb/s. Without a shaper the carrier polices my traffic and drops it blindly. Shaping to 200 Mb/s, with the queues nested inside the shaper (hierarchical QoS), means I choose what waits and what drops.

Policing compared with shaping A chart of traffic rate over time with a contracted rate line. The offered traffic bursts above the line three times. With policing, everything above the line is dropped at once. With shaping, the excess is held in a buffer and sent later, so the output stays at the line for longer but nothing above it is lost. RateTime contract 200 Mb/s offered traffic Above the rate is dropped at once Above the rate waits in a buffer, then goes

Swipe sideways to see the whole diagram.

Policing. Traffic above the rate is dropped or re marked immediately, in either direction. TCP sees the loss and backs off hard, so throughput saws up and down. Carriers police at their edge, which is why I never send them more than the contract.

Shaping. Traffic above the rate waits in a buffer and is sent when there is room. It adds a little delay but avoids loss, and it only works outbound. I shape at the WAN edge to the contracted rate, or a little under it if the carrier counts Layer 2 overhead differently, then queue inside the shaper.

Animation

The class model I start from

ClassDSCPQueueTypical share
VoiceEF (46)Priority queue, policedAbout 10%
Interactive videoAF41 (34)Bandwidth guaranteeAbout 20 to 30%
Routing and network controlCS6 (48)Small guarantee so keepalives survive congestionAbout 5%
Business applicationsAF21 (18) or AF31 (26)Bandwidth guaranteeAbout 25 to 30%
Default0Fair queue with WREDWhat is left, at least 25%
Scavenger, such as backupsCS1 (8)Minimum share, dropped firstAbout 1 to 5%

Hierarchical QoS on Cisco IOS XE: queue inside a 200 Mb/s shaper

policy-map CHILD-WAN
 class VOICE
  priority percent 10
 class VIDEO
  bandwidth percent 30
 class BUSINESS
  bandwidth percent 30
 class class-default
  bandwidth percent 25
  fair-queue
  random-detect dscp-based
policy-map PARENT-SHAPE
 class class-default
  shape average 200000000
  service-policy CHILD-WAN
interface GigabitEthernet0/0/0
 service-policy output PARENT-SHAPE
! check it
show policy-map interface GigabitEthernet0/0/0
Remote access

Giving remote users just the access they need

Remote access VPN (virtual private network) connects a user, not a site. The design choice is how much of their traffic goes through the company, and how tightly access is checked.

Three ways to give remote users access A remote laptop reaches corporate applications and the internet three ways. With a full tunnel, everything goes through the VPN headend, including internet traffic. With a split tunnel, only corporate ranges use the tunnel and internet traffic goes direct. With zero trust network access, a cloud access broker connects the user to one approved application at a time and also protects internet traffic. Remote userlaptop VPN headendfirewall Corporate appsdata centre Internet and SaaSweb, Microsoft 365 Access brokercloud security Everything through the tunnel Only corporate ranges through the tunnel One application at a time, after identity and device checks

Swipe sideways to see the whole diagram.

Full tunnel. Every packet from the laptop goes to the headend, so the same firewall policy and logging apply at home as in the office. The cost is bandwidth and latency at the headend, and SaaS (software as a service) traffic takes the long way round.

Split tunnel. Only corporate address ranges use the tunnel. Internet and trusted SaaS traffic, such as Microsoft 365, go direct. It saves headend capacity, but the laptop needs its own protection for the traffic that skips the tunnel.

Zero trust network access (ZTNA). A broker checks the user and the device on every request, then connects them to one application, never to a whole network. Combined with cloud security for internet traffic, this is the SASE (secure access service edge) model. More on the security page.

Animation

Strong sign in

Remote access uses multi factor authentication (MFA), usually through SAML (Security Assertion Markup Language) single sign on to the identity provider, and a certificate on managed devices so a stolen password alone is not enough.

Check the device

Posture checks confirm the operating system is patched and protection is running before access is given. A device that fails gets a remediation network, not the corporate one.

Plan the headend

Cisco Secure Client (formerly AnyConnect) uses TLS with DTLS (Datagram Transport Layer Security) for the data, or IKEv2. I size the headend for licences, concurrent sessions and throughput, and keep a second headend in another site.

Troubleshooting

Finding a VPN fault one phase at a time

A tunnel fails at one specific stage, and each stage leaves its own evidence. I work through them in order, from the underlay up, and never change two things at once. Choose a symptom to see where it fails and what I run. My general method is on the troubleshooting page, and vendor firewall detail is on the firewall platforms page.

A phase by phase IPsec fault finder Five checks in order: underlay reachability, phase 1, phase 2, traffic counters and packet size. For each symptom, test traffic flows as far as the stage that fails and stops there. A panel shows what I see and the command I run for that symptom. Underlayreach the peer Phase 1IKE SA Phase 2IPsec SAs Trafficencaps, decaps SizeMTU and MSS What I seeWhat I run Symptom: No SA at all show crypto ikev2 sa shows nothingping 203.0.113.10 source GigabitEthernet0/0/0 Symptom: Phase 1 never completes IKEv2 SA stuck in IN-NEG, or IKEv1 MM_NO_STATEdebug crypto condition peer ipv4 203.0.113.10 Symptom: Works until a NAT appears UDP 500 works, nothing arrives on UDP 4500show crypto ikev2 sa detailed Symptom: Phase 1 up, phase 2 fails TS_UNACCEPTABLE or proxy identities not supportedshow crypto ipsec sa peer 203.0.113.10 Symptom: Tunnel up, nothing comes back #pkts encaps: 120 #pkts decaps: 0show crypto ipsec sa | include encaps|decaps Symptom: Tunnel up, large transfers hang size 1400 with df-bit fails, size 1300 worksping 10.2.1.10 source Vlan10 size 1400 df-bit

Swipe sideways to see the whole diagram.

No SA at all. Nothing has tried to build the tunnel. Either no interesting traffic has arrived, the crypto map or tunnel protection is not applied, or there is no route to the peer. I check underlay reachability from the outside interface first, then send traffic from an inside host to trigger the tunnel.

Phase 1 never completes. An IKEv2 SA stuck in IN-NEG, or MM_NO_STATE on IKEv1, with retransmissions means the peer is not answering: UDP 500 blocked, the wrong peer address, or the peer not configured. atts are not acceptable or NO_PROPOSAL_CHOSEN is a proposal mismatch. Stuck at MM_KEY_EXCH or AUTHENTICATION_FAILED points to the pre shared key, identity or certificate.

Only fails behind NAT. The first exchange on UDP 500 works, but once NAT is detected both sides move to UDP 4500, which a firewall is blocking. I allow UDP 4500, check NAT traversal is on, or move the tunnel to IKEv2 where it is built in.

Phase 1 up, phase 2 fails. Usually the proxy IDs or crypto ACLs are not exact mirrors, the most common VPN fault of all. Otherwise the transform sets differ or perfect forward secrecy is on at one end only. I compare both configurations line by line on a call with the far end.

One way only. Encaps rising with no decaps means my side is sending but nothing returns. The far end may be missing a route back, its NAT may be translating replies before encryption, or ESP may be blocked on the way back. Encaps at zero means my own traffic is not reaching the tunnel, often because NAT needs an exemption for VPN traffic.

Large transfers hang. The tunnel overhead pushes full size packets over the path MTU, and ICMP type 3 code 4 is blocked, so path MTU discovery fails. I set ip mtu 1400 and ip tcp adjust-mss 1360 on the tunnel and allow the ICMP message through.

Animation

WAN faults I see most

SymptomWhat I checkUsual causeFix
A site has lost its MPLS routesOne site or many? Carrier notices and my change calendar. Interface errors, then show ip bgp summary and the routes received and advertisedCarrier fault, BGP down, an inbound filter or maximum prefix limit, or a loop rejection when every site shares one ASCarrier ticket with circuit ID, timestamps, counters and BGP state. allowas-in or as-override for a shared AS
A remote site has lost its WANReach the router over the backup or out of band path. show interfaces: down/down is physical, up/down is Layer 2, up/up with no routes is routing. show trackCarrier fault, a dead router, or a failover that never triggeredCarrier ticket, local hands to check the network terminating equipment, a spare router with the saved configuration
An application is slow at one siteWhich app, which users, since when. traceroute for a silent move to the backup path, show policy-map interface for class drops, a capture for retransmissionsRunning on the backup path, the wrong QoS class, MTU, or latency limiting the TCP windowRestore the primary, fix the classification, move bulk jobs, or add capacity with data to back it
Voice breaks up at busy timesDrops in the priority class, or voice landing in the default classWrong marking at the trust boundary, a priority class that is too small, or no shaperMark at the edge, size the priority class, shape below the contract
A GRE tunnel keeps flappingshow ip route for the tunnel destination, and %TUN-5-RECURDOWN in the logThe destination is learned through the tunnel itselfReach the destination only through the underlay
A DMVPN spoke never registersshow dmvpn, show ip nhrp nhs, then the IPsec stateA tunnel key or NHRP authentication mismatch, the wrong NHS (next hop server) or NBMA address, or IPsec failing underneathAlign the values, then fix IPsec phase by phase

Commands by task

What I want to knowCisco IOS XEOther platforms
Is phase 1 up?show crypto ikev2 sa or show crypto isakmp saASA (Adaptive Security Appliance) show crypto ikev2 sa, FortiGate diagnose vpn ike gateway list, Palo Alto show vpn ike-sa
Is traffic being encrypted both ways?show crypto ipsec sa peer 203.0.113.10ASA show vpn-sessiondb l2l, Palo Alto show vpn ipsec-sa
Why did it fail?debug crypto condition peer ipv4 203.0.113.10, then debug crypto ikev2, and undebug all afterFortiGate diagnose debug application ike -1, Palo Alto tail follow yes mp-log ikemgr.log
DMVPN stateshow dmvpn, show ip nhrp
MPLS and L3VPNshow mpls ldp neighbor, show mpls forwarding-table, show ip bgp vpnv4 all summary, show ip route vrf ITS
Did failover work?show ip sla statistics, show track, show ip route 0.0.0.0
Is QoS dropping?show policy-map interface GigabitEthernet0/0/0
Engagement

How I run a WAN programme, from circuit order to refresh

WAN work is slow to change and expensive to get wrong, because circuits take weeks to arrive and contracts last years. I follow the same path every time: agree the outcome, prove the facts, design for failure, then hand over something the support teams can run.

How an engagement runs, from first conversation to lifecycle Seven stages from left to right: engage (stakeholders), requirements (FR and NFR), discovery (facts first), design (HLD and LLD), build and test (lab and pilot), support (handover), lifecycle (keep current). For each stage the panel shows who I work with and what comes out of it. After the lifecycle stage the loop returns to the start. Engagestakeholders RequirementsFR and NFR Discoveryfacts first DesignHLD and LLD Buildlab and pilot Supporthandover Lifecyclekeep current Step 1 · EngageAgree why the WAN is changingWho I work withWhat comes outNetwork and security leadsFinance and procurementSite and regional managersGoals: cost, resilience or performanceSite list and prioritiesContract dates and constraintsDecision log and RACI Step 2 · RequirementsWhat each site needs, with numbersWho I work withWhat comes outApplication ownersSecurity and riskService deskRequirements by site tierBandwidth, latency and loss targetsEncryption and segmentation rulesFailover and recovery targets Step 3 · DiscoveryCircuits, routing and traffic as they areWho I work withWhat comes outCarriers and account teamsSite contactsNetwork operations centreCircuit inventory and contract endsTraffic profile per siteRouting and failover as builtGaps and risks Step 4 · DesignA pattern per site tierWho I work withWhat comes outDesign authorityCarrier solution architectsSecurity architectsCircuit and diversity designRouting, VPN and QoS standardsIP plan and namingTest and rollback plans Step 5 · Build and testProve failover before the first cutoverWho I work withWhat comes outEngineers and carrierPilot site contactsChange advisory boardLab tested configurationFailover and QoS test resultsPilot sign offCutover runbooks per site Step 6 · SupportMonitoring and runbooks before go liveWho I work withWhat comes outService desk and NOCCarrier service desksProblem managerMonitoring and alert thresholdsCarrier escalation contactsRunbooks and known errorsHypercare exit criteria Step 7 · LifecycleContracts, software and hardwareWho I work withWhat comes outProcurement and financeVendor account teamsDesign authorityContract and renewal calendarSoftware and patch planEnd of life registerCapacity reviews

Swipe sideways to see the whole diagram.

Step 1
  1. I start by agreeing why the WAN is changing: a contract ending, a new site, poor application performance or a security finding. I write the goals as measures, and agree who decides on cost, risk and timing (a RACI: responsible, accountable, consulted, informed).

  2. I group sites into tiers, such as data centre, hub, large branch and small branch, and agree requirements per tier. Functional requirements say what each site must reach. Non functional ones set bandwidth, latency, loss, failover time and encryption.

  3. I build the circuit inventory from bills and carrier portals, then check it against what the routers actually show. Flow data shows what crosses each link, and the routing tables show how failover really behaves, which is often not what the drawings say.

  4. I design one pattern per site tier: circuits and real diversity, CE to PE routing, the VPN and encryption standard, QoS classes and failover. The high level design (HLD) and low level design (LLD) go to the design authority before anything is ordered.

  5. I test the configuration and every failure case in a lab, then pilot on a few sites. Each cutover has a runbook, a rollback point and a test list: routing, failover, voice quality and the key applications, checked before the change is closed.

  6. Before go live, every circuit is in monitoring with its ID, carrier contacts and escalation route. The network operations centre (NOC) gets runbooks for the common faults, and hypercare ends only when the agreed exit criteria are met.

  7. WAN contracts, router software and hardware all have end dates. I keep a renewal calendar, a patch plan for security advisories and an end of life register, and review capacity every quarter so upgrades are ordered before they are urgent.

Functional requirements

What it must do.

  • Connect every site to the data centres, cloud and internet over at least two paths for sites that matter.
  • Keep business, guest, voice and management traffic separate across the WAN.
  • Encrypt traffic on any circuit the organisation does not control.
  • Give voice and video priority over bulk traffic on every congested link.
  • Fail over automatically when the main path stops working, including faults beyond the next hop.
  • Let remote users reach the applications they need, with strong sign in.

Non functional requirements

How well it must do it, with a number wherever one can be agreed.

Availability
99.99% for data centres and hubs, 99.9% for branches with two circuits.
Failover
Under 1 second with BFD on dynamic routing, under 30 seconds with tracked static routes.
Performance
Voice between any two sites: one way delay under 150 ms (ITU-T G.114), jitter under 30 ms and loss under 1%, measured by IP SLA probes.
Capacity
Busy hour use under 70% of the contracted rate, reviewed every quarter.
Security
IKEv2, AES-256-GCM and certificates for site to site tunnels, MFA for remote access.
Diversity
Separate ducts, exchanges and carrier points of presence for dual circuits, proven in writing.
Operability
Every circuit monitored, with its ID and carrier escalation route recorded.

These are typical starting targets for a WAN. Each organisation sets its own per site tier, and each number is traced to a carrier SLA or a test.

Projects

Where I have built and run it

WAN work has run through my whole career, from carrier networks to global refreshes. My lab keeps the hands on side of it current.

Home lab

MPLS L3VPN with a DMVPN backup

Two P routers and five PE routers carry two customers in separate VRFs. Each of the three main sites fails over to DMVPN tunnels across a simulated internet. See the topology.

BNY Mellon · 2018 to 2019

A refresh across Europe, the Middle East and Africa

Audit, high and low level design and implementation of LAN (local area network), WAN, SD-WAN and data centre infrastructure, replacing end of life equipment with minimal impact on global operations.

AVEVA · 2020 to 2021

Every site, upgraded remotely

Designed and built LAN and WAN on Catalyst SD-WAN, SD-Access and Catalyst Center, and upgraded every global site remotely during the lockdowns through local enablement, with no delay.

BT · 2013

Enterprise site connectivity

High and low level designs for enterprise customers including Rolls Royce, Virgin Money, Rio Tinto and Primark, including manufacturing and mining site connectivity with control networks kept apart from corporate IT (information technology).

JJ Food Wholesale · 2007 to 2011

A group wide WAN

LAN, WAN, VoIP (voice over IP), virtualisation and security across the group, including the warehouse and cold chain systems at the food depots, linked to the group ERP (enterprise resource planning).

Passport Telecom · 2004 to 2007

Carrier scale beginnings

Cisco based telecoms infrastructure for over 4,000 clients across East Africa and South America.

Backed by CCNP (Cisco Certified Network Professional) Enterprise and CCNP Routing and Switching, with the CCIE (Cisco Certified Internetwork Expert) Routing and Switching and CCIE Security written exams passed. See all credentials