4.2.6. linux_bond


定义将两个或多个 接口 接合在一起的 Linux 绑定。这有助于冗余,并增加带宽。确保在 bonding_options 参数中包含基于内核的绑定选项。

Expand
表 4.6. linux_bond options
选项默认描述

name

 

绑定的名称。

use_dhcp

False

使用 DHCP 获取 IP 地址。

use_dhcpv6

False

使用 DHCP 获取 v6 IP 地址。

addresses

 

分配给绑定的 IP 地址列表。

Routes

 

分配给绑定的路由列表。请参阅 第 4.2.7 节 “Routes”

mtu

1500

连接的最大传输单元(MTU)。

成员

 

要在绑定中使用的接口对象序列。

bonding_options

 

创建绑定时的一组选项。请参阅 Linux bonds 的bonding_options 参数

defroute

True

使用 DHCP 服务提供的默认路由。仅在启用 use_dhcpuse_dhcpv6 时应用。

persist_mapping

False

编写设备别名配置而不是系统名称。

dhclient_args

要传递给 DHCP 客户端的参数。

dns_servers

要用于绑定的 DNS 服务器列表。

Linux bonds 的 bonding_options 参数
bonding_options 参数为 Linux 绑定设置特定的绑定选项。请参阅以下表的 Linux 绑定示例:
Expand
表 4.7. bonding_options
bonding_options描述

模式

设置绑定模式,在示例中为 802.3ad 或 LACP 模式。有关 Linux 绑定模式的更多信息,请参阅 Red Hat Enterprise Linux 9 配置和管理网络 绑定

lacp_rate

定义 LACP 数据包是每 1 秒发送一次,或每 30 秒发送一次。

updelay

定义接口在用于流量前必须处于活跃状态的最短时间。这个最小配置有助于缓解端口中断。

miimon

使用驱动程序的 MIIMON 功能监控端口状态的时间间隔(毫秒)。

示例 - Linux 绑定
...
        edpm_network_config_template: |
          ---
          {% set mtu_list = [ctlplane_mtu] %}
          {% for network in nodeset_networks %}
          {{ mtu_list.append(lookup(vars, networks_lower[network] ~ _mtu)) }}
          {%- endfor %}
          {% set min_viable_mtu = mtu_list | max %}
          network_config:
          - type: linux_bond
            name: bond1
            mtu: {{ min_viable_mtu }}
            bonding_options: "mode=802.3ad lacp_rate=fast updelay=1000 miimon=100 xmit_hash_policy=layer3+4"
            members:
              type: interface
              name: ens1f0
              mtu: {{ min_viable_mtu }}
              primary: true
            type: interface
              name: ens1f1
              mtu: {{ min_viable_mtu }}
              ...
示例 - Linux bond:绑定两个接口
...
        edpm_network_config_template: |
          ---
          {% set mtu_list = [ctlplane_mtu] %}
          {% for network in nodeset_networks %}
          {{ mtu_list.append(lookup(vars, networks_lower[network] ~ _mtu)) }}
          {%- endfor %}
          {% set min_viable_mtu = mtu_list | max %}
          network_config:
          - type: linux_bond
            name: bond1
            members:
            - type: interface
              name: nic2
            - type: interface
              name: nic3
            bonding_options: "mode=802.3ad lacp_rate=[fast|slow] updelay=1000 miimon=100"
            ...
示例 - Linux 绑定设置为带有一个 VLAN 的 active-backup 模式
....
        edpm_network_config_template: |
          ---
          {% set mtu_list = [ctlplane_mtu] %}
          {% for network in nodeset_networks %}
          {{ mtu_list.append(lookup(vars, networks_lower[network] ~ _mtu)) }}
          {%- endfor %}
          {% set min_viable_mtu = mtu_list | max %}
          network_config:
          - type: linux_bond
            name: bond_api
            bonding_options: "mode=active-backup"
            use_dhcp: false
            dns_servers:
              get_param: DnsServers
            members:
            - type: interface
              name: nic3
              primary: true
            - type: interface
              name: nic4

            - type: vlan
              vlan_id: {{ lookup(vars, networks_lower[network] ~ _vlan_id) }}
              device: bond_api
              addresses:
              - ip_netmask:
                  get_param: InternalApiIpSubnet
示例 - OVS 网桥上的 Linux 绑定

在本例中,绑定被设置为带有 LACP 模式的 802.3ad,以及一个 VLAN:

...
        edpm_network_config_template: |
          ---
          {% set mtu_list = [ctlplane_mtu] %}
          {% for network in nodeset_networks %}
          {{ mtu_list.append(lookup(vars, networks_lower[network] ~ _mtu)) }}
          {%- endfor %}
          {% set min_viable_mtu = mtu_list | max %}
          network_config:
          -  type: ovs_bridge
              name: br-tenant
              use_dhcp: false
              mtu: 9000
              members:
                - type: linux_bond
                  name: bond_tenant
                  bonding_options: "mode=802.3ad updelay=1000 miimon=100"
                  use_dhcp: false
                  dns_servers:
                    get_param: DnsServers
                  members:
                  - type: interface
                    name: p1p1
                    primary: true
                  - type: interface
                    name: p1p2
                - type: vlan
                  vlan_id: {get_param: TenantNetworkVlanID}
                  addresses:
                    - ip_netmask: {get_param: TenantIpSubnet}
                    ...
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

关于红帽文档

Legal Notice

Theme

© 2026 Red Hat
返回顶部