服务器型号: HP DL360P Gen8
操作系统 : centos 7.9 x64
Centos7.9多网卡配置端口聚合
1. 关闭NetworkManager服务systemctl stop NetworkManager
systemctl disable NetworkManager
2. 加载bond模块modprobe bonding miimon=100 mode=0
echo "alias bond0 bonding" >> /etc/modprobe.d/bond.conf
echo "options bond0 miimon=100 mode=0" >> /etc/modprobe.d/bond.conf
3. 配置网卡文件,以网卡eth0、eth1做端口聚合为例
创建网卡bond0的配置文件vim /etc/sysconfig/network-scripts/ifcfg-bond0
# 添加以下配置,IP地址、掩码、网关按实际填写
DEVICE=bond0
BOOTPROTO=static
USERCTL=no
ONBOOT=yes
TYPE=Bond
BONDING_MASTER=yes
BONDING_OPTS="mode=0 miimon=100"
IPADDR=192.168.50.234
NETMASK=255.255.255.0
GATEWAY=192.168.50.254
#修改网卡eth1的配置文件vim /etc/sysconfig/network-scripts/ifcfg-eno1
DEVICE=eno1
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond0
SLAVE=yes
#修改网卡eth2的配置文件vim /etc/sysconfig/network-scripts/ifcfg-eno2
DEVICE=eno2
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
MASTER=bond0
SLAVE=yes
4. 重启网络服务,确认网络是网卡速率;systemctl restart network
ethtool bond0
执行脚本 ip和网卡名按需更改
#!/bin/sh
systemctl stop NetworkManager
systemctl disable NetworkManager
modprobe bonding miimon=100 mode=0
echo "alias bond0 bonding" >> /etc/modprobe.d/bond.conf
echo "options bond0 miimon=100 mode=0" >> /etc/modprobe.d/bond.conf
cat >/etc/sysconfig/network-scripts/ifcfg-bond0 <<EOF
DEVICE=bond0
BOOTPROTO=static
USERCTL=no
ONBOOT=yes
TYPE=Bond
BONDING_MASTER=yes
BONDING_OPTS="mode=0 miimon=100"
IPADDR=192.168.50.234
NETMASK=255.255.255.0
GATEWAY=192.168.50.254
DNS1=61.128.128.68
EOF
cat >/etc/sysconfig/network-scripts/ifcfg-eno1 <<EOF
DEVICE=eno1
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond0
SLAVE=yes
EOF
cat >/etc/sysconfig/network-scripts/ifcfg-eno2 <<EOF
DEVICE=eno2
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond0
SLAVE=yes
EOF
systemctl restart network
感谢原地址: Centos7多网卡配置端口聚合(bond方式) – larry-peng – 博客园 (cnblogs.com)
原创文章,作者:Carrie001128,如若转载,请注明出处:https://blog.ytso.com/267626.html