#!/bin/bash
systemctl stop NetworkManager firewalld
systemctl disable NetworkManager firewalld
sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/g’ /etc/selinux/config
setenforce 0
mkdir -p /etc/sysconfig/network-scripts/backup
#mv /etc/sysconfig/network-scripts/ifcfg-eno1 /etc/sysconfig/network-scripts/ifcfg-eno2 /etc/sysconfig/network-scripts/backup/
cat > /etc/modprobe.d/bond.conf << EOF
alias eno1 eno2 bond0 bonding
EOF
cat > /etc/sysconfig/network-scripts/ifcfg-eno1 << EOF
TYPE=Ethernet
BOOTPROTO=none
NAME=eno1
DEVICE=eno1
ONBOOT=yes
NM_CONTROLLED=no
USERCTL=no
MASTER=bond0
SLAVE=yes
EOF
cat > /etc/sysconfig/network-scripts/ifcfg-eno2 << EOF
TYPE=Ethernet
BOOTPROTO=none
NAME=eno2
DEVICE=eno2
ONBOOT=yes
NM_CONTROLLED=no
USERCTL=no
MASTER=bond0
SLAVE=yes
EOF
cat > /etc/sysconfig/network-scripts/ifcfg-bond0 << EOF
DEVICE=bond0
TYPE=Bond
ONBOOT=yes
BOOTPROTO=static
NM_CONTROLLED=no
USERCTL=no
BONDING_OPTS=“mode=4 miimon=100 ad_select=1 updelay=200 xmit_hash_policy=2”
IPADDR=‘10.22.163.$1’
NETMASK=‘255.255.255.0’
GATEWAY=‘10.22.163.254’
EOF
echo “ifenslave bond0 eno1 eno2” >> /etc/rc.d/rc.local
chmod +x /etc/rc.local
chmod +x /etc/rc.d/rc.local
systemctl restart network
centos7.6 bond4网卡绑定
最新推荐文章于 2023-10-24 10:57:53 发布