Created
November 20, 2018 14:46
-
-
Save stigtsp/b60365b4eb22061e9e02bc78f67fd206 to your computer and use it in GitHub Desktop.
wireguard setup for nixos 18.09 (works with mullvad, default route everything)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ stdenv, pkgs, lib, ... }: | |
{ | |
networking.wireguard.interfaces = { | |
wg0 = { | |
ips = [ "10.0.0.1/32" "fc00:bbbb:bbbb:bbbb::bbbb/128" ]; | |
privateKeyFile = "/private/wireguard-pk"; | |
table = "51820"; | |
postSetup = '' | |
wg set wg0 fwmark 51820 | |
ip -6 rule add not fwmark 51820 table 51820 | |
ip -6 rule add table main suppress_prefixlength 0 | |
ip -4 rule add not fwmark 51820 table 51820 | |
ip -4 rule add table main suppress_prefixlength 0 | |
''; | |
postShutdown = '' | |
ip -4 rule delete table 51820 | |
ip -4 rule delete table main suppress_prefixlength 0 | |
ip -6 rule delete table 51820 | |
ip -6 rule delete table main suppress_prefixlength 0 | |
''; | |
peers = [ | |
{ | |
publicKey = "ABCDEFABCDEF"; | |
allowedIPs = [ "0.0.0.0/0" "::0/0" ]; | |
endpoint = "10.0.0.1:51820"; | |
persistentKeepalive = 25; | |
} | |
]; | |
}; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment