Production-ready guide covering software-defined wan architecture design with implementation patterns, code examples, and anti-patterns for enterprise engineering teams.
A Software-Defined WAN (SD-WAN) architecture integrates centralized control, dynamic path selection, and policy-driven traffic engineering across geographically dispersed networks. It matters when organizations need consistent, adaptive connectivity between data centers, branch offices, and cloud services—especially when traffic patterns vary, latency-sensitive applications demand quality of service, and network outages must be mitigated with minimal disruption.
Traffic in an SD-WAN is shaped by policies that define how packets are routed based on application, location, and network conditions. Policies are evaluated in order, with the first matching rule applying.
Each policy rule consists of:
A policy is represented as a JSON object in a standard format:
{
"id": "web-traffic-priority",
"match": {
"applications": ["HTTP", "HTTPS"],
"source_networks": ["10.0.0.0/24", "172.16.0.0/16"],
"time_of_day": {
"start": "09:00",
"end": "17:00"
}
},
"actions": [
{
"type": "select_path",
"priority": 1,
"criteria": [
{
"metric": "latency",
"threshold": 50,
"weight": 0.6
},
{
"metric": "jitter",
"threshold": 10,
"weight": 0.3
},
{
"metric": "packet_loss",
"threshold": 1,
"weight": 0.1
}
]
},
{
"type": "apply_qos",
"class": "realtime",
"dscp": 46
}
],
"priority": 50,
"enabled": true
}
The control plane evaluates policies in descending priority order. When multiple rules match, the first rule wins. Policies are pushed from a central controller to edge devices via REST API.
Request to register a policy:
POST /api/v1/policies
Host: sdwan-controller.example.com
Authorization: Bearer ey...token...
Content-Type: application/json
{
"id": "backup-traffic-branch",
"match": {
"source_networks": ["192.168.10.0/24"],
"application_signature": "SIP"
},
"actions": [
{
"type": "select_path",
"backup_path": true,
"criteria": [
{ "metric": "bandwidth", "threshold": 500, "weight": 1.0 }
]
}
],
"priority": 30
}
The edge device applies the policy immediately and logs evaluation steps in its event stream.
Edge devices continuously monitor available underlay links (MPLS, broadband, LTE, 5G) using probes (ICMP, UDP, or application-level health checks). Metrics are collected every 5 seconds and sent to the control plane.
A link is considered active if:
When a link’s metric exceeds a threshold, the edge device triggers a path change. The control plane evaluates all available paths using a weighted composite score:
score = Σ(weight_i × (1 - |metric_i - target_i| / max_deviation_i))
For example:
The edge device selects the path with the highest score and activates the tunnel via an IPsec or VXLAN overlay.
When a path fails, the edge device:
path-failure event to the control plane.The control plane can override automatic selection by sending a path-preference message:
{
"type": "path_preference",
"path_id": "mpls-1",
"weight": 0.85,
"valid_until": "2024-05-15T14:00:00Z"
}
Silent failure mode: if a link becomes available but no metrics are sent for >30 seconds, the edge assumes it’s down and applies a default latency of 150ms until metrics resume.
Tunnels form the SD-WAN’s overlay network. Each edge device maintains a list of active tunnels to other devices or the control plane.
Tunnels are established using a standardized encapsulation protocol (e.g., VXLAN or Geneve), with the following configuration:
{
"tunnel_id": "tun-001",
"local_ip": "192.168.1.10",
"remote_ip": "10.0.0.10",
"type": "vxlan",
"vni": 10001,
"key": "a1b2c3d4e5f6",
"mtu": 1500,
"keepalive_interval": 10,
"retransmit_timeout": 2000,
"path_id": "broadband-1"
}
Control plane uses a tunnel-status endpoint to report tunnel health:
GET /api/v1/tunnels/tun-001/status
Host: sdwan-controller.example.com
Authorization: Bearer ey...token...
{
"tunnel_id": "tun-001",
"status": "active",
"last_seen": "2024-05-14T08:34:22Z",
"metrics": {
"latency": 42,
"jitter": 7,
"packet_loss": 0.8,
"bandwidth_utilization": 65
},
"peer": {
"ip": "10.0.0.10",
"hostname": "edge-branch-01"
}
}
A tunnel is considered degraded if:
The edge device sends a tunnel-up event when a new tunnel is established and a tunnel-down event when it fails. These events trigger path selection recalculations and application-level alerts.
Tunnels are automatically re-established on reboot or link failure. The edge device maintains a retry queue for tunnel setup, with exponential backoff and a maximum of 10 attempts.
The control plane coordinates policy, path selection, and tunnel management across all edge devices. It exposes the following APIs:
GET /api/v1/edges — list all active edge devices.POST /api/v1/edges/{id}/events — send device-specific events.PUT /api/v1/policies/{id} — update a policy.GET /api/v1/monitoring/topology — stream real-time network topology.Each edge device periodically sends a heartbeat event:
{
"device_id": "edge-branch-01",
"timestamp": "2024-05-14T08:34:22Z",
"status": "online",
"uptime": 123456,
"links": [
{
"name": "eth0",
"interface": "eth0",
"type": "ethernet",
"active": true,
"mtu": 1500,
"metrics": {
"bandwidth": 100,
"latency": 35,
"jitter": 6,
"packet_loss": 1.2
}
},
{
"name": "wan1",
"interface": "wlan0",
"type": "wifi",
"active": true,
"mtu": 1400,
"metrics": {
"bandwidth": 15,
"latency": 120,
"jitter": 25,
"packet_loss": 5.3
}
}
],
"tunnels": [
{
"id": "tun-001",
"peer": "10.0.0.10",
"status": "active",
"last_seen": "2024-05-14T08:34:22Z"
}
]
}
The control plane uses these events to:
Failure mode: if the control plane does not receive a heartbeat from an edge for 2 minutes, it marks the device as unreachable. After 5 minutes, it triggers a device-unreachable event and initiates a failover to backup control plane.
Applications are identified by:
Each application has a profile that defines:
When an application fails, the edge device logs:
{
"event_type": "application_failure",
"application": "video-conference",
"start_time": "2024-05-14T08:35:10Z",
"reason": "high_jitter",
"metrics": {
"jitter": 32,
"latency": 78,
"packet_loss": 4.1,
"bandwidth_used": 2.3
},
"affected_tunnels": [
"tun-001",
"tun-002"
],
"policy_applied": "web-traffic-priority"
}
The control plane can react to such events by:
Edge devices are provisioned using a standardized configuration format, typically JSON or YAML, delivered via:
Example bootstrap configuration:
---
device:
hostname: "branch-01"
role: "edge"
site_id: "site-001"
control_plane:
url: "https://sdwan-controller.example.com"
auth:
type: "jwt"
token: "eyJ...token..."
heartbeat_interval: 30
policy_refresh_interval: 60
tunnels:
- type: "vxlan"
vni: 10001
local_ip: "192.168.1.10"
remote_ip: "10.0.0.10"
mtu: 1500
policies:
- id: "web-traffic-priority"
priority: 50
- id: "backup-traffic-branch"
priority: 30
applications:
- name: "video-conference"
ports:
- 5004
- 5005
dscp: 46
qos: "realtime"
- name: "backup"
signature: "rsync"
bandwidth: "100Mbps"
The edge device applies configuration in sequence:
Silent failure: if the configuration file is malformed (e.g., missing tunnels key), the edge device starts in bootstrap mode, logs the error, and waits for manual intervention.
The control plane maintains a real-time event log per edge device. Each event includes:
path-changed, tunnel-up, application-failure).Example query to retrieve events:
GET /api/v1/edges/edge-branch-01/events?since=2024-05-14T08:00:00Z&limit=100
Host: sdwan-controller.example.com
Authorization: Bearer ey...token...
Response:
[
{
"timestamp": "2024-05-14T08:34:22Z",
"type": "tunnel-up",
"tunnel_id": "tun-001",
"peer": "10.0.0.10",
"metrics": {
"latency": 42,
"jitter": 7,
"packet_loss": 0.8
}
},
{
"timestamp": "2024-05-14T08:34:15Z",
"type": "path-changed",
"old_path": "broadband-1",
"new_path": "mpls-1",
"reason": "latency_exceeded",
"metrics": {
"latency": 65,
"jitter": 15,
"packet_loss": 2.1
}
}
]
When a failure occurs, the edge device logs a diagnostic event with full state:
{
"event_type": "diagnostic",
"timestamp": "2024-05-14T08:40:00Z",
"diagnosis": {
"network_state": {
"links": [
{
"interface": "eth0",
"active": true,
"mtu": 1500,
"metrics": {
"bandwidth": 95,
"latency": 30,
"jitter": 5,
"packet_loss": 0.5
}
},
{
"interface": "wlan0",
"active": false,
"mtu": 1400,
"metrics": {
"bandwidth": 12,
"latency": 180,
"jitter": 40,
"packet_loss": 8.2
}
}
],
"tunnels": [
{
"id": "tun-001",
"status": "active",
"peer": "10.0.0.10"
},
{
"id": "tun-002",
"status": "degraded",
"peer": "10.0.0.20"
}
],
"policies_applied": [
"web-traffic-priority",
"backup-traffic-branch"
],
"current_path": "mpls-1"
},
"system": {
"uptime": 125000,
"load_average": [0.4, 0.6, 0.8],
"memory": {
"used": 450,
"total": 1024
}
}
}
}
The control plane uses this data to correlate events, identify root causes, and suggest remediation steps.
path-changed events with alternating new_path and old_path.tunnel-setup-failed and retries with exponential backoff.policy-apply-failed with the reason (e.g., missing path, invalid DSCP value).path-evaluation-interval and increasing threshold sensitivity.The system is resilient to partial failures: if the control plane is unreachable, edge devices continue applying policies using locally cached rules and monitor links independently. When control plane is restored, they synchronize state via a sync-state message.
Designing an SD-WAN architecture is about defining how traffic flows through a dynamic overlay, governed by policies that respond to real-time network conditions. The architecture hinges on continuous monitoring, event-driven control, and a clear separation between policy definition, path selection, and tunnel management. The edge devices act as intelligent agents, while the control plane provides a unified view and coordination layer. The entire system is defined by a set of standards: JSON for configuration and events, REST for control, and a consistent pattern for metrics, state, and failure handling—no vendor-specific magic, just a robust, portable, and observable network fabric.
This page was rewritten on 18 October 2026. It replaced a templated version that was not specific to its own title. How these pages are written and checked. If anything here is wrong, tell us at [email protected] and we will correct it.
We use cookies for analytics (Google Analytics) and advertising (Google AdSense) to improve your experience and support free content. Privacy Policy