Add wireguard configuration
This commit is contained in:
parent
80fb40915e
commit
14a99bccc4
3 changed files with 33 additions and 0 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,3 +1,5 @@
|
||||||
nixos/result
|
nixos/result
|
||||||
pw
|
pw
|
||||||
.stfolder
|
.stfolder
|
||||||
|
privkey
|
||||||
|
privpsk
|
||||||
|
|
30
packages/wireguard/package.nix
Normal file
30
packages/wireguard/package.nix
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
networking.wg-quick.interfaces = {
|
||||||
|
wg0 = {
|
||||||
|
address = [ "10.174.110.32/32" ];
|
||||||
|
dns = [ "10.128.0.1" ];
|
||||||
|
mtu = 1320;
|
||||||
|
privateKeyFile = "/nix/config/packages/wireguard/privkey";
|
||||||
|
|
||||||
|
# Route local traffic through local network
|
||||||
|
preUp = ''
|
||||||
|
${pkgs.unixtools.route}/bin/route add -net 192.168.2.0 netmask 255.255.255.0 metric 0 dev eno1
|
||||||
|
'';
|
||||||
|
postDown = ''
|
||||||
|
${pkgs.unixtools.route}/bin/route del -net 192.168.2.0 netmask 255.255.255.0 metric 0 dev eno1
|
||||||
|
'';
|
||||||
|
|
||||||
|
peers = [{
|
||||||
|
publicKey = "PyLCXAQT8KkM4T+dUsOQfn+Ub3pGxfGlxkIApuig+hk=";
|
||||||
|
presharedKeyFile = "/nix/config/packages/wireguard/privpsk";
|
||||||
|
allowedIPs = [ "0.0.0.0/0" ];
|
||||||
|
endpoint = "nl.vpn.airdns.org:1637";
|
||||||
|
persistentKeepalive = 15;
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
networking.firewall.allowedUDPPorts = [ 1637 ];
|
||||||
|
}
|
|
@ -9,6 +9,7 @@
|
||||||
../packages/vim/package.nix
|
../packages/vim/package.nix
|
||||||
../packages/nginx/homeserver.nix
|
../packages/nginx/homeserver.nix
|
||||||
../packages/syncthing/homeserver.nix
|
../packages/syncthing/homeserver.nix
|
||||||
|
../packages/wireguard/package.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
|
|
Loading…
Reference in a new issue