Subject: using ip command to config bond interface

From: Guning Lin <[email-masked]>
Date: Wed, 11 Oct 2023 15:52:23 +0800

Hi:

I want to use ip command to config bond interface at once, but it didn't
work, Can you help me? Here are context:

1. I have two native interfaces eth0 and eth1

2. I've tried this command blow to add a bond interface bond0

ip link add bond0 type bond mode active-backup miimon 200 downdelay 100
> updelay 100

ip link add bond0 type bond mode 2 miimon 200 downdelay 100 updelay 100

ip link add bond0 type bond mod=2 miimon=200 downdelay=100 updelay=100

3. all of them return code 0 but when I see the mode using  `cat
/proc/net/bonding/bond0`, it shows:

localhost:~# cat /proc/net/bonding/bond0

Ethernet Channel Bonding Driver: v6.1.27-2-lts

> Bonding Mode: load balancing (round-robin)

MII Status: up

MII Polling Interval (ms): 0

Up Delay (ms): 0

Down Delay (ms): 0

Peer Notification Delay (ms): 0

.....

There must be something wrong with my command, so it result in the default
params

I've ried some way to find the `ip` command manaual, but got nothing
useful.

Thanks!

---

From: Guido Trotter <[email-masked]>
Date: Wed, 11 Oct 2023 13:13:58 +0200

On Wed, 11 Oct 2023 at 09:53, Guning Lin <[email-masked]> wrote:
>
> Hi:
>
> I want to use ip command to config bond interface at once, but it didn't work, Can you help me? Here are context:
>
>> ip link add bond0 type bond mode active-backup miimon 200 downdelay 100 updelay 100
>>
> 3. all of them return code 0 but when I see the mode using  `cat /proc/net/bonding/bond0`, it shows:
>>
> There must be something wrong with my command, so it result in the default params
>
> I've ried some way to find the `ip` command manaual, but got nothing useful.
>
> Thanks!

It seems you created the bond, but you also need to add interfaces to it?

Something like:

ip link set eth0 master bond0
ip link set eth1 master bond0

And then of course you'll need to bring the interface up, etc...
Any reason you don't want to do this via /etc/network/interfaces ?

Cheers,

Guido

---

From: Guning Lin <[email-masked]>
Date: Wed, 11 Oct 2023 19:31:27 +0800

Hi Guido:
  Thanks for your reply. The command you mentioned above is what I am going
to run.
  But I am trapped in the bond-type interface args not being effected.
  My target is to set the bond0 interface in mode active-backup(mode 2),
and the command I run to create this interface bond0 did not work
  And in my situation, I just want to run the command once without saving
any file on disk.But I will consider your opinion.

  If we can find the `ip` command or  `bond type` manaul , i think we can
solve the problem.