如何在CentOS 7和Ubuntu 18.04上设置Linux系统的bond4网络连接?
最编程
2024-02-04 22:30:35
...
Linux 系统 bond网卡配置
CentOS 7 配置:
[root@svn-zt:/root]# modprobe bonding
查看模块是否被加载
[root@svn-zt:/root]# lsmod | grep bonding
bonding 152979 0
创建 bond4 配置文件
vim ifcfg-bond4
TYPE=Bond
BOOTPROTO=static
DEVICE=bond4
NAME=bond4
ONBOOT=yes
IPADDR=10.11.3.43
NETMASK=255.255.255.0
GATEWAY=10.11.3.254
DNS1=223.5.5.5
BONDING_MASTER=yes
BONDING_OPTS="mode=4 miimon=10000 lacp_rate=fast arp_validate=0"
创建 对应网卡接口的 配置文件
vim ifcfg-ens5f0
TYPE=Ethernet
BOOTPROTO=none
NAME=ens5f0
DEVICE=ens5f0
ONBOOT=yes
MASTER=bond4
SLAVE=yes
vim ifcfg-ens5f1
TYPE=Ethernet
BOOTPROTO=none
NAME=ens5f1
DEVICE=ens5f1
ONBOOT=yes
MASTER=bond4
SLAVE=yes
Ubuntu 18.04 配置bond4
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
#root@ubuntu:/etc/netplan# cat 01-netcfg.yaml
network:
bonds:
bond4:
addresses: [ 192.168.0.61/24 ]
gateway4: 192.168.0.1
interfaces:
- enp7s0
- enp8s0
nameservers:
addresses: [114.114.114.114,8.8.8.8]
parameters:
mode: 802.3ad
mii-monitor-interval:
lacp-rate: fast
transmit-hash-policy: layer3+4
ethernets:
enp7s0: {}
enp8s0: {}
version: 2
# 配置完成后重启网络配置并查看:
netplan apply
cat /proc/net/bonding/bond0