Index: create-start-front-end
===================================================================
--- create-start-front-end	(revision 24)
+++ create-start-front-end	(revision 25)
@@ -93,6 +93,7 @@
    $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
 rpl __FRONT_END_HOME_DISK__ $FRONT_END_HOME_VOLUME_GROUP_DEVICE/$FRONT_END_HOME_DISK \
    $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
+# Swap disk stuff.
 if [ "x$FRONT_END_SWAP_DISK_SIZE" != "x$CONST_NULL_DISK_SIZE" ] ; then
   FRONT_END_SWAP_DISK_STANZA="'phy:$FRONT_END_SWAP_VOLUME_GROUP_DEVICE/${FRONT_END_SWAP_DISK},xvda3,w',"
   rpl __FRONT_END_SWAP_DISK__ $FRONT_END_SWAP_DISK_STANZA \
@@ -106,9 +107,10 @@
   rpl __FRONT_END_NOSWAP__ $CLUSTER_NOSWAP \
      $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
 fi
+#
 rpl __FRONT_END_HOST_NAME__ $CURRENT_HOST_NAME \
    $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
-
+# Vif stuff.
 VIF_STANZA=$CONST_XEN_VIF_STANZA_PREFIX
 EXTERNAL_MAC="${CONST_XEN_MAC_PREFIX}${FRONT_END_EXTERNAL_MAC_ADDRESS}"
 INTERNAL_MAC="${CONST_XEN_MAC_PREFIX}${FRONT_END_CLUSTER_MAC_ADDRESS}"
@@ -128,6 +130,72 @@
 rpl __VIF_STANZA__ "$VIF_STANZA" \
    $CONST_XEN_CONFIG_DIR/$CURRENT_HOST_NAME.cfg
 #
+#
+# Configure the specific files from templates
+#
+# /etc/network/interfaces
+# The first interface is DHCP configured.
+CURRENT_PATH=/etc/network
+cp templates$CURRENT_PATH/$FRONT_END_INTERFACES_TEMPLATE \
+   $FRONT_END_SYSTEM_DISK_MOUNT_POINT/$CURRENT_PATH/interfaces
+if [ $CLUSTER_EXTERNAL_ADDRESSES_BY_DHCP -eq 1 ] ;then
+  ETH0_STANZA="iface eth0 inet dhcp"
+  rpl __ETH0_STATIC_OR_DHCP__ "$ETH0_STANZA"  \
+      $FRONT_END_SYSTEM_DISK_MOUNT_POINT/$CURRENT_PATH/interfaces
+  echo y | rpl __ETH0_STATIC_ADDRESS__ ""
+      $FRONT_END_SYSTEM_DISK_MOUNT_POINT/$CURRENT_PATH/interfaces
+  echo y | rpl __ETH0_STATIC_NETMASK__ ""
+      $FRONT_END_SYSTEM_DISK_MOUNT_POINT/$CURRENT_PATH/interfaces
+  echo y | rpl __ETH0_STATIC_GATEWAY__ ""
+      $FRONT_END_SYSTEM_DISK_MOUNT_POINT/$CURRENT_PATH/interfaces
+  echo y | rpl __ETH0_STATIC_BROADCAST__ ""
+      $FRONT_END_SYSTEM_DISK_MOUNT_POINT/$CURRENT_PATH/interfaces
+  echo y | rpl __ETH0_STATIC_NAMESERVERS__ ""
+      $FRONT_END_SYSTEM_DISK_MOUNT_POINT/$CURRENT_PATH/interfaces
+  echo y | rpl __ETH0_STATIC_DNS_SEARCH__ ""
+      $FRONT_END_SYSTEM_DISK_MOUNT_POINT/$CURRENT_PATH/interfaces
+else
+  ETH0_STANZA="iface eth0 inet static"
+  rpl __ETH0_STATIC_OR_DHCP__ "$ETH0_STANZA"  \
+      $FRONT_END_SYSTEM_DISK_MOUNT_POINT/$CURRENT_PATH/interfaces
+  echo y | rpl __ETH0_STATIC_ADDRESS__ "$FRONT_END_CLUSTER_STATIC_IP"
+      $FRONT_END_SYSTEM_DISK_MOUNT_POINT/$CURRENT_PATH/interfaces
+  echo y | rpl __ETH0_STATIC_NETMASK__ "$FRONT_END_EXTERNAL_INTERFACE_STATIC_NETMASK"
+      $FRONT_END_SYSTEM_DISK_MOUNT_POINT/$CURRENT_PATH/interfaces
+  echo y | rpl __ETH0_STATIC_NETWORK__ "$FRONT_END_EXTERNAL_INTERFACE_STATIC_NETWORK"
+      $FRONT_END_SYSTEM_DISK_MOUNT_POINT/$CURRENT_PATH/interfaces
+  echo y | rpl __ETH0_STATIC_GATEWAY__ "$FRONT_END_EXTERNAL_INTERFACE_STATIC_GATEWAY"
+      $FRONT_END_SYSTEM_DISK_MOUNT_POINT/$CURRENT_PATH/interfaces
+  echo y | rpl __ETH0_STATIC_BROADCAST__ "$FRONT_END_EXTERNAL_INTERFACE_STATIC_BROADCAST"
+      $FRONT_END_SYSTEM_DISK_MOUNT_POINT/$CURRENT_PATH/interfaces
+  echo y | rpl __ETH0_STATIC_NAMESERVERS__ "$FRONT_END_EXTERNAL_INTERFACE_STATIC_DNS_NAMESERVERS"
+      $FRONT_END_SYSTEM_DISK_MOUNT_POINT/$CURRENT_PATH/interfaces
+  echo y | rpl __ETH0_STATIC_DNS_SEARCH__ "$FRONT_END_EXTERNAL_INTERFACE_STATIC_DNS_SEARCH"
+      $FRONT_END_SYSTEM_DISK_MOUNT_POINT/$CURRENT_PATH/interfaces
+fi 
+ADDRESS="$CLUSTER_STATIC_NETWORK_PREFIX.$FRONT_END_STATIC_NETWORK_POSTFIX"
+rpl __ETH1_STATIC_ADDRESS__ $ADDRESS  \
+    $FRONT_END_SYSTEM_DISK_MOUNT_POINT/$CURRENT_PATH/interfaces
+# /etc/hostname
+CURRENT_PATH=/etc
+echo $CURRENT_HOST_NAME > "${FRONT_END_DISK_MOUNT_POINT}${CURRENT_PATH}/hostname"
+# /etc/hosts
+CURRENT_PATH=/etc
+CURRENT_HOST_IP="${CLUSTER_STATIC_NETWORK_PREFIX}.${FRONT_END_STATIC_NETWORK_POSTFIX}"
+cp templates$CURRENT_PATH/hosts \
+   $FRONT_END_SYSTEM_DISK_MOUNT_POINT/$CURRENT_PATH
+rpl __COMPUTE_NODE_IP__ $CURRENT_HOST_IP \
+    ${FRONT_END_SYSTEM_DISK_MOUNT_POINT}${CURRENT_PATH}/hosts
+rpl __COMPUTE_NODE_NAME__ $CURRENT_HOST_NAME \
+    ${FRONT_END_SYSTEM_DISK_MOUNT_POINT}${CURRENT_PATH}/hosts
+# /etc/resolv.conf
+CURRENT_PATH=/etc
+cp $TEMPLATES_DIR$CURRENT_PATH/resolv.conf \
+   ${FRONT_END_SYSTEM_DISK_MOUNT_POINT}${CURRENT_PATH}/resolv.conf
+rpl __CLUSTER_DOMAIN_NAME__ "${CLUSTER_DOMAIN_NAME}." \
+   ${FRONT_END_SYSTEM_DISK_MOUNT_POINT}${CURRENT_PATH}/resolv.conf
+rpl __FRONT_END_STATIC_ADDRESS__ "${CLUSTER_STATIC_NETWORK_PREFIX}.$FRONT_END_STATIC_NETWORK_POSTFIX" \
+   ${FRONT_END_SYSTEM_DISK_MOUNT_POINT}${CURRENT_PATH}/resolv.conf
 exit 0
 #
 # Umount the compute node system disk
@@ -156,35 +224,4 @@
     VCPU_NUM=$((VCPU_NUM + 1))
 done
 
-#
-# Configure the specific files from templates
-#
-# /etc/network/interfaces
-# The first interface is DHCP configured.
-CURRENT_PATH=/etc/network
-cp templates$CURRENT_PATH/$FRONT_END_INTERFACES_TEMPLATE \
-   $FRONT_END_SYSTEM_DISK_MOUNT_POINT/$CURRENT_PATH
-ADDRESS="$COMPUTE_NODE_STATIC_NETWORK_PREFIX.$FRONT_END_STATIC_NETWORK_POSTFIX"
-rpl __STATIC_ADDRESS__ $ADDRESS  \
-    $FRONT_END_SYSTEM_DISK_MOUNT_POINT/$CURRENT_PATH/interfaces
-# /etc/hostname
-CURRENT_PATH=/etc
-echo $CURRENT_HOST_NAME > "${COMPUTE_NODE_DISK_MOUNT_POINT}${CURRENT_PATH}/hostname"
-# /etc/hosts
-CURRENT_PATH=/etc
-CURRENT_HOST_IP="${COMPUTE_NODE_STATIC_NETWORK_PREFIX}.${FRONT_END_STATIC_NETWORK_POSTFIX}"
-cp templates$CURRENT_PATH/hosts \
-   $FRONT_END_SYSTEM_DISK_MOUNT_POINT/$CURRENT_PATH
-rpl __COMPUTE_NODE_IP__ $CURRENT_HOST_IP \
-    ${FRONT_END_SYSTEM_DISK_MOUNT_POINT}${CURRENT_PATH}/hosts
-rpl __COMPUTE_NODE_NAME__ $CURRENT_HOST_NAME \
-    ${FRONT_END_SYSTEM_DISK_MOUNT_POINT}${CURRENT_PATH}/hosts
-# /etc/resolv.conf
-CURRENT_PATH=/etc
-cp $TEMPLATES_DIR$CURRENT_PATH/resolv.conf \
-   ${FRONT_END_SYSTEM_DISK_MOUNT_POINT}${CURRENT_PATH}/resolv.conf
-rpl __CLUSTER_DOMAIN_NAME__ "${CLUSTER_DOMAIN_NAME}." \
-   ${FRONT_END_SYSTEM_DISK_MOUNT_POINT}${CURRENT_PATH}/resolv.conf
-rpl __FRONT_END_STATIC_ADDRESS__ "${CLUSTER_STATIC_NETWORK_PREFIX}.$FRONT_END_STATIC_NETWORK_POSTFIX" \
-   ${FRONT_END_SYSTEM_DISK_MOUNT_POINT}${CURRENT_PATH}/resolv.conf
 exit 0
