Networking guide
Static routing reference
How a static route on the office router lets remote laptops reach the whole LAN over WireGuard, with diagrams, a sample routing table, and the server and client configuration.
The traditional setup
From the ak'tu' Consulting video series. All addresses are examples from a lab network: replace them with your own, and never publish real keys.
The office LAN is 192.168.1.0/24 behind a router. A WireGuard server sits on that LAN at 192.168.1.12 and has its own VPN subnet, 10.10.120.0/24. A remote ("road warrior") laptop connects over the internet and gets the VPN address 10.10.120.3.
Why a static route is needed
When the laptop talks to something on the LAN, that device replies to a 10.10.120.x address. It does not know where that network is, so it sends the reply to its default gateway, the router. The router does not know about 10.10.120.0/24 either, so the reply goes out to the internet and is lost.
The fix is a static route on the LAN router: send 10.10.120.0/24 via 192.168.1.12, the WireGuard server. Replies then travel back through the server and into the tunnel.
What the client's routing table should show
Once the tunnel is up, the laptop's routing table has a route to the WireGuard network, and a route to the LAN network (192.168.1.0/24) that goes through the tunnel because that range is in the client's AllowedIPs. Everything else still goes out the normal internet connection.
WireGuard server configuration
[Interface]
Address = 10.10.120.1
ListenPort = 51823
PrivateKey = PRIVATE_KEY
# Packet forwarding
PreUp = sysctl -w net.ipv4.ip_forward=1
[Peer]
# Road warrior
PublicKey = PUBLIC_KEY
AllowedIPs = 10.10.120.3/32
Packet forwarding must be enabled on the server so it can pass traffic between the tunnel and the LAN.
WireGuard client configuration
[Interface]
PrivateKey = PRIVATE_KEY
Address = 10.10.120.3/24
DNS = 192.168.1.1
MTU = 1420
[Peer]
PublicKey = PUBLIC_KEY
AllowedIPs = 192.168.1.0/24, 10.10.120.0/24
Endpoint = server_IP:Port
PersistentKeepalive = 15
The client's AllowedIPs include both the LAN (192.168.1.0/24) and the WireGuard network (10.10.120.0/24), which is what creates the two routes shown above.
Need remote access that just works?
We set up and support secure remote access, VPNs and network routing for businesses of all sizes, wherever you are. Book a free consultation and we will look at what you need.
Guide version 1.0 (August 2023), produced by ak'tu' Media Inc.
Take a copy with you
Prefer to keep this guide offline? Download the PDF version.
Free consultation
Need help putting this into practice?
We can review your setup and help you apply it safely.