Linux bond0 配置方法

Centos7 配置文件

关闭 NetworkManager

systemctl stop NetworkManager
systemctl disable NetworkManager

修改网卡配置文件

bond0 配置文件

cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
ONBOOT=yes
IPADDR=192.168.0.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.254
BONDING_OPTS="mode=4 miimon=100" # 建议将bond0 配置文件放在这个地方方便以后排查问题

ech0 配置文件

cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
MASTER=bond0
SLAVE=yes

eth1 配置文件
cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
MASTER=bond0
SLAVE=yes

添加 bond0 配置文件(写在网卡配置文件里面或者单独写一个配置文件,这两个任选其一即可。)

vi /etc/modprobe.d/bonding.conf
alias bond0 bonding
options bonding mode=0 miimon=200

加载模块

modprobe bonding

确认模块是否加载成功

lsmod | grep bonding
bonding 100065 0

重启网络服务

systemctl restart network

查看网卡状态

eth0: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP group default qlen 1000
eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc mq master bond0 state UP group default qlen 1000
bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    inet 192.168.1.10/24 brd 10.5.201.63 scope global noprefixroute bond0

VLAN:在以上基础上增加如下配置文件

bond0 配置文件

cat /etc/sysconfig/network-scripts/ifcfg-bond0.101
DEVICE=bond0.101
ONBOOT=yes
IPADDR=192.168.0.100
NETMASK=255.255.255.0
BROADCAST=192.168.0.255
VLAN=yes
ID=101 # 需要添加 VLAN ID号

另外两个网卡配置和上面的一样。

centos8 或者openEuler-22.03

操作步骤
mode 1 模式配置方法

nmcli con add type bond ifname bond0 con-name bond0 mode 1 balance-rr
nmcli con add type bond-slave ifname ens33 master bond0
nmcli con add type bond-slave ifname ens36 master bond0
nmcli con modify bond0 ipv4.address 192.168.1.100/24 ipv4.gateway 192.168.1.254 ipv4.method manual ipv6.method ignore
nmcli con up bond0

mode 4 配置方法

nmcli con add type bond ifname bond0 con-name bond0 mode 4
nmcli con add type bond-slave ifname ens33 master bond0
nmcli con add type bond-slave ifname ens36 master bond0
nmcli con modify bond0 ipv4.address 192.168.1.100/24 ipv4.gateway 192.168.1.254 ipv4.method manual ipv6.method ignore
nmcli con up bond0

相关推荐

  1. Linux bond0 配置方法

    2024-04-23 09:52:05       33 阅读
  2. Red Hat 8.0 本地源配置方法

    2024-04-23 09:52:05       49 阅读
  3. Android 10.0 展讯平台系统添加公共so库的配置方法

    2024-04-23 09:52:05       50 阅读
  4. Android 11.0 mtk平台系统添加公共so库的配置方法

    2024-04-23 09:52:05       31 阅读
  5. jenkins docker配置方法

    2024-04-23 09:52:05       31 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-23 09:52:05       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-23 09:52:05       106 阅读
  3. 在Django里面运行非项目文件

    2024-04-23 09:52:05       87 阅读
  4. Python语言-面向对象

    2024-04-23 09:52:05       96 阅读

热门阅读

  1. 【C++提高】算法

    2024-04-23 09:52:05       27 阅读
  2. 7-17 KMP模式匹配算法

    2024-04-23 09:52:05       22 阅读
  3. rabbitmq 之 无法自动创建队列的问题

    2024-04-23 09:52:05       34 阅读
  4. pandas

    2024-04-23 09:52:05       34 阅读
  5. 决策树(分类决策树)

    2024-04-23 09:52:05       32 阅读
  6. 智能小车-轮趣wheeltec(原版代码)

    2024-04-23 09:52:05       40 阅读
  7. Podman容器的原理及应用详解(一)

    2024-04-23 09:52:05       29 阅读
  8. c 哈希表

    2024-04-23 09:52:05       37 阅读