Linux支持连接多个以太网网络接口,以实现额外的可靠性或负载平衡。
以前,绑定驱动程序是通过ifenslave命令配置的,该命令已经被废弃(被来自iproute2工具箱的ip命令所取代),因此ifenslave被从内核源中删除。
不推荐命令的一个特殊特性(我找不到一个现代的等效命令)是更改绑定接口的活动从节点(假设绑定接口在active-backup模式下运行)。
例如,以下命令将eth0网卡设置为bond0接口的活动从服务器:
ifenslave -c bond0 eth0
ifenslave --change-active bond0 eth0是否有一种方法可以使用ip命令从iproute2工具箱或通过sysfs更改Linux连接接口的活动从服务器?
发布于 2021-05-22 20:40:54
创建键合界面的过程:
# 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接口当前选项的所有值。
https://serverfault.com/questions/1064396
复制相似问题