21 jun 2012
#what is this?
for years i wanted to be able to change from a wireless setup to a wired one in a transparent fashion, that is:
but altough this seems to be a default on mac os x and maybe on windows vista+ (not sure for windows) it never worked on linux. this was probably caused by the fact: that i tried to use a bridge at first and wlan does not go well together with ethernet (kernel related limitiation; maybe MTU settings?).
i can’t remember why bonding failed last time i tried it (2years ago?) - maybe because of the used linux drivers?
first read the manual at [1]. here is the sequence of actions i had to take:
# rmmod bonding
# modprobe bonding mode=active-backup miimon=100 primary=eth0
# ifconfig bond0 up
# ifenslave bond0 eth0 --verbose
since wlan drivers are somehow odd from time to time i usually prefer to shut wlan0 down:
# ip l set wlan0 down
my first and failed attempt to to get wlan0 to bond0:
# ifenslave bond0 wlan0 --verbose
ifenslave.c:v1.1.0 (December 1, 2003)
o Donald Becker (becker@cesdis.gsfc.nasa.gov).
o Detach support added on 2000/10/02 by Willy Tarreau (willy at meta-x.org).
o 2.4 kernel support added on 2001/02/16 by Chad N. Tindel
(ctindel at ieee dot org).
ABI ver is 2
current hardware address of master 'bond0' is 00:23:7d:00:ff:fe, type 1
Interface 'wlan0': flags set to 1002.
Interface 'wlan0': address cleared
Master 'bond0': Error: SIOCBONDENSLAVE failed: Operation not possible due to RF-kill
Master 'bond0': hardware address set to 00:23:7d:00:ff:fe.
Slave 'wlan0': MTU set to 1500.
Master 'bond0', Slave 'wlan0': Error: Enslave failed
so after disabling the RF-kill (i have a wlan rf-kill switch on the keyboard)
# ifenslave bond0 wlan0
just to make sure all services work as expected, i restart them:
# stop dhcpcd
# dhcpcd bond0
# stop wpa_supplicant
# start wpa_supplicant
# ip a
2: eth0: mtu 1500 qdisc pfifo_fast master bond0 state UP qlen 1000
link/ether 00:23:7d:00:ff:fe brd ff:ff:ff:ff:ff:ff
3: wlan0: mtu 1500 qdisc mq master bond0 state UP qlen 1000
link/ether 00:23:7d:00:ff:fe brd ff:ff:ff:ff:ff:ff
5: bond0: mtu 1500 qdisc noqueue state UP
link/ether 00:23:7d:00:ff:fe brd ff:ff:ff:ff:ff:ff
inet 192.168.2.105/24 brd 192.168.2.255 scope global bond0
inet6 fe80::223:7dff:fe00:6ec8/64 scope link
valid_lft forever preferred_lft forever
note:
also note: i do not use wicd/network manager
# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=1 ttl=50 time=30.8 ms
64 bytes from 8.8.8.8: icmp_req=2 ttl=50 time=28.4 ms
64 bytes from 8.8.8.8: icmp_req=3 ttl=50 time=30.5 ms (here i unplug eth0)
64 bytes from 8.8.8.8: icmp_req=4 ttl=50 time=30.5 ms
64 bytes from 8.8.8.8: icmp_req=5 ttl=50 time=31.4 ms
64 bytes from 8.8.8.8: icmp_req=6 ttl=50 time=30.9 ms
64 bytes from 8.8.8.8: icmp_req=7 ttl=50 time=32.2 ms
^C
--- 8.8.8.8 ping statistics ---
7 packets transmitted, 7 received, 0% packet loss, time 6008ms
rtt min/avg/max/mdev = 28.420/30.708/32.215/1.105 ms
i also did some bandwidth tests downloading a big file from my local samba server and it changed from slow when being on wlan to fast when plugging in the cable (took about 1-3 seconds)
the only problem so far: * konqueror won’t resolve smb://foobar/ to the smb://192.168.2.104 ip
this might be caused as i use the code below in my smb.conf, see [2]:
server string = foobar
netbios name = foobar
and netbios might have problems with this setup (but i doubt that, it is probably some konqueror related issue)
hope i covered all requirements:
i will make this a default setup for sure:
anyway, to see this working at least is a good thing!