/config/wireguard/wireguard-allowedips
WireGuard AllowedIPs: routing and peer filtering explained
The commands on this page have not been executed by our verification runner yet.updated 2026-10-20
- tool
- WireGuard
- file
- /etc/wireguard/wg0.conf
- key
- [Peer] AllowedIPs
- type
- comma-separated IP/CIDR list
- default
- none (the peer receives no traffic)
AllowedIPs in a [Peer] section does two jobs at once. For outgoing packets it acts as a routing table: traffic to those addresses goes to that peer. For incoming packets it acts as a filter: packets from that peer are accepted only if their source address is in the list. WireGuard calls this cryptokey routing.
Typical configurations
| Use case | AllowedIPs on the client | AllowedIPs on the server |
|---|---|---|
| Full tunnel (all traffic through the VPN) | 0.0.0.0/0, ::/0 | client's tunnel IP, e.g. 10.8.0.2/32 |
| Split tunnel (only the office network) | 10.8.0.0/24, 192.168.10.0/24 | client's tunnel IP/32 |
| Site-to-site | remote LAN, e.g. 192.168.20.0/24 | the other LAN, e.g. 192.168.10.0/24 |
Example client config
[Interface]
PrivateKey = <client-private-key>
Address = 10.8.0.2/32
DNS = 10.8.0.1
[Peer]
PublicKey = <server-public-key>
Endpoint = vpn.example.com:51820
AllowedIPs = 10.8.0.0/24, 192.168.10.0/24
PersistentKeepalive = 25wg-quick up wg0 creates routes for every AllowedIPs entry. With 0.0.0.0/0 it also installs policy routing so the encrypted traffic to the endpoint does not loop through the tunnel.
Pitfalls
- Two peers on one interface must not have overlapping
AllowedIPs; the most specific match wins and the other peer stops receiving that traffic. - On the server, use a
/32(IPv4) or/128(IPv6) per client; a wider range lets that client spoof other addresses. - Check what is applied with
wg show wg0 allowed-ips.
Sources
Related pages
compare · iptablesiptables vs nftables: differences and migrationnftables replaces iptables, ip6tables, arptables and ebtables with one tool, nft, one syntax and atomic updates; iptables-nft keeps iptables commands working.glossary · opensslWhat is a certificate chain (chain of trust)?A certificate chain links a server leaf certificate through intermediate CAs to a trusted root. Clients verify each signature up to a root in their trust store.flags · opensslopenssl s_client -servername: test TLS with SNIopenssl s_client -connect host:443 -servername host sends SNI so the server returns the right certificate. Add -brief for a summary or -showcerts for the chain.