系统相关
首页 > 系统相关> > Centos7.9 端口聚合

Centos7.9 端口聚合

作者:互联网

服务器型号: 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)

标签:sysconfig,聚合,network,etc,端口,网卡,Centos7.9,bond0,bond
来源: https://www.cnblogs.com/lightsoft2021/p/16359690.html