@cryptotaxi247 / infra / commits / 3c2f2914

* Enable NAT for the internal network on boot.

svn path=/configurations/trunk/tud/; revision=8753

Eelco Dolstra committed May 24, 2007 at 14:51 UTC 3c2f2914bb4b56b3aad90bc5b219814be8141484
1 file changed +21
main.nix
+21
@@ -37,6 +37,27 @@ rec {
37 defaultGateway = "130.161.158.1";
38
39 nameservers = ["130.161.158.4" "130.161.33.17" "130.161.180.1"];
40 +
41 + localCommands =
42 + # Provide NATting for the build machines on 192.168.1.*.
43 + # Obviously, this should be something that NixOS provides.
44 + let pkgs = import ../../nixpkgs/pkgs/top-level/all-packages.nix {};
45 + in "
46 + export PATH=${pkgs.iptables}/sbin:$PATH
47 +
48 + modprobe ip_tables
49 + modprobe ip_conntrack_ftp
50 + modprobe ip_nat_ftp
51 + modprobe ipt_LOG
52 + modprobe ip_nat
53 + modprobe xt_tcpudp
54 +
55 + iptables -t nat -F
56 + iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -d 192.168.1.0/24 -j ACCEPT
57 + iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -j SNAT --to-source 130.161.158.181
58 +
59 + echo 1 > /proc/sys/net/ipv4/ip_forward
60 + ";
61 };
62
63 services = {