From 82d919d66ef954959368b9e163ba53402aff45b5 Mon Sep 17 00:00:00 2001 From: ligc Date: Wed, 24 Feb 2010 08:27:58 +0000 Subject: [PATCH] add the default gw setup in hardeths postscript git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5276 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT/postscripts/hardeths | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/xCAT/postscripts/hardeths b/xCAT/postscripts/hardeths index 21a50c382..299ee1a5e 100755 --- a/xCAT/postscripts/hardeths +++ b/xCAT/postscripts/hardeths @@ -1,13 +1,20 @@ +defgw=`ip route | grep default | awk '{print $3}'` if [ -f /etc/SuSE-release ] then #SLES9 and SLES10, uses /etc/sysconfig/network/ifcfg-eth-id- #SLES11, uses /etc/sysconfig/network/ifcfg-eth NICFILEPRE="/etc/sysconfig/network/ifcfg-" echo `hostname` > /etc/HOSTNAME + if [ ! -z "$defgw" ]; then + echo "default $defgw - -" > /etc/sysconfig/routes + fi else #RedHat uses /etc/sysconfig/network-scripts/ifcfg-eth NICFILEPRE="/etc/sysconfig/network-scripts/ifcfg-" sed -i "s/HOSTNAME.*/HOSTNAME=`hostname`/" /etc/sysconfig/network + if [ ! -z "$defgw" ]; then + echo "GATEWAY=$defgw" >> /etc/sysconfig/network + fi fi for nic in `ifconfig -a|grep -B1 "inet addr"|awk '{print $1}'|grep -v inet|grep -v -- --|grep -v lo`; do IPADDR=`ifconfig $nic |grep "inet addr"|awk '{print $2}' |awk -F: '{print $2}'`