绑定 NIC 和 VLAN 且网桥的 Netplan 无法正常工作

绑定 NIC 和 VLAN 且网桥的 Netplan 无法正常工作

我遇到了 netplan 问题。配置如下。Bond 似乎正在工作,但我无法连接到在 Bond 上桥接的网络 VLAN128 (br128)。在服务器升级到 20.04 之前,硬件和 Bond 都可以正常工作(之前不是通过 netplan 实现的)。如果我只使用一个以太网 NIC,即移动 VLAN128 到单个非 Bonded NIC,它也可以正常工作。

绑定接口上缺少的是所有路由,这看起来很奇怪,因为单个 NIC 上会自动生成路由。所以我不知道发生了什么。有人知道我错过了什么吗?

单网卡板载 Realtec 22:00.0 以太网控制器:Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express 千兆以太网控制器 (rev 15)

绑定网卡是双端口英特尔 21:00.0 以太网控制器:英特尔公司 82575EB 千兆网络连接(修订版 02) 21:00.1 以太网控制器:英特尔公司 82575EB 千兆网络连接(修订版 02)

网络计划:

    version: 2
    renderer: networkd

    ethernets:
        enp34s0:
            dhcp4: false
            dhcp6: false
        eno1:
            dhcp4: false
            dhcp6: false
        enp33s0f1:
            dhcp4: false
            dhcp6: false

    bonds:
      bond0:
        dhcp4: false
        dhcp6: false
        interfaces: [eno1, enp33s0f1]
        parameters:
            mode: 802.3ad
            lacp-rate: fast
            transmit-hash-policy: layer2+3
            mii-monitor-interval: 100

    vlans:
      vlan88:
        accept-ra:        no
        id:               88
        link:             enp34s0
      vlan89:
        accept-ra:        no
        id:               89
        link:             enp34s0
      vlan94:
        accept-ra:        no
        id:               94
        link:             enp34s0
      vlan128:
        accept-ra:        no
        id:               128
        link:             bond0
      vlan129:
        accept-ra:        no
        id:               129
        link:             enp34s0

    bridges:
      br0:
        dhcp4:            yes
        dhcp4-overrides:
          hostname:       defiant89
        interfaces:
          - vlan89
      br88:
        dhcp4:            yes
        dhcp4-overrides:
          hostname:       defiant
        interfaces:
          - vlan88
      br94:
        dhcp4:            yes
        dhcp4-overrides:
          hostname:       defiant94
        interfaces:
          - vlan94
      br128:
        dhcp4:            yes
        dhcp4-overrides:
          hostname:       defiant128
        routes:
          - to: 192.168.128.0/24
            via: 0.0.0.0
          - to: 0.0.0.0/0
            via: 192.168.128.1
            metric: 100
          - to: 192.168.128.1/32
            via: 0.0.0.0
            metric: 100
        interfaces:
          - vlan128
      br129:
        dhcp4:            yes
        dhcp4-overrides:
          hostname:       defiant129
        interfaces:
          - vlan129 

粘合接口:


Bonding Mode: IEEE 802.3ad Dynamic link aggregation
Transmit Hash Policy: layer2+3 (2)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0

802.3ad info
LACP rate: fast
Min links: 0
Aggregator selection policy (ad_select): stable
System priority: 65535
System MAC address: 42:31:...
Active Aggregator Info:
        Aggregator ID: 1
        Number of ports: 2
        Actor Key: 9
        Partner Key: 2
        Partner Mac Address: 90:ef:...

Slave Interface: enp33s0f1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 6a:c1:01:8a:1f:a9
Slave queue ID: 0
Aggregator ID: 1
Actor Churn State: none
Partner Churn State: none
Actor Churned Count: 0
Partner Churned Count: 0
details actor lacp pdu:
    system priority: 65535
    system mac address: 42:31:...
    port key: 9
    port priority: 255
    port number: 1
    port state: 63
details partner lacp pdu:
    system priority: 65535
    system mac address: 90:ef:....
    oper key: 2
    port priority: 1
    port number: 3
    port state: 61

Slave Interface: eno1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 6a:c1:....
Slave queue ID: 0
Aggregator ID: 1
Actor Churn State: none
Partner Churn State: none
Actor Churned Count: 0
Partner Churned Count: 0
details actor lacp pdu:
    system priority: 65535
    system mac address: 42:31:...
    port key: 9
    port priority: 255
    port number: 2
    port state: 63
details partner lacp pdu:
    system priority: 65535
    system mac address: 90:ef:...
    oper key: 2
    port priority: 1
    port number: 4
    port state: 61

路由:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.128.1   0.0.0.0         UG    100    0        0 br128
0.0.0.0         192.168.94.1    0.0.0.0         UG    100    0        0 br94
0.0.0.0         192.168.88.1    0.0.0.0         UG    100    0        0 br88
0.0.0.0         192.168.129.1   0.0.0.0         UG    100    0        0 br129
0.0.0.0         192.168.89.1    0.0.0.0         UG    100    0        0 br0
192.168.88.0    0.0.0.0         255.255.255.0   U     0      0        0 br88
192.168.88.1    0.0.0.0         255.255.255.255 UH    100    0        0 br88
192.168.89.0    0.0.0.0         255.255.255.0   U     0      0        0 br0
192.168.89.1    0.0.0.0         255.255.255.255 UH    100    0        0 br0
192.168.94.0    0.0.0.0         255.255.255.0   U     0      0        0 br94
192.168.94.1    0.0.0.0         255.255.255.255 UH    100    0        0 br94
192.168.128.0   0.0.0.0         255.255.255.0   U     0      0        0 br128
192.168.128.1   0.0.0.0         255.255.255.255 UH    100    0        0 br128
192.168.129.0   0.0.0.0         255.255.255.0   U     0      0        0 br129
192.168.129.1   0.0.0.0         255.255.255.255 UH    100    0        0 br129

Modprobe:

~# lsmod | grep bond
bonding               167936  0

答案1

为了解决您的第二个问题,您应该能够通过设置明确设置 mac 地址macaddress,例如将其设置为与您的物理接口相同的 MAC:

[...]
      br88:
        macaddress:       DE:AD:BE:EF:CA:FE
        dhcp4:            yes
        dhcp4-overrides:
          hostname:       defiant
        interfaces:
          - vlan88
      br94:
        macaddress:       DE:AD:BE:EF:CA:FE
        dhcp4:            yes
        dhcp4-overrides:
          hostname:       defiant94
        interfaces:
          - vlan94
[...]

相关内容