-
2021-07-31 07:31:56
一、netplay 方式,增加如下配置文件,修改完重启机器。
cat /etc/netplan/02-bond-config.yaml
network: version: 2 ethernets: ens49f0: addresses: [] dhcp4: no optional: true ens49f1: addresses: [] dhcp4: no optional: true bonds: bond0: interfaces: - ens49f0 - ens49f1 parameters: mode: 802.3ad mii-monitor-interval: 100 addresses: - "172.18.103.47/24" gateway4: "172.18.103.254"
二、传统/etc/network/interfaces 方式,Ubuntu 16及之前版本默认是这种,如果人为修改了Ubuntu 20的网络配置方式,也可以使用。修改完后,如果重启网卡无效可能需要重启服务器。经测试ip通了,后再次重启服务器网络也能正常通。
#install packages
# NOTE: ensure ifenslave 2.6 is what gets installed, required for VLANs
apt-get install -y ifenslave vlan#load modules manually to be sure
modprobe 8021q
modprobe bonding#add to modules for reboots
echo 'bonding' >> /etc/modules
echo '8021q' >> /etc/modules
/etc/network/interfaces 配置bond4.100即带vlan100的举例,lan2和lan3是要做bond的对应网卡:
auto lo iface lo inet loopback auto lan2 iface lan2 inet manual bond-master bond4 auto lan3 iface lan3 inet manual bond-master bond4 auto bond4 iface bond4 inet manual slaves lan2 lan3 bond-mode 4 bond-miimon 100 bond-lacp-rate 1 bond-slaves none bond-xmit-hash-policy layer3+4 auto bond4.100 iface bond4.100 inet static address 10.10.11.100 netmask 255.255.255.0 gateway 10.10.11.1 vlan-raw-device bond4
更多相关内容 -
CentOS7 bond4配置
2021-05-11 15:10:39CentOS7 bond4配置 bonding的七种工作模式: bonding技术提供了七种工作模式,在使用的时候需要指定一种,每种有各自的优缺点. balance-rr (mode=0) 默认, 有高可用 (容错) 和负载均衡的功能, 需要交换机的配置,每...CentOS7 bond4配置
bonding的七种工作模式:
bonding技术提供了七种工作模式,在使用的时候需要指定一种,每种有各自的优缺点.
- balance-rr (mode=0) 默认, 有高可用 (容错) 和负载均衡的功能, 需要交换机的配置,每块网卡轮询发包 (流量分发比较均衡).
- active-backup (mode=1) 只有高可用 (容错) 功能, 不需要交换机配置, 这种模式只有一块网卡工作, 对外只有一个mac地址。缺点是端口利用率比较低
- balance-xor (mode=2) 不常用
- broadcast (mode=3) 不常用
- 802.3ad (mode=4) IEEE 802.3ad 动态链路聚合,需要交换机配置
- balance-tlb (mode=5) 不常用
- balance-alb (mode=6) 有高可用 ( 容错 )和负载均衡的功能,不需要交换机配置 (流量分发到每个接口不是特别均衡)
将网卡enp175s0f1、enp176s0f1绑定为bond4
centos 7 负载模式: mode4(802.3ad 动态链路聚合)
加载bonding模块 [root@server129 network-scripts]# modprobe bonding [root@server129 network-scripts]# lsmod |grep bonding bonding 152979 0
修改网卡配置文件
[root@server129 ~]# cd /etc/sysconfig/network-scripts/ [root@server129 network-scripts]# cat ifcfg-enp175s0f1 TYPE=Ethernet BOOTPROTO=none NAME=enp175s0f1 DEVICE=enp175s0f1 ONBOOT=yes MASTER=bond4 SLAVE=yes [root@server129 network-scripts]# cat ifcfg-enp176s0f1 TYPE=Ethernet BOOTPROTO=none NAME=enp176s0f1 DEVICE=enp176s0f1 ONBOOT=yes MASTER=bond4 SLAVE=yes [root@server129 network-scripts]# cat ifcfg-bond4 #创建bond网卡文件 TYPE=Bond BOOTPROTO=static DEVICE=bond4 NAME=bond4 ONBOOT=yes IPADDR=10.105.1.129 NETMASK=255.255.254.0 GATEWAY=10.105.1.254 DNS1=10.255.9.2 BONDING_MASTER=yes BONDING_OPTS="mode=4 miimon=100 lacp_rate=fast arp_validate=0"
重启服务,使配置生效: systemctl network restart bonding状态查看: cat /proc/net/bonding/bond4
-
bond4配置
2021-07-01 16:36:15网卡数据链路层负载均衡是使用mode4,且可以实现物理链路间互备,提供给用户的是一个逻辑上的链路,该逻辑链路的有效网络带宽为全部物理链路带宽之和。 Bonding mode4的一些特性: 最多支持绑定8个主机的网卡端口; ...网卡数据链路层负载均衡是使用mode4,且可以实现物理链路间互备,提供给用户的是一个逻辑上的链路,该逻辑链路的有效网络带宽为全部物理链路带宽之和。
Bonding mode4的一些特性:
最多支持绑定8个主机的网卡端口;
LACP控制协议数据包每秒发送一次,检测主机网卡是否存活的检测包每30秒(fast)或每秒(slow)发送一次;
LACP mode:active或passive,默认为passive模式,即只有当探测到有支持LACP功能的设备时自己才启用LACP功能;
对Bonding mode4的理解可以参考下面的链接。
https://en.wikipedia.org/wiki/Link_aggregation#Link_Aggregation_Control_Protocol
1、Bonding的模式一共有7种
#defineBOND_MODE_ROUNDROBIN 0 (balance-rr模式)网卡的负载均衡模式
#defineBOND_MODE_ACTIVEBACKUP 1 (active-backup模式)网卡的容错模式
#defineBOND_MODE_XOR 2 (balance-xor模式)需要交换机支持
#defineBOND_MODE_BROADCAST 3 (broadcast模式)
#defineBOND_MODE_8023AD 4 (IEEE 802.3ad动态链路聚合模式)需要交换机支持
#defineBOND_MODE_TLB 5 自适应传输负载均衡模式
#defineBOND_MODE_ALB 6 网卡虚拟化方式
bonding模块的所有工作模式可以分为两类:多主型工作模式和主备型工作模式,balance-rr 和broadcast属于多主型工作模式而active-backup属于主备型工作模式。(balance-xor、自适应传输负载均衡模式(balance-tlb)和自适应负载均衡模式(balance-alb)也属于多主型工作模式,IEEE 802.3ad动态链路聚合模式(802.3ad)属于主备型工作模式。2、加载并查看bonding模块
可以使用modinfo bonding 命令查看bonding模块的信息,默认情况下bonding模块没有被加载
可以以root用户登录,输入如下的命令进行开启加载bonding模块
modprobe bonding
modinfo bonding
lsmod | grep 'bonding'3、修改网卡配置文件
编辑/etc/sysconfig/network-scripts/目录下的网卡配置文件,一般情况下网卡是以em+数字命名(dell主机),但也有其它命名方式。需要以物理主机系统实际的网卡配置文件名称为准。
注:确认已经将系统服务NetworkManager关闭,且关闭服务自启动。
注:以下是将2块网卡设置成链路聚合式负载均衡bond,如果有更高的数据通信需求,可以考虑把4块物理网卡全部加入bond中可提供4Gb的通信能力。创建/etc/sysconfig/network-scripts/ifcfg-bond0文件,加入如下内容:
DEVICE=bond0
NAME=bond0
TYPE=Bond
BONDING_MASTER=yes
IPADDR=192.168.120.30
PREFIX=24
GATEWAY=192.168.120.1
ONBOOT=yes
BOOTPROTO=static
BONDING_OPTS="mode=4 miimon=100 lacp_rate=1"
注:mode=4,设置为链路负载均衡模式;miimon=100,监控网线链路故障的时间间隔(毫秒);lacp_rate=1,检测主机网卡是否存活的检测包每30秒(fast)或每秒(slow)发送一次。修改/etc/sysconfig/network-scripts/ifcfg-em1文件:
DEVICE=em1
TYPE=Ethernet
BOOTPROTO=static
NAME=em1
ONBOOT=yes
MASTER=bond0
SLAVE=yes修改/etc/sysconfig/network-scripts/ifcfg-em2文件:
DEVICE=em2
TYPE=Ethernet
BOOTPROTO=static
NAME=em2
ONBOOT=yes
MASTER=bond0
SLAVE=yes在主机上确认配置结果方法:
#ethtool bond0
注意查看Speed是否是2000Mb/s#cat /proc/net/bonding/bond0
注:当主机网卡使用bond mode4模式时,需要交换机端口设置为IEEE 802.3ad Dynamic link aggregation模式。
可以参照如下对交换机端口Gi1/0/24, Gi1/0/25的配置。
注:当交换机未做设置时,主机上的bonding mode=4将不会生效,主机会使用一块物理网卡进行通信。
interface Port-channel3
switchport access vlan 120
switchport mode access
spanning-tree portfast
spanning-tree bpduguard enable
interface GigabitEthernet1/0/24
switchport access vlan 120
switchport mode access
spanning-tree portfast
spanning-tree bpduguard enable
channel-protocol lacp
channel-group 3 mode active
!
interface GigabitEthernet1/0/25
switchport access vlan 120
switchport mode access
spanning-tree portfast
spanning-tree bpduguard enable
channel-protocol lacp
channel-group 3 mode active
!
在交换机上确认:
#show etherchannel summary
Group Port-channel Protocol Ports
1 Po1(SD) -
2 Po3(SU) LACP Gi1/0/24(P) Gi1/0/25(P)
要求Po3后面必须是SU状态。S - Layer2, U - in user
注:Cisco交换机另有特殊的配置,不同于上面。
4、流量测试与可用性测试
1)测试分别插掉网卡连线,观察网络连通丢包情况。2)从多个服务器上使用iPerf工具对做了bond的地址进行压测
验证吞吐量是否达到单网卡的约2倍。
Fedora 64 bits / Red Hat 64 bits / CentOS 64 bits (AMD64)
https://iperf.fr/download/fedora/iperf3-3.0.11-2.fc23.x86_64.rpm启动iperf服务端:iperf3 -s
启动客户端连接服务端:iperf3 -c 192.168.6.96 -t 100 -w 512k -f M
-c 表示服务端地址
-t 表示测试持续时间,这里是10秒
-w 表示报文大小
-f 表示测试结果的度量单位,这里是兆使用ifstat, iftop , nload等工具观察配置的bond的网卡的流量,其中bond0的流量应是em1, em2之和。
————————————————
-
CentOS 7.6 bond mode4 配置
2021-07-14 14:06:48双网卡配置 bond mode4 配置创建配置文件 ifcfg-bond0如果bond0接口已经配置,不再需要配置备份网卡配置文件ens3f0ens3f1查看bond0信息查看bond0 速率交换机配置 lacp防火墙~~网速测试~~服务端参考 1. CentOS 7.6 ...CentOS 7.6 bond mode4 配置
CentOS 7.6 bond mode4 配置
双万兆网口配置 bond mode4 layer3+4
双网卡配置 bond mode4 配置
# cat /etc/redhat-release CentOS Linux release 7.6.1810 (Core)
yum search ifconfig yum install net-tools.x86_64
- 查看网线是否插入
# cat /sys/class/net/ens3f0/carrier 1 # cat /sys/class/net/ens3f1/carrier 1
- 关闭 NetworkManager 服务
systemctl status NetworkManager.service systemctl stop NetworkManager.service systemctl disable NetworkManager.service
- 内核加载 bonding
modprobe --first-time bonding
# lsmod | grep bonding bonding 152656 0
创建配置文件 ifcfg-bond0
vim /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0 TYPE=Bond IPADDR=192.168.2.11 NETMASK=255.255.255.0 GATEWAY=192.168.2.1 DNS1=114.114.114.114 USERCTL=no BOOTPROTO=none ONBOOT=yes BONDING_MASTER=yes BONDING_OPTS="miimon=100 mode=4 xmit_hash_policy=layer3+4"
如果bond0接口已经配置,不再需要配置
vim /etc/modprobe.d/bond.conf alias bond0 bonding options bond0 miimon=100 mode=4 xmit_hash_policy=layer3+4
备份网卡配置文件
cd /etc/sysconfig/network-scripts cp ifcfg-ens3f0 ifcfg-ens3f0_backup cp ifcfg-ens3f1 ifcfg-ens3f1_backup
ens3f0
vim /etc/sysconfig/network-scripts/ifcfg-ens3f0
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=ens3f0 UUID=39aa32a1-acb3-4cd3-a806-be5c041a2310 DEVICE=ens3f0 ONBOOT=yes MASTER=bond0 SLAVE=yes
ens3f1
vim /etc/sysconfig/network-scripts/ifcfg-ens3f1
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=ens3f1 UUID=4b5c8908-3e83-40b2-a9db-d0713135f4c2 DEVICE=ens3f1 ONBOOT=yes MASTER=bond0 SLAVE=yes
- 重启网络服务
systemctl restart network
# ifconfig bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST> mtu 1500 inet 192.168.2.11 netmask 255.255.255.0 broadcast 192.168.2.255
查看bond0信息
cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) Bonding Mode: IEEE 802.3ad Dynamic link aggregation Transmit Hash Policy: layer3+4 (1) MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 0 Down Delay (ms): 0 802.3ad info LACP rate: slow Min links: 0 Aggregator selection policy (ad_select): stable System priority: 65535 System MAC address: bc:16:95:07:97:b0 Active Aggregator Info: Aggregator ID: 1 Number of ports: 1 Actor Key: 15 Partner Key: 1 Partner Mac Address: 00:00:00:00:00:00 Slave Interface: ens3f0 MII Status: up Speed: 10000 Mbps Duplex: full Link Failure Count: 1 Permanent HW addr: bc:16:95:07:97:b0 Slave queue ID: 0 Aggregator ID: 1 Actor Churn State: none Partner Churn State: churned Actor Churned Count: 0 Partner Churned Count: 1 details actor lacp pdu: system priority: 65535 system mac address: bc:16:95:07:97:b0 port key: 15 port priority: 255 port number: 1 port state: 77 details partner lacp pdu: system priority: 65535 system mac address: 00:00:00:00:00:00 oper key: 1 port priority: 255 port number: 1 port state: 1 Slave Interface: ens3f1 MII Status: up Speed: 10000 Mbps Duplex: full Link Failure Count: 1 Permanent HW addr: bc:16:95:07:97:b1 Slave queue ID: 0 Aggregator ID: 2 Actor Churn State: churned Partner Churn State: churned Actor Churned Count: 1 Partner Churned Count: 1 details actor lacp pdu: system priority: 65535 system mac address: bc:16:95:07:97:b0 port key: 15 port priority: 255 port number: 2 port state: 69 details partner lacp pdu: system priority: 65535 system mac address: 00:00:00:00:00:00 oper key: 1 port priority: 255 port number: 1 port state: 1
查看bond0 速率
ethtool bond0
Settings for bond0: Supported ports: [ ] Supported link modes: Not reported Supported pause frame use: No Supports auto-negotiation: No Supported FEC modes: Not reported Advertised link modes: Not reported Advertised pause frame use: No Advertised auto-negotiation: No Advertised FEC modes: Not reported Speed: 10000Mb/s Duplex: Full Port: Other PHYAD: 0 Transceiver: internal Auto-negotiation: off Link detected: yes
交换机配置 lacp
Speed: 20000Mb/s 速率
# ethtool bond0 Settings for bond0: Supported ports: [ ] Supported link modes: Not reported Supported pause frame use: No Supports auto-negotiation: No Supported FEC modes: Not reported Advertised link modes: Not reported Advertised pause frame use: No Advertised auto-negotiation: No Advertised FEC modes: Not reported Speed: 20000Mb/s Duplex: Full Port: Other PHYAD: 0 Transceiver: internal Auto-negotiation: off Link detected: yes
防火墙
# firewall-cmd --state running
systemctl stop firewalld.service
网速测试yum install -y iperf3
服务端
iperf3 -s
iperf3 -c 192.168.0.1服务端IP
参考
Centos7双网卡绑定配置 bonding
centos 链路捆绑(聚合)bonding配置举例
Centos 7 安装 iperf和服务器之间测速 -
bond的配置方法
2020-12-23 11:50:12更改要bond网卡的配置文件eth2,eth3为bond前的网卡名称,bond0为bond后的网卡名称,我们需要对这三个配置文件做更改。eth2:$vi /etc/sysconfig/network-scripts/ifcfg-eth2DEVICE=eth2HWADDR=44:A8:42:25:7C:... -
bond4以及vlan子接口配置
2020-12-23 11:50:101、跨交换机做bond,模式为LACP,linux双网卡做bond4,模式为4;2、系统为CentOS7.0-123;3、服务器仅有两张万兆网卡,为eth0、eth1;4、网络用途:管理网172.168.16.0/24、存储网10.10.10.0/24;5、该场景主要为了... -
Linux系统配置 bond4-CentOS7+Ubuntu18.04
2021-08-28 08:41:19Linux 系统 bond网卡配置 CentOS 7 配置: [root@svn-zt:/root]# modprobe bonding ...创建 bond4 配置文件 vim ifcfg-bond4 TYPE=Bond BOOTPROTO=static DEVICE=bond4 NAME=bond4 ONBOOT=y -
linux bond4
2020-12-23 11:49:08选择bond4模式 纯属为了扩大服务器的带宽 但前提是接入交换是单点或堆叠我们使用cisco交换3850只需连接好线就行 最主要就是交换机上的配置 废话不多说两个接入口绑定一个channel 就ok 然后服务器上设置好bond 就... -
网卡bonding模式 - bond0、1、4配置
2020-12-23 11:50:08vim /etc/modprobe.d/bond.confalias bond0 bondingoptions bond0 miimon=100 mode=1 # 模式1vim /etc/rc.d/rc.local # eth0 eth1的工作顺序(仅在主备模式下需要做这个设置,其他的模式不需要做这个设置)ifenslave .... -
CentOS 网卡配置bond4(LACP)
2020-12-23 11:50:06eno1为管理口,eno2和eno3绑定,配置bond4.配置eno2:vim /etc/sysconfig/network-scripts/ifcfg-eno2ifcfg-eno2配置如下:DEVICE=eno2NAME=eno2TYPE=EthernetBOOTPROTO=noneONBOOT=yesMASTER=bond4S... -
linux双网卡bond及交换机配置
2020-12-23 11:50:11cat /etc/modprobe.d/bonding.confalias bond0 bonding#options bond0 miimon=100 mode=1启用bond模块modprobe bondinglsmod | grep bondcat /etc/sysconfig/network-scripts/ifcfg-bond0DEVICE=bond0#HWADDR=4C:E9:... -
交换机聚合和bond4系统配置
2019-11-07 10:14:30交换机配置2. 系统配置3. 流量验证 1. 交换机配置 ### 配置channel configure terminal interface port-channel 10 exit ### 进入端口模式 interface ethernet 1/1/10 no switchport channel-group 10 mode active... -
Ubuntu 20.04 配置 bond mode4
2021-07-14 14:23:49Ubuntu 20.04 配置 bond mode4配置 bond mode4 layer3+4mod=4加载模块新建网络配置文件 bond0.yaml参考 配置 bond mode4 layer3+4 mod=4 动态链接聚合 802.3ad # cat /etc/issue Ubuntu 20.04.2 LTS \n \l modinfo... -
centos的bond配置
2021-09-02 14:30:42centos的bond配置 bond类型 0-为容错和负载平衡设置循环策略。从第一个可用的从接口开始,在每个从接口上顺序地接收和发送传输。 1-为容错设置活动备份策略。通过第一个可用的保税从机接口接收和发送传输。仅当活动... -
Linux bond 网卡绑定配置教程
2021-05-12 01:59:30按照一下命令就可以配置成功,我是在vm8.0虚拟机上配置的1.创建bond网卡文件在/etc/sysconfig/network-scripts/ 目录下创建ifcfg-bond0命令:vi /etc/sysconfig/network-scripts/ifcfg-bond0或者复制物理网卡也行: ... -
CentOS 7 网卡bond配置
2020-12-24 05:15:25对p1p1 p1p2两张网卡做bond步骤1)做之前请对各网卡配置进行备份1 使用root账号登录服务器2 cp p1p1 p1p2网卡的初始配置到tmp 目录下,进行备份。--------------------------------------------------------------... -
网口绑定bond配置
2018-06-29 11:08:07本文不但有详细的bond原理和bond工作资料的介绍,还有华为、华三、思科等交换机厂家对于的配置说明。 -
CentOS网卡配置bond4(LACP)
2019-12-02 16:03:00eno1为管理口,eno2和eno3绑定,配置bond4. 配置eno2: vim /etc/sysconfig/network-scripts/ifcfg-eno2 ifcfg-eno2配置如下: DEVICE=eno2 NAME=eno2 TYPE=Ethernet BOOTPROTO=none ONBOOT=yes MA... -
Centos网卡bond模式配置 比较详细,希望能帮助到大家
2022-01-30 17:58:26Centos网卡bond模式配置 比较详细,希望能帮助到大家 -
linux下配置bond脚本
2020-12-29 18:42:57脚本为bond0,可直接在linux系统下执行,修改相应ip地址即可 -
linux bond配置步骤,七种bond模式说明
2020-06-05 09:27:19linux bond配置步骤,七种bond模式说明 https://www.cnblogs.com/suzhigang/p/6140018.html 一、网卡绑定: 第一步:创建一个ifcfg-bondX #vi/etc/sysconfig/network-scripts/ifcfg-bond0 DEVICE=bond0 ... -
Liunx下的bond1和bond4的配置和7种bond模式简介
2022-01-26 15:20:38bond,bond1,bond4 bond配置 -
linux配置bond+trunk
2018-01-29 10:20:04希望可以给到大家帮助,此文档用户linux7配置端口聚合 -
linux bond配置步骤中的七种bond模式
2020-07-27 15:23:28本文主要介绍linux bond配置步骤中的七种bond模式,希望对您的学习有所帮助。 -
linux多网卡的7种bond模式原理配置
2021-01-20 14:34:34bond0、bond1、bond2、bond3、bond4、bond5、bond6 常用的有三种 mode=0:平衡负载模式,有自动备援,但需要”Switch”支援及设定。 mode=1:自动备援模式,其中一条线若断线,其他线路将会自动备援。 mode=6:平衡... -
Linux笔记之双网卡Bond4设置真实服务器
2021-04-26 10:34:23前言:给一台从未接触过的服务器做系统,安装Bond4双网卡配置,果果是真的疯了,直接进了机房。可谓是处处碰壁,终于完成配置! 实践: 原理/嗯,怎么说呢,以我个人的白话理解,就是将两块物理网卡绑定成一个... -
Centos7环境下配置IEEE 802.3ad 动态链接聚合(bond4)
2021-12-10 00:15:03# 查看发现只有一个网卡的配置文件,因此需要复制一份,并且重命名为第二块网卡的名字,网卡的名字可以通过ip addr查看 [root@linux ~]# cd /etc/sysconfig/network-scripts/ [root@linux network-scripts. -
centos7 bond的配置和调试
2018-08-27 14:23:57一,在做bond的时候一般都是两个网卡以上的,在/etc/sysconfig/network-scripts/中将你需要做bond的的网卡内容改为以下: TYPE=Ethernet BOOTPROTO=none DEVICE=p6p2 ONBOOT=yes MASTER=bond0 SLAVE=yes 二,...