nas fixes
This commit is contained in:
@@ -1,9 +1,17 @@
|
||||
{ config, ... }:
|
||||
{ config, pkgs, ... }:
|
||||
let
|
||||
hostname = "jallen-nas";
|
||||
ipAddress = "10.0.1.18";
|
||||
ipAddress2 = "10.0.1.19";
|
||||
gateway = "10.0.1.1";
|
||||
ports = [
|
||||
9000 # authentik
|
||||
2342 # grafana
|
||||
51820 # wireguard
|
||||
];
|
||||
|
||||
wireguard-private = config.sops.secrets."jallen-nas/wireguard/private".path;
|
||||
wireguard-public = "r03IJPnTaSNmhVYIdQr+TGasox6NAUrgW8ycm/sac08=";
|
||||
in
|
||||
{
|
||||
# Networking configs
|
||||
@@ -65,10 +73,10 @@ in
|
||||
ieee80211w=2
|
||||
'';
|
||||
};
|
||||
"Joey's Jungle 5G" = {
|
||||
pskRaw = "ext:PSK";
|
||||
priority = -100;
|
||||
};
|
||||
# "Joey's Jungle 5G" = {
|
||||
# pskRaw = "ext:PSK";
|
||||
# priority = -100;
|
||||
# };
|
||||
};
|
||||
};
|
||||
|
||||
@@ -76,8 +84,56 @@ in
|
||||
enable = true;
|
||||
allowPing = true;
|
||||
|
||||
allowedTCPPorts = ports;
|
||||
allowedUDPPorts = ports;
|
||||
|
||||
# always allow traffic from your Tailscale network
|
||||
trustedInterfaces = [ "tailscale0" ];
|
||||
};
|
||||
|
||||
nat = {
|
||||
enable = true;
|
||||
externalInterface = "wlp7s0";
|
||||
internalInterfaces = [ "wg0" ];
|
||||
};
|
||||
|
||||
wireguard.interfaces = {
|
||||
# "wg0" is the network interface name. You can name the interface arbitrarily.
|
||||
wg0 = {
|
||||
# Determines the IP address and subnet of the server's end of the tunnel interface.
|
||||
ips = [ "10.0.100.1/24" ];
|
||||
|
||||
# The port that WireGuard listens to. Must be accessible by the client.
|
||||
listenPort = 51820;
|
||||
|
||||
# This allows the wireguard server to route your traffic to the internet and hence be like a VPN
|
||||
# For this to work you have to set the dnsserver IP of your router (or dnsserver of choice) in your clients
|
||||
postSetup = ''
|
||||
${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s 10.0.100.0/24 -o wlp7s0 -j MASQUERADE
|
||||
'';
|
||||
|
||||
# This undoes the above command
|
||||
postShutdown = ''
|
||||
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s 10.0.100.0/24 -o wlp7s0 -j MASQUERADE
|
||||
'';
|
||||
|
||||
# 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 = wireguard-private;
|
||||
|
||||
peers = [
|
||||
# List of allowed peers.
|
||||
{ # Feel free to give a meaning full name
|
||||
# Public key of the peer (not a file path).
|
||||
publicKey = wireguard-public;
|
||||
# List of IPs assigned to this peer within the tunnel subnet. Used to configure routing.
|
||||
allowedIPs = [ "10.0.100.2/32" ];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user