brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: Table = off stops wg-quick from adding routes

Network and access
~/tips/tip-wireguard-wg-quick-table-off

Table = off

Tells wg-quick to bring the tunnel up without creating any routes, so you add your own.

By default wg-quick decides where your traffic goes. That is convenient until you have your own routing setup and would rather it stayed out of the way.

[Interface]
PrivateKey = ...
Address = 10.8.0.2/24
Table = off
PostUp = ip route add 10.9.0.0/24 dev %i

The Table option in a wg-quick config controls routing. The man page says off disables the creation of routes altogether, while auto, the default, adds routes to the default table and also enables special handling of default routes. With Table = off the interface comes up with its address and peers, and nothing else touches your routing table.

That is where PostUp comes in. The man page says PreUp and PostUp are script snippets run by bash before or after the interface is set up, and the special string %i expands to the interface name. So the example above adds one route of my choosing, and it still works if I rename the interface.

Two caveats. First, you now own the routing. If AllowedIPs contains 0.0.0.0/0 and the table is off, wg-quick no longer does its default-route handling for you, so traffic will not flow into the tunnel until you add routes yourself. Second, check AllowedIPs as well as the routes when something does not arrive. I’d start with ip route and wg show.

I’d only reach for this when something else, like policy routing or a container network, should decide. For a plain road-warrior setup, the default is fine.

Further reading: wg-quick(8) man page

Going deeper: Why a Tailscale device vanishes after 180 days, and how to stop it

More Network and access tips scp -3 alice@server-a:/var/backups/db.sql.gz bob@server-b:/srv/restore/ tailscale exit-node suggest tailscale lock sign nodekey:1abddef1 tlpub:abcdef12 wg genpsk > peer1.psk caddy reverse-proxy --from :2016 --to :9000 All Network and access tips (163) All topics

Link