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:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user