By default, setting AllowedIPs = 0.0.0.0/0 in wg-quick hijacks every outbound connection on your Linux server (including SSH, apt updates, and LAN downloads). Adding Table = off under [Interface] stops wg-quick from rewriting your main routing table, letting you attach a dedicated routing table (ip rule add from <WG_TUNNEL_IP> table 200) so only traffic bound to your WireGuard interface or container subnet uses the tunnel.
AllowedIPs does two jobs in wg-quick: crypto-key filtering and OS route injection. Table = off disables automatic OS route hijacking while keeping AllowedIPs = 0.0.0.0/0 valid for inbound public internet peers!
Zero broken SSH sessions. Your LAN and direct WAN SSH connections stay on your normal interface even if the tunnel restarts.
Ideal for $3/mo Static IPv4 Gateways. Expose Plex (:32400), Caddy (:443), or a game server over your PrivateByte Gateway without routing household or NAS downloads through the tunnel.
When you rent a WireGuard Static IPv4 Gateway to expose a service behind CGNAT, you need AllowedIPs = 0.0.0.0/0 so WireGuard accepts packets from any visitor IP on the internet — without forcing your entire home server's outbound traffic over the tunnel.
Here is the clean wg-quick + iproute2 recipe decomposed from man wg-quick and man ip-rule.
Complete /etc/wireguard/wg0.conf with Policy-Based Split Routing
Replace 10.66.66.2 with your assigned WireGuard interface IP and 10.66.66.1 with your Gateway peer IP (you can also generate fresh keys in our WireGuard Config Generator):
[Interface]
PrivateKey = YOUR_CLIENT_PRIVATE_KEY
Address = 10.66.66.2/32
MTU = 1420
# Crucial: keep AllowedIPs = 0.0.0.0/0 from overwriting your default route!
Table = off
# Reply out wg0 ONLY when packets originate from 10.66.66.2 (inbound Gateway visitors)
PostUp = ip route add default dev %i table 200
PostUp = ip rule add from 10.66.66.2/32 table 200 priority 100
PreDown = ip rule del from 10.66.66.2/32 table 200 priority 100
PreDown = ip route flush table 200
[Peer]
PublicKey = GATEWAY_SERVER_PUBLIC_KEY
Endpoint = GATEWAY_POP_IP:51820
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 25
Why this 4-line PostUp works like magic
- Normal outbound commands (
apt update, Docker Hub pulls, LAN SMB transfers) pick your server's primary LAN source IP (192.168.1.x) and use themainrouting table at full local ISP speed. - When an external user connects to your dedicated public Gateway IPv4 (for Plex, Home Assistant, or a UDP game server), the packet arrives on
wg0(10.66.66.2), and your server's reply matchesfrom 10.66.66.2/32 → table 200— routing symmetrically back outwg0!
