You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何测试Linux主备模式(Active/Backup)绑定网卡(bond)接口

Testing eth1's Path in Active/Backup Bond Without Disrupting Services

Alright, let's tackle this problem. You've got an Active/Backup bond (bond0) running with eth0 as the primary active slave, and you need to verify eth1's data path without messing up your live services. Here are the safest, non-intrusive ways to get this done:

First, let's confirm your current bond state to make sure we're working with the right setup. Run this command to check which slave is active and verify bond configuration:

cat /proc/net/bonding/bond0

Look for the "Active Slave" line (should be eth0) and confirm the mode is set to active-backup (mode=1).


This is the most straightforward approach since it uses the bond driver's native functionality, and the switchover is nearly instantaneous—most workloads won't notice any disruption.

  • Switch active slave to eth1:
    Run this command to force the bond to use eth1 as the active interface:

    echo eth1 > /sys/class/net/bond0/bonding/active_slave
    

    Re-run cat /proc/net/bonding/bond0 to confirm eth1 is now listed as the Active Slave.

  • Test eth1's connectivity:

    • Use ping to verify basic reachability (specify bond0 as the interface to ensure traffic goes through the bond stack):
      ping -I bond0 <your-test-target-ip>
      
    • Use tcpdump on eth1 to confirm traffic is passing through it:
      tcpdump -i eth1 -n host <your-test-target-ip>
      
      You should see ICMP (ping) packets or other test traffic flowing through eth1.
    • For throughput testing, use iperf3 with a remote server (bind to bond0 to use the bond interface):
      iperf3 -c <iperf-server-ip> -B <bond0-ip>
      
  • Switch back to eth0:
    Once testing is done, revert to your original active slave with:

    echo eth0 > /sys/class/net/bond0/bonding/active_slave
    

    Note: If your bond configuration has a primary parameter set (e.g., in your distro's network config file like /etc/sysconfig/network-scripts/ifcfg-bond0), the bond will automatically revert to eth0 after a reboot even if you forget to run this command.


If you just want to verify eth1's physical link and basic data path without sending production traffic through it, use these checks:

  • Verify eth1's link state is up:
    ip link show eth1
    
    Look for UP in the output.
  • Use ethtool to check link details (speed, duplex, carrier status):
    ethtool eth1
    
  • Send test traffic directly to eth1's MAC address to confirm physical path functionality:
    First, get eth1's MAC with ip link show eth1, then use arping to send ARP requests through eth1 to your gateway:
    arping -I eth1 -c 5 <gateway-ip>
    
    This confirms eth1 can send and receive frames on the network.

Key Notes

  • Both methods avoid modifying permanent network configurations, so your setup will revert to normal if you reboot or restart the network service.
  • The active slave switchover is designed to be seamless—most applications won't even notice the brief transition.

内容的提问来源于stack exchange,提问作者Zaboj Campula

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 09:39:33