Cisco IOS
DMVPN Generator
Generate Cisco DMVPN hub/spoke configs with optional IPsec - Phase 1, 2 and 3
What is DMVPN?
Dynamic Multipoint VPN (DMVPN) is a Cisco IOS solution combining mGRE (Multipoint GRE), NHRP (Next Hop Resolution Protocol), and optionally IPsec to create a scalable hub-and-spoke overlay. Spokes register their public IPs with the hub dynamically, enabling on-demand spoke-to-spoke tunnels without per-spoke static config on the hub.
- Spokes can have dynamic public IPs (DHCP from ISP) — no static config required on the hub.
- Phase 2/3 allows spoke-to-spoke traffic to go directly without hairpinning through the hub.
- Supports multicast (unlike plain IPsec) — OSPF, EIGRP, and BGP work over the tunnel.
- Single mGRE interface on the hub replaces hundreds of point-to-point GRE tunnels.
- IPsec is optional: skip it on trusted private WAN, add it for public internet deployments.
DMVPN Phases
| Phase | Spoke-to-Spoke | How it Works | Routing Notes |
|---|---|---|---|
| Phase 1 | Always via Hub | Classic hub-and-spoke. All traffic flows through hub. Simplest to configure. | Any dynamic routing protocol. Hub may summarize spoke routes. |
| Phase 2 | Direct after first packet | Hub sends NHRP redirect. Spoke learns peer NBMA IP and builds a direct mGRE tunnel dynamically. | EIGRP: disable split-horizon on hub. OSPF: point-to-multipoint. |
| Phase 3 | Direct, scalable | Hub sends NHRP redirect; spoke sends NHRP resolution. Requires ip nhrp redirect on hub. Most scalable. | BGP or EIGRP named mode recommended. No split-horizon issues. |
Protocol Stack
Key Components
| Component | Role | Details |
|---|---|---|
| mGRE | Tunnel encapsulation | Single tunnel interface on hub handles all spokes. tunnel mode gre multipoint. |
| NHRP | Address resolution | Maps tunnel (overlay) IPs to NBMA (public) IPs. Like ARP for the tunnel subnet. |
| NHS | Next Hop Server (Hub) | Hub stores the NHRP registration database. Spokes register at boot. |
| NHC | Next Hop Client (Spoke) | Spoke registers its NBMA IP with the hub NHS on startup. |
| NBMA IP | Public/underlay IP | Real routable IP used to reach the device — may be dynamic DHCP from ISP. |
| Tunnel IP | Overlay IP | IP on the tunnel interface — forms the DMVPN subnet (e.g. 10.0.0.0/24). |
| IPsec Profile | Optional encryption | Attached via tunnel protection ipsec profile. Uses transport mode. |
Routing Over DMVPN
| Protocol | Phase 1 | Phase 2 | Phase 3 | Notes |
|---|---|---|---|---|
| EIGRP | Disable split-horizon on hub | Named mode | Most common on Cisco. Use no ip split-horizon eigrp on hub tunnel for Phase
2. See BGP & EIGRP tool. | |
| OSPF | point-to-multipoint | point-to-multipoint | Set ip ospf network point-to-multipoint on tunnel. See OSPF Generator. | |
| BGP | Recommended | Best for Phase 3 at scale. No split-horizon issues. See BGP & EIGRP tool. | ||
| Static | Very small deployments only. See Static Route Generator. |
Show & Verify Commands
| Command | Purpose |
|---|---|
| show dmvpn | DMVPN session table — state, NBMA IPs, tunnel IPs, uptime |
| show dmvpn detail | Full NHRP and tunnel session details per peer |
| show ip nhrp | NHRP cache — tunnel-to-NBMA IP mappings |
| show ip nhrp detail | Full NHRP entry details including flags and expiry |
| show tunnel endpoints | Active GRE/mGRE tunnel endpoints |
| show crypto ikev2 sa | IKEv2 SA state and stats (if IPsec used) |
| show crypto ipsec sa | IPsec SA — encrypt/decrypt packet counters |
| show crypto isakmp sa | IKEv1 Phase 1 SA (legacy, if IKEv1 used) |
| show ip route | Verify routing protocol learned routes over tunnel |
| debug nhrp | NHRP registration and redirect debug — use with caution in production |
IPsec SA Resync
When the SAs of the peers get out of sync between peer devices, use the following commands to force a resync.
Force SA resync with a specific peer:
clear crypto sa peer _____
Find and clear a specific ISAKMP SA by connection ID:
show crypto isakmp sa
! Note the conn-id from the output, then clear by ID:
clear crypto isakmp conn_id <conn-id>
Verify IPsec peer sessions:
show crypto ipsec sa | i peer
DMVPN Hub — mGRE Only (No IPsec)
For trusted private WAN where encryption is not required. Supports EIGRP, OSPF, or BGP over the tunnel interface.
Use the Password Generator tool in the Security section to create a strong random key, then paste it here on the hub and all spokes.
conf t
hostname HUB-R1
!
! -- Tunnel Interface -----------------------------------------
interface Tunnel0
description DMVPN Hub Tunnel Phase 3 (No Encryption)
ip address 10.0.0.1 255.255.255.0
no ip redirects
ip nhrp authentication DMVPN-KEY
ip nhrp network-id 1
ip nhrp map multicast dynamic
ip nhrp redirect
tunnel source GigabitEthernet0/0
tunnel mode gre multipoint
tunnel key 1
!
!
router eigrp 100
network 10.0.0.0 0.0.255.255
no auto-summary
!
end
! copy running-config startup-config - Spokes register to NBMA IP: 203.0.113.1
- All spokes must use NHRP network-id 1 and auth key.
ip nhrp redirectrequired on hub for Phase 3 spoke-to-spoke shortcuts.- No encryption — deploy on trusted private WAN only.
- For routing config help see BGP & EIGRP or OSPF Generator in this toolkit.
DMVPN Hub — mGRE + IPsec (IKEv2)
For DMVPN overlays running over the public internet. IPsec encrypts all GRE tunnel traffic using IKEv2 with AES-256 and SHA-256.
Use the Password Generator tool in the Security section to create a strong random NHRP key, then paste it here and on all spokes.
Generate this pre-shared key with the Password Generator tool (Security section) and reuse the same value on every DMVPN spoke.
conf t
hostname HUB-R1
!
! -- IKEv2 Proposal -------------------------------------------
crypto ikev2 proposal DMVPN-PROP
encryption aes 256
integrity sha256
group14
!
crypto ikev2 policy DMVPN-POL
proposal DMVPN-PROP
!
crypto ikev2 keyring DMVPN-KEYS
peer ANY
address 0.0.0.0 0.0.0.0
pre-shared-key Str0ng-PSK-Here!
!
crypto ikev2 profile DMVPN-IKEV2
match identity remote address 0.0.0.0
authentication remote pre-share
authentication local pre-share
keyring local DMVPN-KEYS
!
! -- IPsec Transform-Set & Profile ----------------------------
crypto ipsec transform-set DMVPN-TS esp-aes-256 esp-sha256-hmac
mode transport
!
crypto ipsec profile DMVPN-IPSEC
set transform-set DMVPN-TS
set ikev2-profile DMVPN-IKEV2
!
! -- Tunnel Interface -----------------------------------------
interface Tunnel0
description DMVPN Hub Tunnel Phase 3 + IPsec
ip address 10.0.0.1 255.255.255.0
no ip redirects
ip nhrp authentication DMVPN-KEY
ip nhrp network-id 1
ip nhrp map multicast dynamic
ip nhrp redirect
tunnel source GigabitEthernet0/0
tunnel mode gre multipoint
tunnel key 1
tunnel protection ipsec profile DMVPN-IPSEC
!
!
router eigrp 100
network 10.0.0.0 0.0.255.255
no auto-summary
!
end
! copy running-config startup-config - Spokes register to NBMA IP: 203.0.113.1
- All spokes must use NHRP network-id 1 and auth key.
ip nhrp redirectrequired on hub for Phase 3 spoke-to-spoke shortcuts.- IPsec uses transport mode — GRE is encrypted, outer IP preserved for routing.
- For routing config help see BGP & EIGRP or OSPF Generator in this toolkit.
DMVPN Spoke — mGRE Only (No IPsec)
For trusted private WAN. Spoke registers dynamically with the hub NHS server at startup.
Create this NHRP key once with the Password Generator tool and paste the same value on hub and all spokes.
conf t
hostname SPOKE-R1
!
! -- Tunnel Interface -----------------------------------------
interface Tunnel0
description DMVPN Spoke Tunnel Phase 3 (No Encryption)
ip address 10.0.0.2 255.255.255.0
no ip redirects
ip nhrp authentication DMVPN-KEY
ip nhrp network-id 1
ip nhrp nhs 10.0.0.1 nbma 203.0.113.1 multicast
ip nhrp shortcut
tunnel source GigabitEthernet0/0
tunnel mode gre multipoint
tunnel key 1
!
!
router eigrp 100
network 10.0.0.0 0.0.255.255
no auto-summary
!
end
! copy running-config startup-config - Hub NHS tunnel IP: 10.0.0.1 at NBMA 203.0.113.1
- Spoke NBMA IP is auto-registered — works with dynamic DHCP from ISP.
ip nhrp shortcutenables direct spoke-to-spoke tunnels for Phase 3.- No encryption — deploy on trusted private WAN only.
- For IPsec protocol background see WAN & VPN Services → VPN tab in this toolkit.
DMVPN Spoke — mGRE + IPsec (IKEv2)
For internet-connected spoke sites. IPsec profile must match the hub. Pre-shared key must be identical on both ends.
Use the Password Generator tool to generate a strong NHRP key and reuse it across the DMVPN hub and spokes.
Generate this IKE pre-shared key in the Password Generator tool and paste the exact same value on the hub and all spokes.
conf t
hostname SPOKE-R1
!
! -- IKEv2 Proposal -------------------------------------------
crypto ikev2 proposal DMVPN-PROP
encryption aes 256
integrity sha256
group14
!
crypto ikev2 policy DMVPN-POL
proposal DMVPN-PROP
!
crypto ikev2 keyring DMVPN-KEYS
peer HUB
address 203.0.113.1
pre-shared-key Str0ng-PSK-Here!
!
crypto ikev2 profile DMVPN-IKEV2
match identity remote address 203.0.113.1 255.255.255.255
authentication remote pre-share
authentication local pre-share
keyring local DMVPN-KEYS
!
! -- IPsec Transform-Set & Profile ----------------------------
crypto ipsec transform-set DMVPN-TS esp-aes-256 esp-sha256-hmac
mode transport
!
crypto ipsec profile DMVPN-IPSEC
set transform-set DMVPN-TS
set ikev2-profile DMVPN-IKEV2
!
! -- Tunnel Interface -----------------------------------------
interface Tunnel0
description DMVPN Spoke Tunnel Phase 3 + IPsec
ip address 10.0.0.2 255.255.255.0
no ip redirects
ip nhrp authentication DMVPN-KEY
ip nhrp network-id 1
ip nhrp nhs 10.0.0.1 nbma 203.0.113.1 multicast
ip nhrp shortcut
tunnel source GigabitEthernet0/0
tunnel mode gre multipoint
tunnel key 1
tunnel protection ipsec profile DMVPN-IPSEC
!
!
router eigrp 100
network 10.0.0.0 0.0.255.255
no auto-summary
!
end
! copy running-config startup-config - Hub NHS tunnel IP: 10.0.0.1 at NBMA 203.0.113.1
- Spoke NBMA IP is auto-registered — works with dynamic DHCP from ISP.
ip nhrp shortcutenables direct spoke-to-spoke tunnels for Phase 3.- Pre-shared key must exactly match the hub IKEv2 keyring entry.
- For IPsec protocol background see WAN & VPN Services → VPN tab in this toolkit.