fixing the problem that configing bond0 flushed the default gateway.
This commit is contained in:
parent
49cda4ba0f
commit
a2a8bbf514
@ -101,6 +101,26 @@ ONBOOT=yes
|
||||
" >/etc/sysconfig/network-scripts/ifcfg-bond0
|
||||
fi
|
||||
|
||||
if [[ $NTYPE != service ]]
|
||||
then
|
||||
if echo $MASTER | egrep '^([0-9]+.){3}[0-9]+$'
|
||||
then
|
||||
XCATMASTER=`grep "$MASTER " /etc/hosts | grep -v "^#" | awk '{print
|
||||
GATEWAY_IP=`ping -c 3 $XCATMASTER-bond0 -I hf0 2>/dev/null | grep "
|
||||
|
||||
elif [ -n "$MASTER" ]
|
||||
then
|
||||
XCATMASTER=`echo $MASTER | awk -F-hf '{print $1}'`
|
||||
GATEWAY_IP=`ping -c 3 $XCATMASTER-bond0 -I hf0 2>/dev/null | grep "
|
||||
fi
|
||||
|
||||
if [ -n "$GATEWAY_IP" ]
|
||||
then
|
||||
sed -i "/GATEWAY.*/d" /etc/sysconfig/network
|
||||
echo "GATEWAY=$GATEWAY_IP" >> /etc/sysconfig/network
|
||||
fi
|
||||
fi
|
||||
|
||||
x=0
|
||||
while [ $x -le $i ]; do
|
||||
ip link set dev hf${x} down
|
||||
|
Loading…
Reference in New Issue
Block a user