summaryrefslogtreecommitdiff
path: root/hosts/kay/modules/router.nix
diff options
context:
space:
mode:
Diffstat (limited to 'hosts/kay/modules/router.nix')
-rw-r--r--hosts/kay/modules/router.nix17
1 files changed, 7 insertions, 10 deletions
diff --git a/hosts/kay/modules/router.nix b/hosts/kay/modules/router.nix
index e390ded..cf748ce 100644
--- a/hosts/kay/modules/router.nix
+++ b/hosts/kay/modules/router.nix
@@ -11,7 +11,11 @@ let
in
{
networking = {
- nat.enable = true;
+ nat = {
+ enable = true;
+ externalInterface = wanInterface;
+ internalInterfaces = [ lanInterface ];
+ };
useDHCP = false;
interfaces."${lanInterface}" = {
ipv4.addresses = [{
@@ -20,17 +24,10 @@ in
}];
};
firewall = {
+ allowedUDPPorts = [ 53 67 ];
+ allowedTCPPorts = [ 53 ];
extraCommands = ''
- # nat datagrams comming through lanInterface to wanInterface
iptables -t nat -I POSTROUTING 1 -s ${subnet}/${toString prefix} -o ${wanInterface} -j MASQUERADE
-
- # allow all traffic on lanInterface interface
- iptables -I INPUT 1 -i ${lanInterface} -j ACCEPT
-
- # forward rules
- iptables -I FORWARD 1 -i ${lanInterface} -o ${lanInterface} -j ACCEPT
- iptables -I FORWARD 1 -i ${wanInterface} -o ${lanInterface} -j ACCEPT
- iptables -I FORWARD 1 -i ${lanInterface} -o ${wanInterface} -j ACCEPT
'';
};
};