AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 894828
Accepted
Mat
Mat
Asked: 2018-01-31 09:05:58 +0800 CST2018-01-31 09:05:58 +0800 CST 2018-01-31 09:05:58 +0800 CST

Linux 绑定模式 802.3ad 未激活

  • 772

在运行Debian Stretch的服务器上,我使用802.3ad 模式配置了一个bond0 ,如下所示:

auto bond0
iface bond0 inet manual
        slaves eth0 eth2
        bond_miimon 100
        bond_mode 802.3ad

bond0接口已启动并正在运行,但它正在使用负载平衡(循环)模式:

root@servir01:~# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth0
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 2
Permanent HW addr: e4:1f:13:65:f0:c4
Slave queue ID: 0

Slave Interface: eth2
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 2
Permanent HW addr: e4:1f:13:36:a3:ac
Slave queue ID: 0

在交换机上,LAG 是在启用 LACP 的情况下正确创建的,并且它的两个端口都已启动并正在运行:

[滞后状态[1]

Unit3/port1 的状态

Unit4/port1的状态

同一台机器有另一个以相同方式配置的绑定接口(eth1 和 eth3 接口上的bond1),连接在相同的交换机上,并且 LACP 工作良好:

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

802.3ad info
LACP rate: slow
Min links: 0
Aggregator selection policy (ad_select): stable
System priority: 65535
System MAC address: e4:1f:13:65:f0:c6
Active Aggregator Info:
    Aggregator ID: 1
    Number of ports: 2
    Actor Key: 9
    Partner Key: 1010

为什么bond0 接口不想启用LACP?我哪里错了?

debian
  • 4 4 个回答
  • 9455 Views

4 个回答

  • Voted
  1. Radar
    2018-07-11T12:04:49+08:002018-07-11T12:04:49+08:00

    老问题,但由于它在搜索中很早就出现了,而且我有一个类似的设置,同样的问题。这是我如何让它工作的,(在 Debian stretch 上使用 ifenslave)......

    /etc/网络/接口...

        # The loopback network interface
        auto lo
        iface lo inet loopback
    
        # bond0 is the bonded NIC and can be used like any other normal NIC.
        # bond0 is configured using static addressing.
        auto bond0
        iface bond0 inet static
        address <your static address>
        gateway <your gateway>
        # bond0 uses standard IEEE 802.3ad LACP bonding protocol
        bond-mode 4
        bond-miimon 100
        bond-lacp-rate 0 (This is on a small NAS, so no rush)
        bond-slaves none
    
        # eth0 is manually configured, and enslaved to the "bond0" pseudo NIC
        allow_hotplug eth0
        auto eth0
        iface eth0 inet manual
        bond-master bond0
    
        # eth1 ditto, thus creating a 2-link bond.
        allow_hotplug eth1
        auto eth1
        iface eth1 inet manual
        bond-master bond0
    

    原因是什么?

    好吧,网卡会出现,绑定驱动程序会抓住它们,然后网卡会重新配置为从站,绑定驱动程序会恐慌,因为它没有从站,并且像无头鸡一样跑来跑去(循环)。

    现在,bonding 驱动程序出现,发现它没有从设备,所以它坐下来等待...... NIC 看到他们有一个主设备,所以他们去报告,从 bond0 获取他们的地址,然后开始工作他们都走了。

    • 5
  2. quaie
    2020-02-06T04:49:28+08:002020-02-06T04:49:28+08:00

    在 debian 10 上测试(在阅读了这个线程和 debian 绑定文档之后)

    配置在下面(没有编辑其他文件 - 模块或类似的东西)

    auto enp4s0f2
    allow-hotplug enp4s0f2
    iface enp4s0f2 inet manual
            bond-master bond1
            bond-mode 4
    
    auto enp4s0f3
    allow-hotplug enp4s0f3
    iface enp4s0f3 inet manual
            bond-master bond1
            bond-mode 4
    
    auto bond1
    iface bond1 inet static
            address 1.2.3.4
            netmask 255.255.255.0
            bond-mode 4
            bond-slaves none
            bond-miimon 100
            bond-lacp-rate 1
            bond-updelay 800
            bond-downdelay 400
            bond_xmit_hash_policy layer2+3    # optional, sets the bonding algorithm
    

    什么是新的:

    • 接口在绑定之前启动
    • 还指定了绑定模式@接口级别
    • 债券没有定义奴隶
    • 2
  3. Arunas Bartisius
    2021-08-21T08:06:36+08:002021-08-21T08:06:36+08:00

    在 Debian 10 buster 升级(full-upgrade)到 Debian 11 Bullseye 后花了几天时间,所以想分享一下绑定问题的解决方案。

    Debian Linux 升级后,现有的中继配置不再工作。有重大更改,称为错误:

    • https://www.debian.org/releases/bullseye/amd64/release-notes/ch-information.html
    • https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=990428
    • https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=968368

    以前在 Debian 10 上工作的 bond0 配置是这样的:

    cat /etc/network/interfaces.d/bond0
    
    auto enp9s0f0
    iface enp9s0f0 inet manual
            bond-master bond0
            bond-mode 4
    
    auto enp9s0f1
    iface enp9s0f1 inet manual
            bond-master bond0
            bond-mode 4
    
    auto bond0
    iface bond0 inet static
            address 192.168.23.1
            network 192.168.23.0
            netmask 255.255.255.128
    
            bond-slaves none
            bond-miimon 100
            bond-lacp-rate 1         # 'fast' detection, every 1s, instead of 'slow', every 30s
    #        bond-updelay 100        # optional, mostly for debugging
    #        bond-downdelay 100      # optional, mostly for debugging
            bond-xmit-hash-policy layer2+3    # optional, sets the bonding algorithm
    

    这导致没有配置bond0,甚至出现如下错误:

    RTNETLINK answers: Cannot assign requested address
    run-parts: /etc/network/if-pre-up.d/ifenslave exited with return code 1
    networking.service: Main process exited, code=exited, status=1/FAILURE
    

    或者

    journalctl -n -u networking
    

    显示错误线

    No iface stanza found for master
    

    其中“节”是所谓的模块配置,开发人员使用的术语。

    其根本原因是ifenslave包被重构了很多,主要思想是从子项目中删除“节”,它们是物理接口(nic),并将其全部保存在一个地方,例如绑定接口它自己。

    即使在ifenslave版本 1.22 中也存在错误,指的ifstate是 Debian 11 中不存在的命令。简单快速的修复是:

    sed -i 's/ifstate -l/ip link show dev/g' /etc/network/if-pre-up.d/ifenslave
    

    即使在修复此问题后,绑定也不起作用,这意味着存在问题的错误,为什么绑定在 Bullseye 上不起作用。

    翻阅代码,我发现关键的变化不仅是bond-mode从 child 中删除并重新设置为bond接口配置,就像早期的 package 时代一样,而且还恢复到早期的bond-slaves.

    因此工作的 Debian 11 Bullseye 绑定配置文件如下所示:

    cat /etc/network/interfaces.d/bond0
    
    auto enp9s0f0
    iface enp9s0f0 inet manual
            bond-master bond0
    
    auto enp9s0f1
    iface enp9s0f1 inet manual
            bond-master bond0
    
    auto bond0
    iface bond0 inet static
            address 192.168.23.1
            network 192.168.23.0
            netmask 255.255.255.128
    
            bond-mode 4
            bond-slaves enp9s0f0 enp9s0f1
            bond-miimon 100
            bond-lacp-rate 1         # 'fast' detection, every 1s, instead of 'slow', every 30s
    #        bond-updelay 100        # optional, mostly for debugging
    #        bond-downdelay 100      # optional, mostly for debugging
            bond-xmit-hash-policy layer2+3    # optional, sets the bonding algorithm
    

    2022 年更新:

    最近在一台金属服务器上,我遇到了一个问题,即在内核升级和删除旧内核后,系统变得无网络。长话短说 - 可能存在绑定内核模块未加载、不存在或由于版本混淆或 initrd 混乱而导致任何加载失败的情况。检查:

    lsmod | grep bond
    bonding               167936  0
    

    如果它不存在,这是问题的罪魁祸首。尝试手动加载模块modprobe bonding并检查它是否加载。调查加载的内核版本是否与应有的版本相对应,uname -r并检查该版本是否存在模块目录。

    参考:https ://www.kernel.org/doc/Documentation/networking/bonding.txt

    • 2
  4. Best Answer
    Mat
    2018-10-27T01:51:57+08:002018-10-27T01:51:57+08:00

    我解决了这个问题,将以下内容添加到债券配置中/etc/network/interfaces:

    bond_xmit_hash_policy layer2+3
    

    添加此配置并重新启动网络后,一切正常。

    • 0

相关问题

  • 关闭 FTP

  • 如何在同一台电脑上从 putty 连接 debian vmware

  • debian- 文件到包的映射

  • Debian Ubuntu 网络管理器错误 [关闭]

  • 为本地网络中的名称解析添加自定义 dns 条目

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve