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)

posted @   周智林  阅读(1396)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
点击右上角即可分享
微信分享提示