modify set_bonding.sh and set bond0 base on eth0 ip arg set

modified:   set_bonding.sh

    Signed-off-by: swei <swei@linx-info.com>
This commit is contained in:
swei
2014-03-27 11:40:46 +08:00
parent 42a3c37c19
commit a34b33497d

View File

@@ -1,9 +1,39 @@
#!/bin/sh
export LANG=c
create_ifcfg(){
for i in $@;
do
cat > ${IF_CONFIG}/ifcfg-eth${i} <<EOF
DEVICE=eth${i}
BOOTPROTO=none
SERVICE=ipv4-static
MASTER=bond0
SLAVE=yes
HWADDR=
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
PEERDNS=yes
EOF
done
}
IF_CONFIG="/etc/sysconfig/network-devices"
echo 'bonding mode=6 max_bonds=1' >> /etc/sysconfig/modules
if [ -f ${IF_CONFIG}/ifcfg-bond0 ];then
echo "bonding exit.."
else
grep "^bonding" /etc/sysconfig/modules &> /dev/null
if [ $? -eq 0 ];then
echo 'bonding mode=6 max_bonds=1' >> /etc/sysconfig/modules
fi
mv ${IF_CONFIG}/ifcfg-eth0 ${IF_CONFIG}/ifcfg-bond0
sed -i "s/^DEVICE=eth0/DEVICE=bond0/g" ${IF_CONFIG}/ifcfg-bond0
create_ifcfg 0 2
fi
cp ${IF_CONFIG}/bond-examples/ifcfg-bond0 ${IF_CONFIG}
cp ${IF_CONFIG}/bond-examples/ifcfg-eth0 ${IF_CONFIG}
cp ${IF_CONFIG}/bond-examples/ifcfg-eth1 ${IF_CONFIG}