Course contentsShow
← Security
Lesson 495 of 3,05211. Network Security - VPNs and TunnelingFree lesson

WireGuard Network Architecture and Routing

Designing WireGuard network topologies (point-to-point, hub-and-spoke, mesh), configuring routing tables, and managing traffic flow between peers.

WireGuard Network Architecture and Routing

What you'll learn: How to design WireGuard network topologies and configure routing to control traffic flow between peers.

Understanding WireGuard Network Topologies

Unlike traditional VPNs with rigid client-server models, WireGuard is peer-to-peer at its core. Every endpoint is a peer, giving you flexibility in how you connect them. Think of it like choosing whether to wire your home: you could run one cable to a central hub, connect everything in a chain, or create a web where every device talks directly to every other device.

Three Common Topologies

Point-to-Point: The simplest setup—two peers communicate directly. Like a private phone line between two offices.

Hub-and-Spoke: One central peer (the hub) connects to multiple remote peers (spokes). Spokes communicate through the hub, not directly with each other. This is ideal for remote access scenarios where a central server manages all connections.

Mesh: Every peer connects directly to every other peer. This offers redundancy and low latency but requires more configuration (N peers need N-1 connections each).

Routing Tables and Traffic Flow

WireGuard relies on routing tables to determine which traffic goes through which peer. When you configure a peer's AllowedIPs, you're saying "route packets destined for these IPs through this peer."

For example, if you want all traffic from your laptop to route through a WireGuard peer at 10.0.0.1/24, you'd add that subnet to the peer's AllowedIPs and configure your system's routing table accordingly.

In hub-and-spoke designs, the hub needs routes to all spoke networks, while spokes only need a route to the hub (and optionally a default route for internet traffic).

Key Takeaway: WireGuard's flexible peer architecture lets you build point-to-point, hub-and-spoke, or mesh networks by strategically configuring AllowedIPs and routing tables to control exactly where traffic flows.