Skip to content

Commit

Permalink
nixos/nat: add dmzHost option (#32257)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Trinkle authored and zimbatm committed Dec 4, 2017
1 parent 13797ff commit 4f8a65a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions nixos/modules/services/networking/nat.nix
Expand Up @@ -53,6 +53,12 @@ let
-j DNAT --to-destination ${fwd.destination}
'') cfg.forwardPorts}
${optionalString (cfg.dmzHost != null) ''
iptables -w -t nat -A nixos-nat-pre \
-i ${cfg.externalInterface} -j DNAT \
--to-destination ${cfg.dmzHost}
''}
# Append our chains to the nat tables
iptables -w -t nat -A PREROUTING -j nixos-nat-pre
iptables -w -t nat -A POSTROUTING -j nixos-nat-post
Expand Down Expand Up @@ -153,6 +159,17 @@ in
'';
};

networking.nat.dmzHost = mkOption {
type = types.nullOr types.str;
default = null;
example = "10.0.0.1";
description =
''
The local IP address to which all traffic that does not match any
forwarding rule is forwarded.
'';
};

};


Expand Down

0 comments on commit 4f8a65a

Please sign in to comment.