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: AllowedIPs in a WireGuard VPN is both a route and a filter

Network and access
~/tips/tip-wireguard-allowedips-routing

AllowedIPs = 198.51.100.2/32, 192.0.2.0/24

Understand why traffic goes missing when a WireGuard peer's AllowedIPs list is too narrow.

In my view, many WireGuard problems come down to one line: AllowedIPs. It does two jobs at once, and people usually think of only one.

[Peer]
PublicKey = abc123...
AllowedIPs = 198.51.100.2/32, 192.0.2.0/24

Outgoing, it works like a routing table. Traffic for 198.51.100.2 or the 192.0.2.0/24 network goes to this peer. wg-quick also adds those routes to the system for you.

Incoming, it is a filter. The wg man page describes it as the list of addresses incoming traffic from this peer is allowed from. A packet from this peer with any other source address is dropped without a word.

That second part causes the classic puzzle: the tunnel shows a handshake, ping in one direction works, the other direction gets nothing. Usually the replying side’s address is missing from the AllowedIPs on the receiving end.

On a client, AllowedIPs = 0.0.0.0/0, ::/0 sends all traffic through the tunnel. wg-quick then takes over the default route, as its man page explains, which is what you want for a full VPN and a surprise if you only wanted to reach one server.

Two peers on the same interface cannot claim the same range. If they do, the last one wins, which is another quiet way to lose traffic.

Further reading: wg(8) man page, 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 Table = off All Network and access tips (163) All topics

Link