From 7f1a3e5d69d0b1d64619604c30243e0070dc09ad Mon Sep 17 00:00:00 2001 From: gobo72 Date: Mon, 28 Feb 2011 05:05:33 +0000 Subject: [PATCH] =?utf8?q?D=C3=A9plac=C3=A9=20variable=20GATEWAY=20dans=20?= =?utf8?q?script=20de=20configuration=20de=20carte=20r=C3=A9seau?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- stage2/bootscripts/ifup | 9 +++++++++ stage2/bootscripts/network | 4 ---- stage2/install-bootscripts | 3 +-- sysinfos | 12 ++++++------ sysinfos.server | 4 ++-- sysinfos.workstn | 4 ++-- 6 files changed, 20 insertions(+), 16 deletions(-) diff --git a/stage2/bootscripts/ifup b/stage2/bootscripts/ifup index 7fb88d3..4224c47 100755 --- a/stage2/bootscripts/ifup +++ b/stage2/bootscripts/ifup @@ -57,6 +57,15 @@ elif [ x${BOOTPROTO} = "xstatic" ]; then # 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 diff --git a/stage2/bootscripts/network b/stage2/bootscripts/network index 7817244..f42ea1f 100755 --- a/stage2/bootscripts/network +++ b/stage2/bootscripts/network @@ -31,10 +31,6 @@ case "$1" in 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) diff --git a/stage2/install-bootscripts b/stage2/install-bootscripts index c1b60fb..75b4011 100755 --- a/stage2/install-bootscripts +++ b/stage2/install-bootscripts @@ -23,9 +23,9 @@ for nic_device in ${INTERFACES}; do 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 @@ -49,7 +49,6 @@ echo "#!/bin/sh" > /etc/sysconfig/network/network-parameters 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 diff --git a/sysinfos b/sysinfos index 1b6c06a..4607dfb 100644 --- a/sysinfos +++ b/sysinfos @@ -60,8 +60,6 @@ TIMEZONE="America/Montreal" # 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 @@ -70,12 +68,14 @@ 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 diff --git a/sysinfos.server b/sysinfos.server index 5b7c321..ec480b4 100644 --- a/sysinfos.server +++ b/sysinfos.server @@ -46,8 +46,6 @@ TIMEZONE="America/Montreal" # 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" @@ -58,6 +56,8 @@ USE_DYNAMIC_DNS="yes" # 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" diff --git a/sysinfos.workstn b/sysinfos.workstn index f04704b..8b6f137 100644 --- a/sysinfos.workstn +++ b/sysinfos.workstn @@ -65,8 +65,6 @@ TIMEZONE="America/Montreal" # 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" @@ -78,6 +76,8 @@ 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" -- 2.20.1