bond0網卡配置網卡

#!/bin/bash
#
#Usage: sh bond.sh [0|1] eth0 eth1
#
####################################################
if [ $# -ne 3 ];then
echo "Usage: sh bond.sh [0|1] eth0 eth1"
exit 1
fi
bondType=$1
eth0=$2
eth1=$3
bondType=$1
for eth in $eth0 $eth1
do
cat>/etc/sysconfig/network-scripts/ifcfg-$eth<<eof
TYPE="Ethernet"
BOOTPROTO=none
DEVICE="$eth"
ONBOOT="yes"
SLAVE=yes
MASTER=bond0
eof
done

cat>/etc/sysconfig/network-scripts/ifcfg-bond$bondType<<eof
DEVICE="bond$bondType"
TYPE="Ethernet"
BOOTPROTO=none
ONBOOT="yes"
BONDING_OPTS="mode=$bondType miimon=100"
#IPADDR=192.168.1.32
#PREFIX=24
#GATEWAY=192.168.1.1
DNS1=114.114.114.114
eof
systemctl restart  network
echo "Successfull"

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章