12.5. 创建 Linux 绑定

您可以在网络接口模板中创建 linux 绑定。例如,您可以创建一个 linux 绑定来绑定两个接口:

...
          params:
            $network_config:
              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"

bonding_options 参数为 Linux 绑定设置特定的绑定选项。

模式
设置绑定模式,示例中是 802.3ad 或 LACP 模式。有关 Linux 绑定模式的更多信息,请参阅 Red Hat Enterprise Linux 8 配置和管理网络指南中的 "根据绑定模式启用流交换配置 "。
lacp_rate
定义 LACP 数据包是否每 1 秒发送一次,或每 30 秒发送一次。
updelay
定义接口在用于流量之前必须激活的最短时间。这个最小配置有助于缓解端口冻结中断。
miimon
使用驱动程序的 MIIMON 功能监控端口状态的时间间隔(毫秒)。

使用以下额外示例配置您自己的 Linux 绑定指南:

  • 使用一个 VLAN 将 Linux 绑定设置为 active-backup 模式:

    ....
              params:
                $network_config:
                  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:
                      get_param: InternalApiNetworkVlanID
                    device: bond_api
                    addresses:
                    - ip_netmask:
                        get_param: InternalApiIpSubnet
  • OVS 网桥上的 Linux 绑定。绑定设置为 802.3ad LACP 模式,它带有一个 VLAN:

    ...
              params:
                $network_config:
                  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
                        device: bond_tenant
                        vlan_id: {get_param: TenantNetworkVlanID}
                        addresses:
                          -
                            ip_netmask: {get_param: TenantIpSubnet}