[debian-lan-devel] [SCM] Debian-LAN development and packaging branch, master, updated. 0.5-7-g21f350e

Andreas B. Mundt andi.mundt at web.de
Mon Apr 9 20:45:34 UTC 2012


The following commit has been merged in the master branch:
commit 21f350ee83a5257ad1afdbd8ae08afb6daba31e8
Author: Andreas B. Mundt <andi.mundt at web.de>
Date:   Mon Apr 9 22:41:30 2012 +0200

    Replace all hard-coded IP addresses by variables, part 4.
    
    Automatically generate network configuration '/etc/network/interfaces'.

diff --git a/fai/config/files/etc/network/interfaces/EXT_GATEWAY b/fai/config/files/etc/network/interfaces/EXT_GATEWAY
deleted file mode 100644
index db72282..0000000
--- a/fai/config/files/etc/network/interfaces/EXT_GATEWAY
+++ /dev/null
@@ -1,13 +0,0 @@
-# The loopback network interface
-auto lo
-iface lo inet loopback
-      dns-search intern
-
-# The internal network interface
-auto eth0
-iface eth0 inet static
-      address 10.0.0.10
-      netmask 255.255.0.0
-      broadcast 10.0.255.255
-      gateway 10.0.0.1
-
diff --git a/fai/config/files/etc/network/interfaces/INT_GATEWAY b/fai/config/files/etc/network/interfaces/INT_GATEWAY
deleted file mode 100644
index d22d3af..0000000
--- a/fai/config/files/etc/network/interfaces/INT_GATEWAY
+++ /dev/null
@@ -1,19 +0,0 @@
-# The loopback network interface
-auto lo
-iface lo inet loopback
-      dns-search intern
-
-# The external network interface
-allow-hotplug eth0
-auto eth0
-iface eth0 inet dhcp
-
-# The internal network interface
-auto eth1
-iface eth1 inet static
-      address 10.0.0.1
-      netmask 255.255.0.0
-      broadcast 10.0.255.255
-      post-up iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
-      ## Uncomment if you use dansguardian:
-      #post-up iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 8080
diff --git a/fai/config/scripts/SERVER_A/10-misc b/fai/config/scripts/SERVER_A/10-misc
index bf38dae..4c940b2 100755
--- a/fai/config/scripts/SERVER_A/10-misc
+++ b/fai/config/scripts/SERVER_A/10-misc
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+set -e
+
 ## Add a local user account.
 ## You need to define USERNAME in class/SERVER_A.var to enable:
 
@@ -13,3 +15,37 @@ fi
 ## Make debian-lan-scripts available:
 
 fcopy -m root,root,0700 /usr/sbin/debian-lan
+
+if [ $FAI_ACTION != "install" ]; then
+    exit 0
+fi
+
+## Generate '/etc/network/interfaces':
+
+cat > $target/etc/network/interfaces <<EOF
+# The loopback network interface
+auto lo
+iface lo inet loopback
+      dns-search intern
+
+# The internal network interface
+auto eth0
+iface eth0 inet static
+      address   ${MAINSERVER_IPADDR}
+      netmask   ${NETMASK}
+      broadcast ${BROADCAST}
+      gateway   ${GATEWAY}
+EOF
+
+if [ "$MAINSERVER_IPADDR" == "$GATEWAY" ] ; then
+    cat >> $target/etc/network/interfaces <<EOF
+      post-up iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
+      ## Uncomment if you use dansguardian:
+      #post-up iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
+
+# The external network interface
+allow-hotplug eth1
+auto eth1
+iface eth1 inet dhcp
+EOF
+fi

-- 
Debian-LAN development and packaging



More information about the debian-lan-devel mailing list