首页 » Linux笔记 » centos7.6端口聚合教程亲测可用

centos7.6端口聚合教程亲测可用

 

centos7.6

关闭NetworkManager服务

systemctl stop NetworkManager

systemctl disable NetworkManager

这里我测试的是bond0

编辑配置文件

[root@localhost network-scripts]# cat ifcfg-bond0

DEVICE=bond0

BOOTPROTO=none

ONBOOT=yes

IPADDR=98.51.181.52

NETMASK=255.255.255.224

GATEWAY=98.51.181.33

DNS1=8.8.8.8

[root@localhost network-scripts]# cat ifcfg-eth0

TYPE=Ethernet

PROXY_METHOD=none

BROWSER_ONLY=no

BOOTPROTO=none

DEFROUTE=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=yes

IPV6_AUTOCONF=yes

IPV6_DEFROUTE=yes

IPV6_FAILURE_FATAL=no

IPV6_ADDR_GEN_MODE=stable-privacy

NAME=eth0

DEVICE=eth0

ONBOOT=yes

IPV6_PRIVACY=no

MASTER=bond0

SLAVE=yes

[root@localhost network-scripts]# cat ifcfg-eth1

TYPE=Ethernet

PROXY_METHOD=none

BROWSER_ONLY=no

BOOTPROTO=none

DEFROUTE=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=yes

IPV6_AUTOCONF=yes

IPV6_DEFROUTE=yes

IPV6_FAILURE_FATAL=no

IPV6_ADDR_GEN_MODE=stable-privacy

NAME=eth

DEVICE=eth1

ONBOOT=yes

IPV6_PRIVACY=no

MASTER=bond0

SLAVE=yes

#加载模块

modprobe --first-time bonding

4,修改modprobe相关设定文件

[root@localhost ~]# vi /etc/modprobe.d/bonding.conf

alias bond0 binding

options bond0 miimon=100 mode=1

重启网卡

systemctl restart network

(测试中遇到多服务器重启后,bond消失,解决方法是开机启动中加载模块)

vi /etc/rc.d/rc.local

#!/bin/sh

#

# This script will be executed *after* all the other init scripts.

# You can put your own initialization stuff in here if you don't

# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local

#加载模块

modprobe --first-time bonding

systemctl restart network

原文链接:centos7.6端口聚合教程亲测可用,转载请注明来源!

1