# Static configuration
cmd_run_log ip addr add ${IPADDR}/${PREFIX_LENGTH} dev ${DEVICE} brd + ${IFSCOPE} &&
cmd_run_log ip link set ${DEVICE} up
+
+ if [ -n "${GATEWAY}" ]; then
+ if ip route | grep -q default; then
+ msg_log "Gateway already setup; skipping."
+ else
+ cmd_run_log_box "Adding default route to gateway ${GATEWAY}" \
+ ip route add default via ${GATEWAY} dev ${DEVICE}
+ fi
+ fi
elif [ x${BOOTPROTO} = "xpppoe" ]; then
# PPPoE configuration
cmd_run_log pppoe-start
cmd_run_log_box "Ethernet Adapter <$i> init" /etc/rc.d/init.d/ifup "$i"
fi
done
-
- if [ -n "${GATEWAY}" ]; then
- cmd_run_log_box "Adding default route to gateway ${GATEWAY}" ip route add default via ${GATEWAY}
- fi
;;
stop)
echo "IPADDR=\"${IP_ADDRESS[${LOOP_INDEX}]}\"" >> ${file}
echo "PREFIX_LENGTH=\"${PREFIX_LENGTH[${LOOP_INDEX}]}\"" >> ${file}
echo "IFSCOPE=\"\"" >> ${file}
+ echo "GATEWAY=\"${GATEWAY[${LOOP_INDEX}]}\"" >> ${file}
if [ "x${BOOTPROTO[${LOOP_INDEX}]}" = "xdhcp" ]; then
- GATEWAY=""
DHCP_USED="yes"
fi
echo "DOMAINNAME=\"${DOMAIN}\"" >> /etc/sysconfig/network/network-parameters
echo "INTERFACES_UP=\"lo ${INTERFACES}\"" >> /etc/sysconfig/network/network-parameters
echo "INTERFACES_DN=\"${INTERFACES} lo\"" >> /etc/sysconfig/network/network-parameters
-echo "GATEWAY=\"${GATEWAY}\"" >> /etc/sysconfig/network/network-parameters
cat >> /etc/sysconfig/network/network-parameters << EOF
# General network settings
INTERFACES="eth0"
-# GATEWAY is not required if using DHCP
-GATEWAY="192.168.1.1"
MACHINE_NAME="chambers64"
DOMAIN="mongol.com"
LAN_NETWORK_MASK="192.168.1.0/24" # Utilise par sane in stage3
USE_DYNAMIC_DNS="no"
# Network interface card eth0 settings (ROUTEUR/INTERNET)
-BOOTPROTO[0]="static"
-IP_ADDRESS[0]="192.168.1.102"
-PREFIX_LENGTH[0]=24
+BOOTPROTO[0]="dhcp"
+IP_ADDRESS[0]=""
+PREFIX_LENGTH[0]=""
+# GATEWAY is not required if using DHCP
+GATEWAY[0]=""
# DNS servers addresses (not required if using DHCP)
-NAMESERVER[0]="192.168.1.1"
+NAMESERVER[0]=""
# Define this if you want the mail addressed to the root user automatically
# be forwarded to someone else
# General network settings
INTERFACES="eth0 eth1"
-# GATEWAY is not required if using DHCP
-GATEWAY=""
MACHINE_NAME="server"
DOMAIN="hugovil.com"
LAN_NETWORK_MASK="192.168.0.0/24"
# Network interface card #1 settings (INTERNET)
BOOTPROTO[0]="dhcp"
IP_ADDRESS[0]=""
+# GATEWAY is not required if using DHCP
+GATEWAY[0]=""
# Network interface card #2 settings (LAN)
BOOTPROTO[1]="static"
# General network settings
INTERFACES="eth0"
-# GATEWAY is not required if using DHCP
-GATEWAY=""
MACHINE_NAME="workstation"
DOMAIN="hugovil.com"
LAN_NETWORK_MASK="192.168.0.0/24"
BOOTPROTO[0]="static"
IP_ADDRESS[0]="192.168.0.2"
PREFIX_LENGTH[0]="24"
+# GATEWAY is not required if using DHCP
+GATEWAY[0]="192.168.0.1"
# DNS server addresses (not required if using DHCP)
NAMESERVER[0]="192.168.0.1"