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

Andreas B. Mundt andi.mundt at web.de
Tue Apr 10 09:24:24 UTC 2012


The following commit has been merged in the master branch:
commit f9ffa760e373b59c95ca42b4bb0ae2e1d1901f0e
Author: Andreas B. Mundt <andi.mundt at web.de>
Date:   Tue Apr 10 11:15:16 2012 +0200

    Cleanup and minor improvements concerning network flexibility.
    
    Configurable IP address-endings for workstations and diskless
    machines (DNS/DHCP configuration generation).
    Use a sensible default IP address for the nameserver.

diff --git a/fai/config/class/SERVER_A.var b/fai/config/class/SERVER_A.var
index 01e7e04..01c5407 100644
--- a/fai/config/class/SERVER_A.var
+++ b/fai/config/class/SERVER_A.var
@@ -35,16 +35,24 @@ LDAP_ADMIN_PW=
 ## the mainserver is configured as gateway to the external network.
 ## You'll need two network cards in that case.
 MAINSERVER_IPADDR="10.0.0.1"
-NAMESERVER_IPADDR="10.0.0.1"
-BROADCAST="10.0.255.255"
 GATEWAY="10.0.0.1"
+BROADCAST="10.0.255.255"
+NAMESERVER_IPADDR=""  # leave empty to use mainserver's IP address
 
 SUBNET="10.0.0.0"
 NETMASK="255.255.0.0"
 SUBNETMASK="10.0.0.0/16"
-RANGE="10.0.1.10 10.0.1.200"  # DHCP range for unknown clients
 
-FAINETMASK="10.0.0.0/24"   # NETMASK for FAI config space access
+## NETMASK for FAI config space access:
+FAINETMASK="10.0.0.0/24"
+
+## DHCP range for unknown clients (cf. dhcpd.conf):
+RANGE="10.0.1.10 10.0.1.200"
+
+## IP address-endings for workstations and diskless machines (the list
+## is generated using 'seq $WS_RANGE' respectively 'seq $DL_RANGE'):
+WS_RANGE="50 149"
+DL_RANGE="150 249"
 
 # MODULESLIST contains modules that will be loaded by the new system,
 # not during installation these modules will be written to /etc/modules
diff --git a/fai/config/scripts/DNS_SERVER/10-zones b/fai/config/scripts/DNS_SERVER/10-zones
index 21c24aa..e3d3722 100755
--- a/fai/config/scripts/DNS_SERVER/10-zones
+++ b/fai/config/scripts/DNS_SERVER/10-zones
@@ -50,17 +50,19 @@ EOF
 
 PREFIX=`echo $SUBNET | cut -d "." --fields=1,2,3`
 
-for i in `seq 50 149` ; do
-    NUM=`printf "%02d" $(($i-50))`
-    IPADDR=$i
-    echo "workstation$NUM           A       $PREFIX.$IPADDR" \
+NUM=0
+for IPADDR in `seq $WS_RANGE` ; do
+    NUMSTR=`printf "%02d" $NUM`
+    echo "workstation${NUMSTR}           A       $PREFIX.$IPADDR" \
 	>> $target/etc/bind/db.intern
+    NUM=$(($NUM+1))
 done
-for i in `seq 150 249` ; do
-    NUM=`printf "%02d" $(($i-150))`
-    IPADDR=$i
-    echo "diskless$NUM              A       $PREFIX.$IPADDR" \
+NUM=0
+for IPADDR in `seq $DL_RANGE` ; do
+    NUMSTR=`printf "%02d" $NUM`
+    echo "diskless${NUMSTR}              A       $PREFIX.$IPADDR" \
 	>> $target/etc/bind/db.intern
+    NUM=$(($NUM+1))
 done
 
 ###################
@@ -98,15 +100,17 @@ cat > $target$FILE <<EOF
                         MX      10 mainserver.intern.
 $REV.0                    PTR     mainserver.intern.
 EOF
-for i in `seq 50 149` ; do
-    NUM=`printf "%02d" $(($i-50))`
-    IPADDR=$i
-    echo "${IPADDR}.0                    PTR     workstation${NUM}.intern." \
+NUM=0
+for IPADDR in `seq $WS_RANGE` ; do
+    NUMSTR=`printf "%02d" $NUM`
+    echo "${IPADDR}.0                    PTR     workstation${NUMSTR}.intern." \
 	>> $target$FILE
+    NUM=$(($NUM+1))
 done
-for i in `seq 150 249` ; do
-    NUM=`printf "%02d" $(($i-150))`
-    IPADDR=$i
-    echo "${IPADDR}.0                   PTR     diskless${NUM}.intern." \
+NUM=0
+for IPADDR in `seq $DL_RANGE` ; do
+    NUMSTR=`printf "%02d" $NUM`
+    echo "${IPADDR}.0                    PTR     diskless${NUMSTR}.intern." \
 	>> $target$FILE
+    NUM=$(($NUM+1))
 done
diff --git a/fai/config/scripts/FAISERVER/10-config b/fai/config/scripts/FAISERVER/10-config
index 28a53ad..01be83d 100755
--- a/fai/config/scripts/FAISERVER/10-config
+++ b/fai/config/scripts/FAISERVER/10-config
@@ -15,6 +15,10 @@ fcopy  /etc/rc.local
 
 mv $target/etc/dhcp/dhcpd.conf $target/etc/dhcp/dhcpd.conf_orig
 
+if [ -z ${NAMESERVER_IPADDR} ] ; then
+    NAMESERVER_IPADDR=$MAINSERVER_IPADDR
+fi
+
 cat > $target/etc/dhcp/dhcpd.conf <<EOF
 # dhcpd.conf generated by $0
 
@@ -42,17 +46,19 @@ EOF
 
 PREFIX=`echo $SUBNET | cut -d "." --fields=1,2,3`
 
-for i in `seq 50 149` ; do
-    NUM=`printf "%02d" $(($i-50))`
-    IPADDR=$i
-    echo "   host workstation$NUM {hardware ethernet A1:B2:C3:D4:E5:$NUM; fixed-address $PREFIX.$IPADDR;}" \
+NUM=0
+for IPADDR in `seq $WS_RANGE` ; do
+    NUMSTR=`printf "%02d" $NUM`
+    echo "   host workstation${NUMSTR} {hardware ethernet A1:B2:C3:D4:E5:${NUMSTR}; fixed-address $PREFIX.$IPADDR;}" \
 	>> $target/etc/dhcp/dhcpd.conf
+    NUM=$(($NUM+1))
 done
 echo >> $target/etc/dhcp/dhcpd.conf
-for i in `seq 150 249` ; do
-    NUM=`printf "%02d" $(($i-150))`
-    IPADDR=$i
-    echo "   host diskless$NUM {hardware ethernet A1:B2:C3:D4:E5:$NUM; fixed-address $PREFIX.$IPADDR;}" \
+NUM=0
+for IPADDR in `seq $DL_RANGE` ; do
+    NUMSTR=`printf "%02d" $NUM`
+    echo "   host diskless${NUMSTR} {hardware ethernet A1:B2:C3:D4:E5:${NUMSTR}; fixed-address $PREFIX.$IPADDR;}" \
 	>> $target/etc/dhcp/dhcpd.conf
+    NUM=$(($NUM+1))
 done
 echo "}" >> $target/etc/dhcp/dhcpd.conf

-- 
Debian-LAN development and packaging



More information about the debian-lan-devel mailing list