Best way to configure Bonding in OpenWrt?

Umm not really sure how that would work, test it and let me know :grin:

Maybe someone can help me out, I'm not sure if this would work for me. I have two WAN interfaces named 'wan' and 'wan2'. One is through the standard ethernet port on my router for WAN connections, the other is a USB connection via easytether. WAN is the USB connection, metric of 10, WAN2 is ethernet, metric of 20. I would love to bond these two connections together so when WAN2 gets throttled, I can still add its bandwidth to WAN. I don't have broadband out where I am per se, WAN2 is connected to a 4G router with a 15gb per month max, after which it gets throttled to 600kpbs, which as we know isn't good for much of anything. However WAN (cell phone) via easytether doesn't track tether usage, so it just counts as cell internet which, while 'reprioritized' after 22gb per month, doesn't slow down nearly as dramatically. Also, network engineering is definitely not my strong suite so I prefer to ask before I just up and try something so as to avoid 10 hours of banging my head on a wall wondering why it won't work. Thanks!

Bonding requires the other end to combine the two links back into one interface. So you can't do it with two separate ISPs.

The situation you have would instead be load balancing, which you can do with the mwan3 package. It works best if the two ISPs are about the same speed though.

Ah, okay. Yeah, I'm looking for something more like running both connections at the same time and combining their bandwidth. I would've thought there'd be a way to do that. Thanks for the answer!

Mwan3 will split connections across two ISPs so that you can have more concurrent connections, and hence more total bandwidth, but it won't make any single connection faster.

there are. but it is kinda complicated and you need a server.
example: https://www.openmptcprouter.com/

@dlakelan Did you get it to work?
If i understand correctly, bonding will combine two nic's (1G+1G=2G) to have more bandwidth, but it should be set on both routers?!, bond 2 nic's on the first router and do the same on the second router?

Is it possible to combine two PPPOE connections via Mwan3 to faster internet?, cause it's possible to have more than one username and password.

One more question, is it possible to access my router remotely while ISP doesn't provide public ip, i think
vpn is the only way right now!

It works fine but as far as I know there is no UCI config etc, it's all manual.

Bonding isn't just about more bandwidth, it also offers ductility to failure, if a cable is faulty etc. And more parallelized CPU usage, handling multiple NICs.

Yes it requires the "other end" to support it. In this case just a smart switch with a link aggregation group.

If you set up mwan3 it can split your connections across multiple ISPs, no single connection will be faster but you can have more of them without saturation.

2 Likes

Thanks for the info, it's not a big problem if there's no UCI to set it up, but a script that will run at startup will do the job.
i mean two pppoe connection on the same isp!

It seems doable, but a second ISP would also provide ductility, if one has an outage the other takes over, etc.

Isp's here never goes off, cause they have more than one upstream provider.
but i know some people here a buying two subscription or more then they combine them into one(to get more
download speed) using mikrotek routers, so i think the same can achievable using Mwan3.

You'll never get more than your single-line speed on a single download as it is dependent on the upstream routing which is out of your control.

However, if you split your concurrent requests across two lines, your total download speed can be up to 2x higher. In practice I'd guess it to be more "sometimes up to 1.5x or so", as it's very difficult nearly impossible for any piece of routing software to know how much bandwidth a given connection will consume prior to routing the first packet and/as you can't change the IP of the connection mid-stream, without breaking the connection.

2 Likes

Yes absolutely the same can be done with mwan3.

It's also possible to dedicate one connection for low latency communications and another for bulk communications if latency is that important (like you have a home office or something and need to make several phone calls at once and have them all be rock solid)

1 Like

In the use case of an office, hotel, cafe etc. with many users, load balancing can be very effective. Mwan3 will bring all the lines to full usage.

2 Likes

Would it be possible for you to post an exact step by step instruction how you did it including prerequisites?
I'd like to use bonding with a WRT32x (eth0 and eth1 interfaces), that acts as a heavily used ap, and a smart switch, that supports link aggregation.

1 Like

I think there are guys that allready figured out how to completely do it. Could those please give a step by step explanation? :wave:

1 Like

The situation where you have two ports into one of these switch chips is different from the kind of thing I have done, where I have two ethernet devices on an x86 hooked by cat6 into a LAG group on ports of a managed switch product.

I don't know how much you can really accomplish given that your WRT32x is hard wired directly into a sort of pseudo-managed switch. you can't exactly tell the wrt32x switch chip to treat the two CPU ports as a single LAG port.

you can of course bond eth0 and eth1, and use round robin mode, but it may confuse the heck out of the switch chip and there's no guarantee what will happen in the receive direction.

2 Likes

I was able to get this going using your tip, slightly different usage though. I used it to bond 3 nics to LAN

in /etc/rc.local

# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

modprobe bonding mode=802.3ad miimon=100
ifconfig bond0 192.168.2.1 netmask 255.255.255.0 up
ip link set eth1 master bond0
ip link set eth2 master bond0
ip link set eth3 master bond0

exit 0

in /etc/config/network


config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd9e:4b25:870b::/48'

config interface 'bond0'
        option ifname 'bond0.1'
        option ifname 'bond0.2'
        option ifname 'bond0.3'

config interface 'lan'
        option type 'bridge'
        option ifname 'bond0'
        option proto 'static'
        option ipaddr '192.168.2.1'
        option netmask '255.255.255.0'
        option ip6assign '60'
        list dns '208.67.222.222'
        list dns '208.67.220.220'

config interface 'wan'
        option ifname 'eth0'
        option proto 'dhcp'

config interface 'wan6'
        option ifname 'eth0'
        option proto 'dhcpv6'

Testing the different modes ATM. Any tuning tips or a means of testing? FYI I have a 2.5gb WAN port to a 2.5gb modem. The LAN interface is 3 2.5gb NICs @ 1gb each to a managed 1gb/10gb switch. Reason being the switch will not do 2.5gb on a single interface and I'm trying to get the bottleneck minimized.

Testing should be easy - attach 3 devices to your managed switch and let them download files from a 1Gbps-connected internet server. You should get somewhat 600-700 Mbps on each device.
But keep in mind that no single stream can be faster than 1Gbps, they only sum up to a bonded 3 Gbps.

Hi,I have a question I'd like to ask you.I want to configure Bonding's mode in OpenWrt. There is a problem that my bonding is compiled in kernel.So,I can't use modprobe to configure bonding's mode.Can you give me some advices? Thank u in advance for your answwers and time.