Why not a full mesh everywhere?
The full-mesh lesson counted what a mesh costs: with two tunnels per pair of sites, each of 400 stores would hold 798 sessions, which does not fit the 500-session example limit used there. Hub-and-spoke fits easily, but every store-to-store transfer then crosses a hub. On-demand tunnels sit between the two. A spoke starts with tunnels to the hubs only, and it builds a direct tunnel to another spoke when the two start talking.
With permanent tunnels, every spoke holds a tunnel to every other spoke whether or not they talk. With on-demand tunnels, a spoke holds tunnels to the hubs and builds a direct tunnel to another spoke only while traffic between them needs it.
| Design | Sessions on a store router | Against the 500-session example limit |
|---|---|---|
| Full mesh, 2 tunnels per pair | 798 | Over the limit |
| Hub-and-spoke with two hubs | 4 | Within the limit |
| On demand, 12 other spokes active | 28 | Within the limit |
| On demand, 120 other spokes active | 244 | Within the limit |
How an on-demand tunnel works
The Cisco documents read describe the behaviour. At first, only the BFD sessions from each spoke to the hubs are up. When traffic is sent between two spokes, the spokes build a tunnel and start BFD on it. After a period without traffic, the idle timeout, the tunnel and its BFD session are removed. A tunnel in the inactive state does not need BFD probes.
Only tunnels to the hubs are up at first. Traffic between two spokes triggers a direct tunnel. BFD starts on the new tunnel and traffic uses it. When no traffic has used it for the idle timeout, the tunnel and its BFD session are removed and traffic goes through the hub again.
- Hub paths onlyspoke tunnels goto the hubs
- Interest trafficspoke A sendsto spoke B
- Direct tunnelbuilt, BFD starts,route becomes active
- Idle timeoutno traffic for thetimer value
- Removedtunnel and BFD go,hub path again
The route table shows the same story. The route to the other spoke is present all the time but is marked as inactive and unresolved until traffic arrives, and the route through the hub carries the traffic meanwhile.
| State | Route learned through the hub | Route to the other spoke |
|---|---|---|
| Inactive, before traffic | Chosen, installed and resolved | Installed, TLOC unresolved, on-demand inactive |
| Active, after traffic | Resolved, not chosen | Chosen, installed and resolved |
| After the idle timeout | Chosen, installed and resolved | Installed, TLOC unresolved, on-demand inactive |
What the design has to provide
On-demand tunnels are not one switch. The documents read show four pieces that work together: a service on the hubs, path limits on the Controller, the on-demand setting on the spokes, and a control policy that gives the spokes a backup path through the hub. Leaving out one gives a spoke that has no path to another spoke at all, and the last case in this lesson shows one such failure.
The hubs run a TE service in the transport VPN. The Controller advertises enough paths per prefix. The spokes have on-demand enabled with an idle timer. A control policy matches the on-demand spokes and sets the hub TLOCs as a backup.
- HubsTE service in the transport VPNConfigured on the hubs
- ControllerEnough paths advertised per prefixSend path limit and ECMP limit
- SpokesOn-demand enabled, idle timeout setApplied to the spoke sites only
- PolicyMatch the spoke site listHub TLOCs as backup
| Piece | Where | What the documents show |
|---|---|---|
| TE service | Hub, transport VPN | Service of type TE, in the transport VRF |
| Path limits | Controller and OMP settings | Paths advertised per prefix and ECMP limit set to 16, called recommended |
| On-demand setting | Spokes | On-demand enabled, idle timeout of 10 minutes by default |
| Control policy | Controller, applied to the spoke sites | Match the spoke site list, accept, set the TLOC action to backup, point it at the hub TLOCs |
Reading the state of a tunnel
One command on a spoke shows the on-demand state of each remote site: whether on-demand applies to it, whether the tunnel is active, and how many seconds remain before the idle timer removes it. BR-01, site 101, has the hub and BR-02 as its remote systems in the example.
BR-01#show sdwan system on-demand remote-system SITE-ID SYSTEM-IP ON-DEMAND STATUS IDLE-TIMEOUT-EXPIRY(sec) 10 10.255.1.1 no - - 102 10.255.2.2 yes inactive -
After BR-01 sends traffic toward a prefix behind BR-02, the same command shows the tunnel active, with a countdown that restarts while traffic keeps using it.
BR-01#show sdwan system on-demand remote-system SITE-ID SYSTEM-IP ON-DEMAND STATUS IDLE-TIMEOUT-EXPIRY(sec) 10 10.255.1.1 no - - 102 10.255.2.2 yes active 541
What it saves and what it does not change
The saving is on the spokes. A spoke holds the sessions to the hubs and two more for each other spoke that is active within the idle timeout, so its count follows how many different peers it talks to in a window and not the number of sites. What does not change is the hub, which holds its sessions with every spoke, and the need for a policy and a timer to be right.
The hub keeps its sessions with every spoke. The first packets of a flow still follow the hub path. The design still needs the TE service, the path limits and the backup policy. A spoke that talks to many peers at once can still reach its own session limit.
- Hub loadsessions with everyspoke remain
- First packetstake the hub pathuntil the tunnel is up
- Policybackup path throughthe hub is required
- Busy spokesmany active peersstill add sessions
| Other spokes contacted within the idle timeout | Sessions on the spoke | Against the 500-session example limit |
|---|---|---|
| None | 4 | Within the limit |
| 3 spokes | 10 | Within the limit |
| 12 spokes | 28 | Within the limit |
| 40 spokes | 84 | Within the limit |
| 120 spokes | 244 | Within the limit |
| 248 spokes | 500 | At the limit |
| 300 spokes | 604 | Over the limit |
The table also shows how to use the idle timeout. A spoke that sends a report to a hundred branches once an hour builds up to a hundred tunnels within a few minutes, and a shorter timeout releases them sooner. A longer timeout keeps tunnels for a repeat transfer and costs sessions. The number to choose is the number of distinct peers in one timeout window at the busiest time.
A worked case: the spoke with no path to its neighbour
Priya enables on-demand tunnels for BR-01 and BR-02, two stores that exchange inventory files. A ping from BR-01 to a prefix behind BR-02 fails, and no tunnel is ever built. She looks at the route for the prefix on BR-01.
BR-01#show sdwan omp routes vpn 10 192.168.102.0/24 FROM PEER TLOC IP COLOR STATUS 10.255.0.11 10.255.2.2 biz-internet I,U,IA
The hub backup comes from the control policy, and the policy applies to the sites in its site list. The list names site 101 and not site 102, so BR-02's routes were not given the hub as a backup. After site 102 is added to the list and the policy is pushed, the same command shows the hub routes.
BR-01#show sdwan omp routes vpn 10 192.168.102.0/24 FROM PEER TLOC IP COLOR STATUS 10.255.0.11 10.255.1.1 mpls C,I,R 10.255.0.11 10.255.1.1 biz-internet C,I,R 10.255.0.11 10.255.2.2 biz-internet I,U,IA
| Check | Result in the case | What it says |
|---|---|---|
| Is the route to the other spoke present? | Yes, inactive | Routing knows the prefix |
| Is a hub backup route present? | No | The policy did not reach this site |
| Does the policy's site list include both spokes? | No, site 102 is missing | The fix is in the site list |
| Is on-demand enabled on both spokes, and the TE service on the hub? | Check next if the list is right | Each missing piece gives the same symptom |
Learn more: Full-Mesh Economics and Tunnel ScaleBest Path and Selection FactorsHub-and-Spoke versus Mesh
Test yourself
A spoke has two tunnels to each of two hubs and has contacted 12 other spokes within the idle timeout, with two sessions for each. How many sessions does it hold?
What starts the building of an on-demand tunnel between two spokes?
BR-01 shows the route to BR-02 as installed, unresolved and on-demand inactive, and there is no hub route for that prefix. What is the most likely gap?
What is the default idle timeout in the Cisco documentation read?
Where is the on-demand setting applied, according to the Cisco configuration steps?
A design moves from permanent spoke tunnels to on-demand tunnels. What happens to the number of sessions on each hub?
The example limit is 500 sessions, a spoke has four sessions to the hubs and two for each active peer. How many active peers reach the limit?
Which command shows whether the tunnel to each remote site is active and how long remains on its idle timer?