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
    • 最新
    • 标签
主页 / unix / 问题 / 555745
Accepted
iBug
iBug
Asked: 2019-12-06 06:08:09 +0800 CST2019-12-06 06:08:09 +0800 CST 2019-12-06 06:08:09 +0800 CST

删除从 /etc/network/interfaces (ifupdown) 创建的绑定接口?

  • 772

我尝试将两个接口合二为一,创建了bond0,但发现它并不令人满意。/etc/network/interfaces然后我恢复了对和运行的所有更改systemctl restart networking.service,但是绑定接口仍然存在(显示在ifconfig和ip link命令中),我不得不运行ip link set bond0 down或ifconfig bond0 down强制将其踢出。如何在不重新启动服务器的情况下完全删除此接口?

我在 Debian Buster 上。该文件最初是这样的:

auto eno1
iface eno1 inet static
    # regular network settings like address, netmask, gateway etc.
auto eno2
iface eno2 inet static
    # regular network settings like address, netmask, gateway etc.

我通过将其更改为以下方式将两个接口变成了一个键:

auto eno1
iface eno1 inet manual
    bond-master bond0
auto eno2
iface eno2 inet manual
    bond-master bond0

auto bond0
iface bond0 inet static
    # regular network settings like address, netmask, gateway etc.
linux networking
  • 2 2 个回答
  • 28393 Views

2 个回答

  • Voted
  1. binarym
    2019-12-06T08:38:37+08:002019-12-06T08:38:37+08:00

    绑定接口由ifenslave(8)命令行实用程序管理。

    以下是手册页的摘录:

    NAME
         ifenslave -- Attach and detach slave network devices to a bonding device.
    
    SYNOPSIS
         ifenslave [-acdfhuvV] [--all-interfaces] [--change-active] [--detach] [--force] [--help] [--usage] [--verbose] [--version] master slave ...
    
    DESCRIPTION
         ifenslave is a tool to attach and detach slave network devices to a bonding device.  A bonding device will act like a normal Ethernet network device to the kernel,
         but will send out the packets via the slave devices using a simple round-robin scheduler.  This allows for simple load-balancing, identical to "channel bonding" or
         "trunking" techniques used in switches.
    
         The kernel must have support for bonding devices for ifenslave to be useful.
    
    OPTIONS
         -a, --all-interfaces
                 Show information about all interfaces.
    
         -c, --change-active
                 Change active slave.
    
         -d, --detach
                 Removes slave interfaces from the bonding device.
    

    免责声明:我没有测试以下

    要完全删除bond0,我会:

    • ifconfig bond0 down
    • ifenslave -d bond0 eno1
    • ifenslave -d bond0 eno2
    • ̀rmmod绑定`

    应该够了。

    • 2
  2. Best Answer
    A.B
    2019-12-06T09:32:50+08:002019-12-06T09:32:50+08:00

    与大多数其他接口一样,管理绑定接口的现代命令在ip link这里与sysfs一起用于可能的少数事情,而不是通过(rt)netlink直接处理。在这种情况下:

    ip link delete dev bond0
    

    移除绑定时仍然被奴役的任何接口都将被分离,因此无需先将其分离(使用ip link set DEVICE nomaster)。

    执行相同操作的另一种sysfs方法是:

    echo -bond0 > /sys/class/net/bonding_masters
    
    • 2

相关问题

  • 使用键盘快捷键启动/停止 systemd 服务 [关闭]

  • 奇怪的路由器与centos 6一起工作[关闭]

  • 需要一些系统调用

  • astyle 不会更改源文件格式

  • 通过标签将根文件系统传递给linux内核

Sidebar

Stats

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

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

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

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve