WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: bridge eth0 with wlan0 for firefox?  (Read 3862 times)

Offline nick65go

  • Hero Member
  • *****
  • Posts: 839
bridge eth0 with wlan0 for firefox?
« on: March 07, 2021, 03:42:49 PM »
In TC12 (32bits) x86, I would like to make a bridge (a union) of eth0 and wlan0 and use this new network interface in firefox.
eth0 speed is max 100 Mb/s, wlan0 speed is max speed of 70 Mb/s so I expect to combine both up to 150 Mb/s as my router is capable.  My router has both 2x wireless antennas (one for me, one for UPC world-wide guests) and 4x wire ports-in.

1. How to do this? In apps I did not find something like "brctl" or "bridge"
2. After I have a bridge0=eth0+wlan0, how to force firefox to use it? In firefox menu Edit/Preference/ Network settings I did not see how to select this. Maybe something like manual proxy SOCKS Host some strings?
« Last Edit: March 07, 2021, 03:55:43 PM by nick65go »

Offline nick65go

  • Hero Member
  • *****
  • Posts: 839
Re: bridge eth0 with wlan0 for firefox?
« Reply #1 on: March 07, 2021, 04:23:12 PM »
if I am not wrong, the most recent bridge-utils are from TC4 ( year 2010) https://mirrors.dotsrc.org/tinycorelinux/4.x/x86/tcz/bridge-utils.tcz.info

Offline nick65go

  • Hero Member
  • *****
  • Posts: 839
Re: bridge eth0 with wlan0 for firefox?
« Reply #2 on: March 07, 2021, 05:07:27 PM »
so, i downloaded bridge-utils.tcz (from TC4_x86) and now I have file "brctl", I can add an empty bridge, then add eth0 to this bridge, but not wlan0:
Code: [Select]
tc@box:~$ tce-load -i bridge-utils
ipv6-netfilter-5.10.3-tinycore.tcz: OK
net-bridging-5.10.3-tinycore.tcz: OK
bridge-utils.tcz: OK
tc@box:~$ brctl
Usage: brctl [commands]
commands:
        addbr           <bridge>                add bridge
        delbr           <bridge>                delete bridge
        addif           <bridge> <device>       add interface to bridge

Code: [Select]
tc@box:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr xxxx
          inet addr:192.168.0.15  Bcast:192.168.0.255  Mask:255.255.255.0

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0

wlan0     Link encap:Ethernet  HWaddr yyyy
          inet addr:192.168.0.12  Bcast:192.168.0.255  Mask:255.255.255.0

tc@box:~$ sudo brctl addbr br0
tc@box:~$ sudo brctl addif br0 eth0
tc@box:~$ sudo brctl addif br0 wlan0
can't add wlan0 to bridge br0: Operation not supported


EDIT: TC12_x64 has updated bridge-utils.tcz. I did the same steps, and I finished in the same lock-down: could not add wlan0 to br0.
« Last Edit: March 07, 2021, 05:27:42 PM by nick65go »

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: bridge eth0 with wlan0 for firefox?
« Reply #3 on: March 08, 2021, 02:02:02 AM »
That's not how it works. Bridging means letting people on your wlan0 network connect to things on your eth0 network, through your computer.

To combine multiple network cards for speed, the keyword is "multipath TCP". And for that to work, the server needs to support it too. Most don't. So it's not useful for downloads from the internet, etc.
The only barriers that can stop you are the ones you create yourself.

Offline nick65go

  • Hero Member
  • *****
  • Posts: 839
Re: bridge eth0 with wlan0 for firefox?
« Reply #4 on: March 08, 2021, 05:10:33 AM »
@curaga: thanks for explaining how will not work  :) it was enlightening.

But maybe I did not explain very well what I was trying to test. Maybe "bridge-ing" is not the good word to use. My laptop has two NIC cards, one Wifi (wireless)- seen as wlan0, and one by cable --seen as eth0. Both can run simultaneosly passing through my phisical router. I understand that 100 Mb/s for wire and 70 Mb/s for wifi is "obsolete" with modern laptops. But understanding the concepts and appling them for wifi of 300 Mb/s and cable of 1Gb/s (maybe in future environment) was the key.

I understand that the download from same internet server, the source must support ""multipath TCP". But how about multiple concurent downloads from two servers, A and B? From server A, using eth0 100 MB/s for a movie, and from server B using wifi wlan0 70 Mb/s for a something else (download ISO, whatever). So the internet sources/servers are different, but maxim speed 150 Mb/s is limited by the router.

Any solution in TC linux for using two networks card of a laptop, passing a home router device provided by my ISP?
PS: what tempted me was that my router is basicaly two routers in one. First for 192.168.0.xx (for eth0, wlan0) max 150Mb/s. But it has another antena (120 Mb/s, for word-wide UPC clients) which is supposed to not limit first antena (150 Mb/s) if I trust the provider docs. The second guest-antena works on 192.168.101.yy and I can not control it, only its password. I can use this second antena also, but not with first antena in the same time.
« Last Edit: March 08, 2021, 05:34:27 AM by nick65go »

Offline nick65go

  • Hero Member
  • *****
  • Posts: 839
Re: bridge eth0 with wlan0 for firefox?
« Reply #5 on: March 08, 2021, 06:03:07 AM »
If I take a step back, it seams that I do not need to "link" the two NICs. What I would need will be that two programs (maybe just one and its clone, or another instance of it), lets name them firefox1 and firefox2, to download files as:
- firefox1 to comunicate on eth0
- firefox2 to communicate on wlan0
but these communications/downloads to be concurent.
So, even if (see my initial topic) step1 could be solved (it is not), then it remains step2 --> firefox tamed to use specif NIC card.
EDIT: Similar case can be: firefox use eth0 and wget/vlc/etc use wlan0, etc.
EDIT2: Can Linux automaticaly do multipath TPC/IP from Tinycore on both NICs to different servers, and I was not aware?
« Last Edit: March 08, 2021, 06:14:57 AM by nick65go »

Offline hiro

  • Hero Member
  • *****
  • Posts: 1229
Re: bridge eth0 with wlan0 for firefox?
« Reply #6 on: March 08, 2021, 06:13:48 AM »
That's not how it works. Bridging means letting people on your wlan0 network connect to things on your eth0 network, through your computer.

and that's *also* not how it works, because your wlan0 acting as a wifi station cannot be bridged. sadly the wifi spec is garbage and doesn't allow this, i.e. is not possible to map to ethernet 100%. you can do this only on the AP side, so in one wifi network, only one side can be bridged to a real ethernet.

and as curaga said, you don't want a bridge for this, and anyway, for many other reasons you also shouldn't.

Offline hiro

  • Hero Member
  • *****
  • Posts: 1229
Re: bridge eth0 with wlan0 for firefox?
« Reply #7 on: March 08, 2021, 06:18:00 AM »
the other thing that you mention, having one default route for one program and another default route for another is in fact easily done by using multiple network namespaces (with iproute2 to configure it all).
each namespace can have one link, one default route.

Offline nick65go

  • Hero Member
  • *****
  • Posts: 839
route eth0 and wlan0 for firefox to use both?
« Reply #8 on: March 08, 2021, 06:30:06 AM »
@hiro: wow, I think this will be the solution, if you are kind enough to show me here some basic script (can not be many line of code, isn't it?). Thank you.
PS: I do not know if will be misleading to change the topic title, replacing "bridge" with "route".

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11639
Re: bridge eth0 with wlan0 for firefox?
« Reply #9 on: March 08, 2021, 06:40:47 AM »
Hi nick65go
I thought what you are trying to do is  bonding.  At any rate. maybe this question and some of the links in the answers help:
https://askubuntu.com/questions/32179/two-ethernet-ports-on-motherboard-how-can-i-get-double-the-bandwidth

Offline nick65go

  • Hero Member
  • *****
  • Posts: 839
Re: bridge eth0 with wlan0 for firefox?
« Reply #10 on: March 08, 2021, 11:35:56 AM »
@Rich: Thanks for the "bounding" tip. I found fresh info about bounding.
https://www.kernel.org/doc/html/latest/networking/bonding.html
https://wiki.archlinux.org/index.php/Wireless_bonding 
https://en.wikipedia.org/wiki/Link_aggregation

I started the investigation, but I think I bit more than I can chew. I have to digest a lot of information, about iproute2, bound, etc. And I kind of predict that the result isn't worth it. I was hoping for easy fruits to pick up  ;) 
« Last Edit: March 08, 2021, 11:45:50 AM by nick65go »

Offline nick65go

  • Hero Member
  • *****
  • Posts: 839
bounding eth0 with wlan0 for firefox?
« Reply #11 on: March 08, 2021, 06:25:10 PM »
my progress in learning to make slave NICs in a master bound:
https://www.kernel.org/doc/html/latest/networking/bonding.html#configuring-bonding-manually-via-sysfs
3.4 Configuring Bonding Manually via Sysfs (no need for iproute2)
Options for the bonding driver are supplied as parameters to the bonding module at load time, or are specified via /sysfs
Code: [Select]
modprobe bonding
echo +bond0 > /sys/class/net/bonding_masters
echo active-backup > /sys/class/net/bond0/bonding/mode
echo 1000 > /sys/class/net/bond0/bonding/miimon
echo 12 > /sys/class/net/bond0/bonding/lp_interval

To enslave interface eth0, eth1 to bond bond0:
Code: [Select]
ifconfig bond0 192.168.0.1 netmask 255.255.255.0 up
echo +eth0 > /sys/class/net/bond0/bonding/slaves
echo +eth1 > /sys/class/net/bond0/bonding/slaves

The bonding driver supports two schemes for monitoring a slave device’s link state: the ARP monitor and the MII monitor, but not simultaneously. To add ARP targets:
Code: [Select]
echo 2000 > /sys/class/net/bond1/bonding/arp_interval
echo +192.168.0.100 > /sys/class/net/bond0/bonding/arp_ip_target
echo +192.168.0.101 > /sys/class/net/bond0/bonding/arp_ip_target

12.1.1 MT(Maximizing Throughput) Bonding Mode Selection for Single Switch Topology [Router]
The active-backup [1], balance-tlb [2] and balance-alb [3] modes do not require any specific configuration of the switch.
so I eliminated modes: broadcast, balance-rr, balance-xor, 802.3ad,

active-backup [1]: the inactive backup devices are all connected to the same peer as the primary. load balancing mode (with link monitoring) will provide the same level of network availability, but with increased available bandwidth

balance-tlb [2]: balances outgoing traffic by peer (use MAC address), send all traffic across a single device; ARP monitor is not available.

balance-alb [3]: same as balance-tlb [2], + balance incoming traffic from "local" network peers; but network device driver must support changing the hardware address while the device is open.
« Last Edit: March 08, 2021, 06:28:04 PM by nick65go »