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"

 

posted @ 2022-05-21 22:11  vmsysjack  阅读(44)  评论(0编辑  收藏  举报