Skip to content
Mailwel
Theme

CIDR exclude

Take a set of CIDR blocks, remove the blocks you don't want, and get the fewest blocks that cover what's left. Built for WireGuard AllowedIPs and firewall rules.

Blocks, ranges or addresses to start from.

Blocks, ranges or addresses to take out.

Presets:

Result

Example: everything except a home network. Type your own lists above.

Blocks34the fewest that cover what's left
IPv4 addresses left4,294,967,040256 removed
IPv6 addresses left≈ 339.9 undecillion2^118 (332.3 decillion) removed
0.0.0.0/1
128.0.0.0/2
192.0.0.0/9
192.128.0.0/11
192.160.0.0/13
192.168.0.0/24
192.168.2.0/23
192.168.4.0/22
192.168.8.0/21
192.168.16.0/20
192.168.32.0/19
192.168.64.0/18
192.168.128.0/17
192.169.0.0/16
192.170.0.0/15
192.172.0.0/14
192.176.0.0/12
192.192.0.0/10
193.0.0.0/8
194.0.0.0/7
196.0.0.0/6
200.0.0.0/5
208.0.0.0/4
224.0.0.0/3
::/1
8000::/2
c000::/3
e000::/4
f000::/5
f800::/6
fc00::/7
fe00::/9
fec0::/10
ff00::/8

WireGuard

AllowedIPs = 0.0.0.0/1, 128.0.0.0/2, 192.0.0.0/9, 192.128.0.0/11, 192.160.0.0/13, 192.168.0.0/24, 192.168.2.0/23, 192.168.4.0/22, 192.168.8.0/21, 192.168.16.0/20, 192.168.32.0/19, 192.168.64.0/18, 192.168.128.0/17, 192.169.0.0/16, 192.170.0.0/15, 192.172.0.0/14, 192.176.0.0/12, 192.192.0.0/10, 193.0.0.0/8, 194.0.0.0/7, 196.0.0.0/6, 200.0.0.0/5, 208.0.0.0/4, 224.0.0.0/3, ::/1, 8000::/2, c000::/3, e000::/4, f000::/5, f800::/6, fc00::/7, fe00::/9, fec0::/10, ff00::/8

Put the line in the [Peer] section of the client's config. Add the WireGuard server's own public address to the exclude list too, so the tunnel's traffic doesn't try to travel through the tunnel.