read -p "bond name:" name read -p "input first interface:" int1 read -p "input second interface:" int2 read -p "input bond type:" type read -p "ip addr:" addr if egrep "7.[0-9]" /etc/redhat-release &>/dev/null; then systemctl stop NetworkManager systemctl disable NetworkManager elif egrep "6.[0-9]" /etc/redhat-release &>/dev/null; then service NetworkManager stop chkconfig NetworkManager off fi cat > /etc/sysconfig/network-scripts/ifcfg-$name << EOF TYPE=Bond BOOTPROTO=none NAME=$name DEVICE=$name ONBOOT=yes IPADDR=$addr PREFIX=24 BONDING_MASTER=yes BONDING_OPTS="mode=$type miimon=100" EOF cat > /etc/sysconfig/network-scripts/ifcfg-$int1 << EOF TYPE=Ethernet BOOTPROTO=none NAME=$int1 DEVICE=$int1 ONBOOT=yes MASTER=$name SLAVE=yes EOF cat > /etc/sysconfig/network-scripts/ifcfg-$int2 << EOF TYPE=Ethernet BOOTPROTO=none NAME=$int2 DEVICE=$int2 ONBOOT=yes MASTER=$name SLAVE=yes EOF