3

I want to be able to change the bond mode of an interface using the ip link command, but I can't figure out the correct syntax. The help text for the command is:

$ ip link help bond
Usage: ... bond [ mode BONDMODE ] [ active_slave SLAVE_DEV ]
                [ clear_active_slave ] [ miimon MIIMON ]
                [ updelay UPDELAY ] [ downdelay DOWNDELAY ]
                [ use_carrier USE_CARRIER ]
                [ arp_interval ARP_INTERVAL ]
                [ arp_validate ARP_VALIDATE ]
                [ arp_all_targets ARP_ALL_TARGETS ]
                [ arp_ip_target [ ARP_IP_TARGET, ... ] ]
                [ primary SLAVE_DEV ]
                [ primary_reselect PRIMARY_RESELECT ]
                [ fail_over_mac FAIL_OVER_MAC ]
                [ xmit_hash_policy XMIT_HASH_POLICY ]
                [ resend_igmp RESEND_IGMP ]
                [ num_grat_arp|num_unsol_na NUM_GRAT_ARP|NUM_UNSOL_NA ]
                [ all_slaves_active ALL_SLAVES_ACTIVE ]
                [ min_links MIN_LINKS ]
                [ lp_interval LP_INTERVAL ]
                [ packets_per_slave PACKETS_PER_SLAVE ]
                 [ tlb_dynamic_lb TLB_DYNAMIC_LB ]
                [ lacp_rate LACP_RATE ]
                [ ad_select AD_SELECT ]
                [ ad_user_port_key PORTKEY ]
                [ ad_actor_sys_prio SYSPRIO ]
                [ ad_actor_system LLADDR ]

BONDMODE := balance-rr|active-backup|balance-xor|broadcast|802.3ad|balance-tlb|balance-alb
ARP_VALIDATE := none|active|backup|all
ARP_ALL_TARGETS := any|all
PRIMARY_RESELECT := always|better|failure
FAIL_OVER_MAC := none|active|follow
XMIT_HASH_POLICY := layer2|layer2+3|layer3+4|encap2+3|encap3+4
LACP_RATE := slow|fast
AD_SELECT := stable|bandwidth|count

I've tried many variations of the command, an example shown below. I know that I can use the interfaces files of various distributions to set the mode, but I just wanted to be able to use the ip link command, it's very useful to me for real time troubleshooting without reboots.

$ ip link set dev bt  mode 0
Error: argument "0" is wrong: Invalid link mode

$ ip link set dev bt  mode active-backup
Error: argument "active-backup" is wrong: Invalid link mode

thank you

1 Answer 1

4

Make sure to specify the interface type:

# ip link set dev bt type bond mode active-backup
2
  • 1
    Linux being a cleanly designed OS with a+ interfaces I get a easy to understand and clear feedback from this command, i.e. "RTNETLINK answers: Directory not empty" ;-) Thanks for finding the right syntax though! Nov 26, 2019 at 19:05
  • 1
    dmesg shows the real error, for example for me it was bond1: option mode: unable to set because the bond device has slaves Jun 18, 2020 at 10:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .