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 / 问题 / 1064396
Accepted
Mikhail Kupchik
Mikhail Kupchik
Asked: 2021-05-23 02:44:39 +0800 CST2021-05-23 02:44:39 +0800 CST 2021-05-23 02:44:39 +0800 CST

无需 ifenslave 命令即可更改 Linux 网络绑定接口的活动从属设备

  • 772

Linux 支持绑定多个以太网网络接口以获得额外的可靠性或负载平衡。

绑定驱动程序过去是通过ifenslave命令配置的,该命令已被弃用(由iproute2ip工具包中的命令取代),因此已从内核源代码中删除。ifenslave

已弃用命令的一个特殊功能是我找不到现代等效命令,即更改绑定接口的活动从属设备(假设绑定接口在该active-backup模式下运行)。

例如,以下命令将eth0网卡设置为bond0接口的活动从属:

ifenslave -c bond0 eth0
ifenslave --change-active bond0 eth0

有没有办法使用iproute2ip工具包中的命令或通过 sysfs 更改 Linux 绑定接口的活动从属?

linux bonding linux-networking iproute2
  • 1 1 个回答
  • 2161 Views

1 个回答

  • Voted
  1. Best Answer
    Anton Danilov
    2021-05-23T12:40:54+08:002021-05-23T12:40:54+08:00

    创建绑定接口的过程:

    # create the bonding interface with active-backup mode
    ip link add name bond0 type bond mode active-backup
    
    # add the under laying interfaces
    # the interface, that has been added first, will be active
    ip link set master bond0 dev eth1
    ip link set master bond0 dev eth0
    
    # enable the bonding interface
    ip link set up dev bond0
    ip address add 192.168.100.1/24 dev bond0
    
    # check the results: detailed info and statistics of bond0
    ip -s -s -d link ls dev bond0
    
    # check the state of ALL under laying interfaces
    # with statistics and details 
    ip -s -s -d link ls master bond0
    
    # check the kernel logs
    journalctl -kn 20
    

    要更改绑定设备的活动链接,您应该使用以下命令:

    ip link set dev bond0 type bond active_slave eth0
    

    如果您收到类似的错误,RTNETLINK answers: invalid argument请检查dmesg或journalctl -k输出。

    有关选项的简要帮助,您可以使用ip link add type bond help命令。它适用于任何链接类型。

    bond0您可以使用ip -d l ls dev bond0命令获取当前接口选项的所有值。

    • 2

相关问题

  • 多操作系统环境的首选电子邮件客户端

  • 你最喜欢的 Linux 发行版是什么?[关闭]

  • 更改 PHP 的默认配置设置?

  • 保护新的 Ubuntu 服务器 [关闭]

  • (软)Ubuntu 7.10 上的 RAID 6,我应该迁移到 8.10 吗?

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