Skip to content

Instantly share code, notes, and snippets.

@tomfun
Last active March 1, 2025 17:42
Show Gist options
  • Save tomfun/37a61edd33071363cf6f3a47ebc635f4 to your computer and use it in GitHub Desktop.
Save tomfun/37a61edd33071363cf6f3a47ebc635f4 to your computer and use it in GitHub Desktop.
use custom DNS (pc + resolveconf) and optional Route all via wireguard
[Interface]
PrivateKey = ...
Address = 10.50.10.6/32
ListenPort = 1196
DNS = 10.50.10.1
PostUp = resolvectl dns %i 10.50.10.1
#DNS = 1.1.1.1,1.0.0.1,2606:4700:4700::1111,2606:4700:4700::1001
#PostUp = resolvectl dns %i 10.50.10.1 && resolvectl dns 10.50.10.1
#PostDown = resolvectl revert
[Peer]
PublicKey = u3U
AllowedIPs = 10.50.10.0/23
Endpoint = server.example.com:1196
FightFireFry1!Azbest
[Interface]
Address = 10.50.10.1/23
ListenPort = 1196
PrivateKey = ...
#PostUp = ufw route allow in on wg0 out on eth0
#PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
#PreDown = ufw route delete allow in on wg0 out on eth0
#PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o tun1 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o tun1 -j MASQUERADE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment