Skip to content

Instantly share code, notes, and snippets.

@Avaq

Avaq/config.nix Secret

Last active April 8, 2020 21:50
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 Avaq/9211800a85468ad9dea14ba35ace5d98 to your computer and use it in GitHub Desktop.
Save Avaq/9211800a85468ad9dea14ba35ace5d98 to your computer and use it in GitHub Desktop.
WireGuard trouble shooting
{networking = {
nat.enable = true;
nat.externalInterface = "wlp2s0";
nat.internalInterfaces = [ "wg0" ];
firewall.enable = true;
firewall.allowedTCPPorts = [ 51820 ];
wg-quick.interfaces.wg0 = {
privateKeyFile = "/etc/nixos/secrets/wireguard-private-key";
address = [ "10.100.0.1/24" ];
dns = [ "10.133.7.1" ];
listenPort = 51820;
postUp = "iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o wlp2s0 -j MASQUERADE";
postDown = "iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o wlp2s0 -j MASQUERADE";
peers = [
{ publicKey = "fe0W8ZNOdJOtj1Hy+wFXwSPH6v4oyMmmm8D9VUgiaHQ="
; allowedIPs = ["10.100.0.2/32"]; }
{ publicKey = "ImgQ0n4FIqNcV9+LH3vQr5kdK+IEYz4M5xXRQJaf1Bc="
; allowedIPs = ["10.100.0.3/32"]; }
];
};
};}
interface: wg0
public key: JI/CZEPds9AnrcQrF9spjTJ4oHMG5i786jcGcgi6tF8=
private key: (hidden)
listening port: 51820
peer: fe0W8ZNOdJOtj1Hy+wFXwSPH6v4oyMmmm8D9VUgiaHQ=
allowed ips: 10.100.0.2/32
peer: ImgQ0n4FIqNcV9+LH3vQr5kdK+IEYz4M5xXRQJaf1Bc=
allowed ips: 10.100.0.3/32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment