@@ -53,6 +53,12 @@ let
5353 -j DNAT --to-destination ${fwd.destination}
5454 '') cfg.forwardPorts}
5555
56+ ${optionalString (cfg.dmzHost != null) ''
57+ iptables -w -t nat -A nixos-nat-pre \
58+ -i ${cfg.externalInterface} -j DNAT \
59+ --to-destination ${cfg.dmzHost}
60+ ''}
61+
5662 # Append our chains to the nat tables
5763 iptables -w -t nat -A PREROUTING -j nixos-nat-pre
5864 iptables -w -t nat -A POSTROUTING -j nixos-nat-post
@@ -153,6 +159,17 @@ in
153159 '';
154160 };
155161
162+ networking.nat.dmzHost = mkOption {
163+ type = types.nullOr types.str;
164+ default = null;
165+ example = "10.0.0.1";
166+ description =
167+ ''
168+ The local IP address to which all traffic that does not match any
169+ forwarding rule is forwarded.
170+ '';
171+ };
172+
156173 };
157174
158175