Skip to content

Instantly share code, notes, and snippets.

@Jaid
Last active February 25, 2024 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jaid/60ac77d6c0e26736d8e2decb5596872d to your computer and use it in GitHub Desktop.
Save Jaid/60ac77d6c0e26736d8e2decb5596872d to your computer and use it in GitHub Desktop.
AllowedIPs setting for excluding destinations in the local network from being routed through Wireguard
# Based on this tool: https://www.procustodibus.com/blog/2021/03/wireguard-allowedips-calculator
# The DNS resolution is routed through VPN, thus more secure and authentic
# Allowed IPs: 0.0.0.0/0, ::/0
# Disallowed IPs: 10.0.0.0/8, fd00::/8
[Peer]
AllowedIPs = 0.0.0.0/5,8.0.0.0/7,11.0.0.0/8,12.0.0.0/6,16.0.0.0/4,32.0.0.0/3,64.0.0.0/2,128.0.0.0/1,::/1,8000::/2,c000::/3,e000::/4,f000::/5,f800::/6,fc00::/8,fe00::/7
# Based on this tool: https://www.procustodibus.com/blog/2021/03/wireguard-allowedips-calculator
# The DNS resolution is not routed through VPN, thus more fast
# Allowed IPs: 0.0.0.0/0, ::/0
# Disallowed IPs: 10.0.0.0/8, fd00::/8, 1.1.1.1, 1.0.0.1, 2606:4700:4700::1111, 2606:4700:4700::1001
[Peer]
AllowedIPs = 0.0.0.0/8,1.0.0.0/32,1.0.0.2/31,1.0.0.4/30,1.0.0.8/29,1.0.0.16/28,1.0.0.32/27,1.0.0.64/26,1.0.0.128/25,1.0.1.0/24,1.0.2.0/23,1.0.4.0/22,1.0.8.0/21,1.0.16.0/20,1.0.32.0/19,1.0.64.0/18,1.0.128.0/17,1.1.0.0/24,1.1.1.0/32,1.1.1.2/31,1.1.1.4/30,1.1.1.8/29,1.1.1.16/28,1.1.1.32/27,1.1.1.64/26,1.1.1.128/25,1.1.2.0/23,1.1.4.0/22,1.1.8.0/21,1.1.16.0/20,1.1.32.0/19,1.1.64.0/18,1.1.128.0/17,1.2.0.0/15,1.4.0.0/14,1.8.0.0/13,1.16.0.0/12,1.32.0.0/11,1.64.0.0/10,1.128.0.0/9,2.0.0.0/7,4.0.0.0/6,8.0.0.0/7,10.0.1.0/24,10.0.2.0/23,10.0.4.0/22,10.0.8.0/21,10.0.16.0/20,10.0.32.0/19,10.0.64.0/18,10.0.128.0/17,10.1.0.0/16,10.2.0.0/15,10.4.0.0/14,10.8.0.0/13,10.16.0.0/12,10.32.0.0/11,10.64.0.0/10,10.128.0.0/9,11.0.0.0/8,12.0.0.0/6,16.0.0.0/4,32.0.0.0/3,64.0.0.0/2,128.0.0.0/1,::/3,2000::/6,2400::/7,2600::/14,2604::/15,2606::/18,2606:4000::/22,2606:4400::/23,2606:4600::/24,2606:4700::/34,2606:4700:4000::/38,2606:4700:4400::/39,2606:4700:4600::/40,2606:4700:4700::/116,2606:4700:4700::1000/128,2606:4700:4700::1002/127,2606:4700:4700::1004/126,2606:4700:4700::1008/125,2606:4700:4700::1010/124,2606:4700:4700::1020/123,2606:4700:4700::1040/122,2606:4700:4700::1080/121,2606:4700:4700::1100/124,2606:4700:4700::1110/128,2606:4700:4700::1112/127,2606:4700:4700::1114/126,2606:4700:4700::1118/125,2606:4700:4700::1120/123,2606:4700:4700::1140/122,2606:4700:4700::1180/121,2606:4700:4700::1200/119,2606:4700:4700::1400/118,2606:4700:4700::1800/117,2606:4700:4700::2000/115,2606:4700:4700::4000/114,2606:4700:4700::8000/113,2606:4700:4700::1:0/112,2606:4700:4700::2:0/111,2606:4700:4700::4:0/110,2606:4700:4700::8:0/109,2606:4700:4700::10:0/108,2606:4700:4700::20:0/107,2606:4700:4700::40:0/106,2606:4700:4700::80:0/105,2606:4700:4700::100:0/104,2606:4700:4700::200:0/103,2606:4700:4700::400:0/102,2606:4700:4700::800:0/101,2606:4700:4700::1000:0/100,2606:4700:4700::2000:0/99,2606:4700:4700::4000:0/98,2606:4700:4700::8000:0/97,2606:4700:4700::1:0:0/96,2606:4700:4700::2:0:0/95,2606:4700:4700::4:0:0/94,2606:4700:4700::8:0:0/93,2606:4700:4700::10:0:0/92,2606:4700:4700::20:0:0/91,2606:4700:4700::40:0:0/90,2606:4700:4700::80:0:0/89,2606:4700:4700::100:0:0/88,2606:4700:4700::200:0:0/87,2606:4700:4700::400:0:0/86,2606:4700:4700::800:0:0/85,2606:4700:4700::1000:0:0/84,2606:4700:4700::2000:0:0/83,2606:4700:4700::4000:0:0/82,2606:4700:4700::8000:0:0/81,2606:4700:4700:0:1::/80,2606:4700:4700:0:2::/79,2606:4700:4700:0:4::/78,2606:4700:4700:0:8::/77,2606:4700:4700:0:10::/76,2606:4700:4700:0:20::/75,2606:4700:4700:0:40::/74,2606:4700:4700:0:80::/73,2606:4700:4700:0:100::/72,2606:4700:4700:0:200::/71,2606:4700:4700:0:400::/70,2606:4700:4700:0:800::/69,2606:4700:4700:0:1000::/68,2606:4700:4700:0:2000::/67,2606:4700:4700:0:4000::/66,2606:4700:4700:0:8000::/65,2606:4700:4700:1::/64,2606:4700:4700:2::/63,2606:4700:4700:4::/62,2606:4700:4700:8::/61,2606:4700:4700:10::/60,2606:4700:4700:20::/59,2606:4700:4700:40::/58,2606:4700:4700:80::/57,2606:4700:4700:100::/56,2606:4700:4700:200::/55,2606:4700:4700:400::/54,2606:4700:4700:800::/53,2606:4700:4700:1000::/52,2606:4700:4700:2000::/51,2606:4700:4700:4000::/50,2606:4700:4700:8000::/49,2606:4700:4701::/48,2606:4700:4702::/47,2606:4700:4704::/46,2606:4700:4708::/45,2606:4700:4710::/44,2606:4700:4720::/43,2606:4700:4740::/42,2606:4700:4780::/41,2606:4700:4800::/37,2606:4700:5000::/36,2606:4700:6000::/35,2606:4700:8000::/33,2606:4701::/32,2606:4702::/31,2606:4704::/30,2606:4708::/29,2606:4710::/28,2606:4720::/27,2606:4740::/26,2606:4780::/25,2606:4800::/21,2606:5000::/20,2606:6000::/19,2606:8000::/17,2607::/16,2608::/13,2610::/12,2620::/11,2640::/10,2680::/9,2700::/8,2800::/5,3000::/4,4000::/2,8000::/2,c000::/3,e000::/4,f000::/5,f800::/6,fc00::/8,fe00::/7
# Based on preset from the official Android app: https://github.com/WireGuard/wireguard-android/blob/4ba87947ae3346280da76e13ef6981a631e43c3c/ui/src/main/java/com/wireguard/android/viewmodel/PeerProxy.kt#L284
[Peer]
AllowedIPs = 0.0.0.0/5, 8.0.0.0/7, 11.0.0.0/8, 12.0.0.0/6, 16.0.0.0/4, 32.0.0.0/3, 64.0.0.0/2, 128.0.0.0/3, 160.0.0.0/5, 168.0.0.0/6, 172.0.0.0/12, 172.32.0.0/11, 172.64.0.0/10, 172.128.0.0/9, 173.0.0.0/8, 174.0.0.0/7, 176.0.0.0/4, 192.0.0.0/9, 192.128.0.0/11, 192.160.0.0/13, 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, ::/0, 1.1.1.1/32
# Based on recommendation from here: https://www.procustodibus.com/blog/2021/03/wireguard-allowedips-calculator
[Peer]
AllowedIPs = 1.0.0.0/8, 2.0.0.0/7, 4.0.0.0/6, 8.0.0.0/7, 11.0.0.0/8, 12.0.0.0/6, 16.0.0.0/4, 32.0.0.0/3, 64.0.0.0/3, 96.0.0.0/4, 112.0.0.0/5, 120.0.0.0/6, 124.0.0.0/7, 126.0.0.0/8, 128.0.0.0/3, 160.0.0.0/5, 168.0.0.0/8, 169.0.0.0/9, 169.128.0.0/10, 169.192.0.0/11, 169.224.0.0/12, 169.240.0.0/13, 169.248.0.0/14, 169.252.0.0/15, 169.255.0.0/16, 170.0.0.0/7, 172.0.0.0/12, 172.32.0.0/11, 172.64.0.0/10, 172.128.0.0/9, 173.0.0.0/8, 174.0.0.0/7, 176.0.0.0/4, 192.0.0.0/9, 192.128.0.0/11, 192.160.0.0/13, 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/4, ::/1, 8000::/2, c000::/3, e000::/4, f000::/5, f800::/6, fe00::/9, fec0::/10, ff00::/8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment