Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Bonding two wifi interfaces

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
DebbyIan
Posts: 158
Joined: 2013-05-09 12:12

Bonding two wifi interfaces

#1 Post by DebbyIan »

Hi,

I fitted a second wireless (802.11) adapter to my system that has a pre-existing one also installed. I can configure networking interfaces to get separate IP addresses on the LAN for each.

I've bee following the techniques here to bind the two interfaces into one. I would like to use Mode 4 or 6 for the purposes of optimising the infrastructure.

https://wiki.debian.org/Bonding

UNFORTUNATELY, when I try and raise bond0 I don't get a unified IP from the dhcp client. In fact the dhcp client timeouts. Please don't tell me that I can't bond two wifi interfaces.

Code: Select all

auto wlan0
iface wlan0 inet manual
  pre-up ifconfig $IFACE up
  post-down ifconfig $IFACE down
  wpa-conf /etc/wpa_supplicant/wpa-roam.conf

auto wlan1
iface wlan1 inet manual
  pre-up ifconfig $IFACE up
  post-down ifconfig $IFACE down
  wpa-conf /etc/wpa_supplicant/wpa-roam.conf

auto bond0
iface bond0 inet dhcp
post-up ifenslave bond0 wlan0 wlan1
pre-down ifenslave -d bond0 wlan0 wlan1
bond-slaves none
bond-mode 4
bond-miimon 100
Looking at the individual interfaces, they both associate correctly to the AP definition in wpa_supplicant. So that's not an issue. In fact I am still able to get internet access but only on wlan0.

alexwazan
Posts: 2
Joined: 2020-05-28 15:37

Re: Bonding two wifi interfaces

#2 Post by alexwazan »

i have the same problem and need help with that too

cuckooflew
Posts: 677
Joined: 2018-05-10 19:34
Location: Some where out west
Been thanked: 1 time

Re: Bonding two wifi interfaces

#3 Post by cuckooflew »

by DebbyIan »Please don't tell me that I can't bond two wifi interfaces.
Ok, I won't tell you that, but I will tell you it is not a good idea, and it is not practical, (in my humble opinion anyway)

https://askubuntu.com/questions/954438/ ... mmand-line
Furthermore, bonding wifi is not really a good idea. WiFi uses a shared medium, which means that the two cards cannot transmit at the same time. In fact more clients may lead to reduced overall performance.

In addition the other end of the connection has to be aware of the bonding arrangement. It has to know that it has two ways to the same client, and how packets should be handled. As the AP will really only have one interface (WiFi) towards the client, I'm not sure if bonding actually makes any sense.

In short: What are you trying to do, and why do you believe bonding is the answer?
Please Read What we expect you have already Done
Search Engines know a lot, and
"If God had wanted computers to work all the time, He wouldn't have invented RESET buttons"
and
Just say NO to help vampires!

DebbyIan
Posts: 158
Joined: 2013-05-09 12:12

Re: Bonding two wifi interfaces

#4 Post by DebbyIan »

Thanks, I came across that document. It's not quite clear why bonding two wifi interfaces is not a good idea. One can have a hunch however.

Let me reformulate my problem anyway. What I really want to accomplish is to load balance access to the gateway using multiple network interfaces/adapters. This I believe should be possible regardless of the type of ethernet facility used.

Code: Select all

auto wlan0
iface wlan0 inet dhcp
  pre-up ifconfig $IFACE up
  post-down ifconfig $IFACE down
  wpa-conf /etc/wpa_supplicant/wpa-roam.conf

auto wlan1
iface wlan1 inet dhcp
  pre-up ifconfig $IFACE up
  post-down ifconfig $IFACE down
  wpa-conf /etc/wpa_supplicant/wpa-roam.conf
In the usual fashion I can configure the two interfaces to get an IP from the main router, each separately. When this setup is run it turns out that only one of the interfaces is sending and receiving data. I would like to use both. I since came across this article but it's not very clear. This is what I have done so far but the results are finicky (doesn't work).

Code: Select all

auto wlan0
iface wlan0 inet dhcp
  pre-up ifconfig $IFACE up
  post-down ifconfig $IFACE down
	wpa-conf /etc/wpa_supplicant/wpa-roam.conf
  dns-nameservers 172.24.1.1 8.8.8.8
  post-up ip route add default scope global nexthop via 172.24.1.1 dev wlan0 weight 1 nexthop via 172.24.1.1 dev wlan1 weight 1
  post-up ip route add 172.24.1.48/29 dev wlan0 table wlan0_table
  post-up ip route add default via 172.24.1.50 dev wlan0 table wlan0_table
  post-up ip rule add from 172.24.1.1 table wlan0_table
  post-up ip rule add to 172.24.1.1 table wlan0_table
 
auto wlan1
iface wlan1 inet dhcp
  pre-up ifconfig $IFACE up
  post-down ifconfig $IFACE down
	wpa-conf /etc/wpa_supplicant/wpa-roam.conf
  dns-nameservers 172.24.1.1 8.8.8.8
  post-up ip route add 172.24.1.48/29 dev wlan1 table wlan1_table
  post-up ip route add default via 172.24.1.49 dev wlan1 table wlan1_table
  post-up ip rule add from 172.24.1.1 table wlan1_table
  post-up ip rule add to 172.24.1.1 table wlan1_table

DebbyIan
Posts: 158
Joined: 2013-05-09 12:12

Re: Bonding two wifi interfaces

#5 Post by DebbyIan »

I've managed to load balance two interfaces. Or at least what I feel it is.

Code: Select all

#auto wlan0
#iface wlan0 inet dhcp
#  pre-up ifconfig $IFACE up
#  post-down ifconfig $IFACE down
# wpa-conf /etc/wpa_supplicant/wpa-roam.conf
#  post-up ip route add 172.24.1.48/30 dev wlan0 table wlan0_table
#  post-up ip route add default via 172.24.1.1 dev wlan0 table wlan0_table
#  post-up ip rule add from 172.24.1.50/32 table wlan0_table
#  post-up ip rule add to 172.24.1.50/32 table wlan0_table

#auto wlan1
#iface wlan1 inet dhcp
#  pre-up ifconfig $IFACE up
#  post-down ifconfig $IFACE down
# wpa-conf /etc/wpa_supplicant/wpa-roam.conf
#  post-up ip route add default scope global nexthop dev wlan0 weight 1 nexthop dev wlan1 weight 1
#  post-up ip route add 172.24.1.48/30 dev wlan1 table wlan1_table
#  post-up ip route add default via 172.24.1.1 dev wlan1 table wlan1_table
#  post-up ip rule add from 172.24.1.49/32 table wlan1_table
#  post-up ip rule add to 172.24.1.49/32 table wlan1_table

auto wlan0
iface wlan0 inet dhcp
  pre-up ifconfig $IFACE up
  post-down ifconfig $IFACE down
  wpa-conf /etc/wpa_supplicant/wpa-roam.conf
  post-up ip route add 192.168.0.0/24 dev wlan0 table wlan0_table
  post-up ip route add default via 192.168.0.1 dev wlan0 table wlan0_table
  post-up ip rule add from 192.168.0.0/24 table wlan0_table
  post-up ip rule add to 192.168.0.0/24 table wlan0_table

auto wlan1
iface wlan1 inet dhcp
  pre-up ifconfig $IFACE up
  post-down ifconfig $IFACE down
  wpa-conf /etc/wpa_supplicant/wpa-roam.conf
  post-up ip route add default scope global nexthop dev wlan0 weight 1 nexthop dev wlan1 weight 1
  post-up ip route add 192.168.0.0/24 dev wlan1 table wlan1_table
  post-up ip route add default via 192.168.0.1 dev wlan1 table wlan1_table
  post-up ip rule add from 192.168.0.0/24 table wlan1_table
  post-up ip rule add to 192.168.0.0/24 table wlan1_table

Code: Select all

$ ip route show
default 
	nexthop dev wlan0 weight 1 
	nexthop dev wlan1 weight 1 
default via 192.168.0.1 dev wlan0 proto dhcp src 192.168.0.47 metric 302 
default via 192.168.0.1 dev wlan1 proto dhcp src 192.168.0.45 metric 303 
192.168.0.0/24 dev wlan0 proto dhcp scope link src 192.168.0.47 metric 302 
192.168.0.0/24 dev wlan1 proto dhcp scope link src 192.168.0.45 metric 303

Code: Select all

$ cat /etc/iproute2/rt_tables
#
# reserved values
#
255	local
254	main
253	default
0	unspec
#
# local
#
#1	inr.ruhep
1 wlan0_table
2 wlan1_table
I'd still like a critique of this if possible, or if indeed there any further suggestions to be made.

User avatar
eriefisher
Posts: 130
Joined: 2008-06-04 03:49
Location: Ontario's South Coast

Re: Bonding two wifi interfaces

#6 Post by eriefisher »

I have never tried this bonding of interfaces as I've never been aware of it until now. I also can't remember having a need for it. What I would like to know is why? Why is this useful? I have read the wiki page and understand what's happening. They describe it as "failover" and you are talking load balancing. Load balancing would indicate that the traffic load whether in or out bound is being evenly distributed across two devices. There is no guarantee that is what's happening. Besides, when it hit the router you have no control over that unless it's a wire/wireless set up and even the it's a toss up.

Confused
____________________________________________
There's a manual?
Siduction
Debian Sid
Xfce4 4.14

DebbyIan
Posts: 158
Joined: 2013-05-09 12:12

Re: Bonding two wifi interfaces

#7 Post by DebbyIan »

This serves two purposes. 1. Redundancy (failover) 2. Load balancing.
The bonding driver has six modes which can largely be catgorised in these two classes.
My primary interest is load balancing. I'm also interested in improving the performant throughput of the network I'm using. Having said this, the routing is carried out according to network contention wrt the interfaces. One can't control this. But the weighting defined in the nexthop tables seems good enough to me.

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Bonding two wifi interfaces

#8 Post by p.H »

DebbyIan wrote:I'd still like a critique of this if possible
Here you are.

0) You did not post the resulting ip rules and contents of the custom routing tables.

1) Combining DHCP and static routes and rules is not consistent. At this point you should use a static IP configuration.

2) Your setup creates conflicting routes and rules. The kernel will use one and ignore the others.

Code: Select all

      post-up ip rule add from 192.168.0.0/24 table wlan0_table
      post-up ip rule add from 192.168.0.0/24 table wlan1_table

      post-up ip rule add to 192.168.0.0/24 table wlan0_table
      post-up ip rule add to 192.168.0.0/24 table wlan1_table
Same destinations, different tables.

Code: Select all

    default via 192.168.0.1 dev wlan0 proto dhcp src 192.168.0.47 metric 302
    default via 192.168.0.1 dev wlan1 proto dhcp src 192.168.0.45 metric 303

    192.168.0.0/24 dev wlan0 proto dhcp scope link src 192.168.0.47 metric 302
    192.168.0.0/24 dev wlan1 proto dhcp scope link src 192.168.0.45 metric 303
Same destinations, different interfaces.

3) The multihop default route does not specify router (formerly gateway) addresses :

Code: Select all

    default
       nexthop dev wlan0 weight 1
       nexthop dev wlan1 weight 1
This is interpreted as "any IPv4 address is directly reachable on the link" which is of course wrong, because most destinations are actually reachable through a router. It won't work unless you set up some proxy ARP (ugly hack) for any address which is not reachable on link.

4) IIUC, this setup does load balancing only for the first outgoing packet of a connection when the source address is not defined before routing the packet and the destination is not 192.168.0.0/24, so the default multihop route is used.
It also does not do any efficient load balancing for incoming traffic. Load balancing is only a side effect of ARP resolution : by default the kernel replies to any ARP request for any local address on any interface, even though they do not match ("weak host model").
DebbyIan wrote:What I really want to accomplish is to load balance access to the gateway using multiple network interfaces/adapters. This I believe should be possible regardless of the type of ethernet facility used.
1) Wireless is not ethernet.

2) No, load balancing is not possible on any ethernet facility. As someone else wrote, a wireless access point is a shared medium. You can think of it as an ethernet hub or an ethernet coaxial wire : only one interface can talk a a given time or there would be collisions. So sending traffic through multiple interfaces connected to the same hub, coaxial wire, wireless access point or any other kind of shared medium would not increase throughput.

DebbyIan
Posts: 158
Joined: 2013-05-09 12:12

Re: Bonding two wifi interfaces

#9 Post by DebbyIan »

Those are four distinct rules. Same destination, different interfaces. The packet routing is managed by these rules.
You misunderstand a little. The interfaces themselves carry distinct connections but they don't crosstalk with one another. The transmissions are done in isolation. But to use the term load balance loosely, by adding multiple interfaces it's possible to increase the parallel bandwidth of the total overall transmissions. The routing offsets constituent traffic according to the weighting described.

Here's a reference that I've adapted for this use case:

https://www.lartc.org/howto/lartc.rpdb. ... links.html

Post Reply