How to add a bond to a bridge interface

How to add a bond to a bridge interface?

Create bridge, create bond, enslave interfaces to bond, add bond to bridge, assign address to bridge if needed?

the bond needs a IP and mask assigned... otherwise it isn't started.
Can I omit the IP configuration in the bridge/lan interface section or how is this supposed to work?

I tried this

config device
	option name 'br-lan'
	option type 'bridge'
	option ageing_time '14410'
	list ports 'bond-lan'

 config interface 'lan'
	option proto 'bonding'
	option force_link '1'
	option ipaddr 'x.x.x.x'
	option netmask ''
	option ip6assign '64'
	list slaves 'eth0'
	list slaves 'eth1'
	option bonding_policy 'balance-rr'
	option packets_per_slave '1'
	option all_slaves_active '0'
	option link_monitoring 'off'

The bond comes up and seems to work but no bridge interface is created.

On Linux you can not add interfaces to a bridge if the interface holds an IP address. Only the bridge can be assigned addresses.

So, how to create the bond without an IP address?


Just remove the IP config from the interface stanza?

As I wrote in my first post the bond interface needs an IP/Mask assigned otherwise the netifd script throws a error.
I tried to remove the condition check from the script but it still doesn't work.

You might want to take a look at this code for some inspiration - it's a good number of years old, but it sets up a bond interface for aggregating multiple internet connections.

Thanks, I found this too.
But I would rather have a solution that works natively out of the box.

That was (for me) not quiet clear.

I would suggest to write a bug report.

Either try to patch it by your self or for the time being, bring the interface up with a simple script. I.e. hook on the bridge and after it's created, create the bond by a simple one shot script and add it to your bridge :man_shrugging:
And like I said, yes, this sounds like a bug based on wrong assumptions. I would expect, too, that I can create a bond without an IP address config.

Edit. Ps: try to reply to a post so the other one gets notified.

You can't use this anyway since it's designed to bond two links together and requires a kernel patch.

However, the procedure for creating a bond interface and adding slaves to it becomes clear if you read the code, hence the suggestion to "use it as inspiration" instead of shooting in the dark