2022-04-23 21:40:14 -07:00
{ config , pkgs , lib , . . . }:
{
services . tailscale . enable = true ;
networking . firewall . allowedUDPPorts = [ 60990 ] ;
# Enable WireGuard
networking . wireguard . interfaces = {
# "wg0" is the network interface name. You can name the interface arbitrarily.
wg0 = {
# Determines the IP address and subnet of the client's end of the tunnel interface.
ips = [ " 1 0 . 0 . 6 9 . 4 / 2 4 " ] ;
listenPort = 60990 ; # to match firewall allowedUDPPorts (without this wg uses random port numbers)
# Path to the private key file.
#
# Note: The private key can also be included inline via the privateKey option,
# but this makes the private key world-readable; thus, using privateKeyFile is
# recommended.
privateKeyFile = " / h o m e / a n i s h / w g / p r i v k e y " ;
peers = [
# For a client configuration, one peer entry for the server will suffice.
{
# Public key of the server (not a file path).
publicKey = " c 1 J 4 p 6 3 r D 3 I l s z u g M Z i k i 7 U B V 3 Y m D d q a 3 D U 4 U e j X z A I = " ;
# Forward all the traffic via VPN.
allowedIPs = [ " 1 0 . 0 . 6 9 . 0 / 2 4 " ] ;
# Or forward only particular subnets
#allowedIPs = [ "10.100.0.1" "91.108.12.0/22" ];
# Set this to the server IP and port.
2022-04-26 03:06:44 -07:00
endpoint = " 1 4 9 . 2 8 . 1 6 3 . 7 8 : 6 0 9 9 0 " ; # ToDo: route to endpoint not automatically configured https://wiki.archlinux.org/index.php/WireGuard#Loop_routing https://discourse.nixos.org/t/solved-minimal-firewall-setup-for-wireguard-client/7577
2022-04-23 21:40:14 -07:00
# Send keepalives every 25 seconds. Important to keep NAT tables alive.
persistentKeepalive = 25 ;
}
] ;
} ;
} ;
2022-04-26 03:06:44 -07:00
# boot.extraModulePackages = with config.boot.kernelPackages; [ wireguard ];
# environment.systemPackages = [ pkgs.wireguard ];
# networking.wireguard.enable = true;
# networking.wireguard.interfaces = {
# wg0 = {
# ips = [ "10.0.69.4/32" ];
# privateKeyFile = "/home/anish/wg/privkey";
# listenPort = 60990;
#
# peers = [
# { # helix - server
# publicKey = "{c1J4p63rD3IlszugMZiki7UBV3YmDdqa3DU4UejXzAI=}";
# allowedIPs = [ "10.0.69.1/24" ];
# endpoint = "sealight.xyz:60990";
# persistentKeepalive = 25;
# } ];
# };
# };
2022-04-23 21:40:14 -07:00
}