Change an active slave of Linux network bonding interface without ifenslave command
Solution 1:
Create procedure for bonding interface:
# 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
To change the active link for bonding device you should use this command:
ip link set dev bond0 type bond active_slave eth0
If you have gotten the error like RTNETLINK answers: invalid argument
then check the dmesg
or the journalctl -k
outputs.
For brief help for options you can use ip link add type bond help
command. It applies to any link type.
All values of current options of bond0
interface you can get with ip -d l ls dev bond0
command.