When I boot with the network cable plugged in, but then try to unplug it and
up my wireless, it doesn't seem to work although the ifconfig shows I am
joined to my wireless network. Is there some magic I need to do to reset the
routing tables or something?
-j
-j
It make it really hard to follow a thread.
> Why not?
> > Please don't top post.
Depends on your configuration. Do you use DHCP or static network
configurations? If it is DHCP, I suspect /etc/rc.d/dhclient restart
would do the trick. If it is status:
route add default abc.def.gh.ij
should do the trick.
Going the other way can be a tiny bit more involved. 'ifconfig wlan0
down' first or 'route delete default' to get rid of the current
static. (Note: wlan0 on stable needs to be replaced with the name of
your wireless interface.)
--
R. Kevin Oberman, Network Engineer
Energy Sciences Network (ESnet)
Ernest O. Lawrence Berkeley National Laboratory (Berkeley Lab)
E-mail: obe...@es.net Phone: +1 510 486-8634
Key fingerprint:059B 2DDF 031C 9BA3 14A4 EADA 927D EBB3 987B 3751
>Depends on your configuration. Do you use DHCP or static network
>configurations? If it is DHCP, I suspect /etc/rc.d/dhclient restart
>would do the trick. If it is status:
>route add default abc.def.gh.ij
>should do the trick.
>Going the other way can be a tiny bit more involved. 'ifconfig wlan0
>down' first or 'route delete default' to get rid of the current
>static. (Note: wlan0 on stable needs to be replaced with the name of
>your wireless interface.)
I've been playing around with this sort of setup, too, where I
want a command line to change from wired to wireless (at the
same IP address, even) and back again. I haven't found the
magic solution, particularly one that doesn't have a lot of
hardcoded network config in it. I'm also somewhat ticked that
"route flush" doesn't really flush all routes like the man page
says. 8-) Eventually, I usually arrive at a point where I can't
find my way back and have to reboot to get some work done.
Some things I've been using are "route delete <my ip address>"
and "route add -ifp <interface> default". Might be a good idea
to "arp -a -d", too.
--
J. Porter Clark <j...@porterclark.com>
Sam
kldload if_lagg
ifconfig lagg0 create
ifconfig lagg0 lagproto failover lagport bfe0 lagport wpi0 192.168.1.1
netmask 255.255.255.0
Now when I ping 192.168.1.1, I get a "device busy" messages from ping.
Oops. I think I need to reboot to clear this up.
-j
> _______________________________________________
> freebsd...@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-mobile
> To unsubscribe, send any mail to "freebsd-mobil...@freebsd.org"
>
I believe LINK_UP should be sufficient but we need to check.
Sam
OK. Here is the script I use to switch between the wired and wireless at
work. I use it often, so I know it works with 7.1-Stable of early
February. It switches between wired (bge0) and wireless (ath0). All
addressing is static on bge0 and DHCP on ath0, though this really does
not matter if your rc.conf is correct for both interfaces.
By using the rc.d scripts, I take care of a lot of annoying details
because they already DTRT.
#!/usr/bin/perl
use strict;
my ($data);
# Get the current default route interface
($data) = `netstat -rnf inet | grep default`;
if (grep /bge0/, $data) {
# Move to wireless (ath0)
# make sure that the wireless driver is loaded!
$data = `kldstat | grep if_ath.ko`;
if ($?) {`kldload if_ath`;}
# Move to wireless (ath0)
($data) = `/etc/rc.d/routing stop`;
print $data;
($data) = `/etc/rc.d/netif stop bge0`;
print $data;
($data) = `/etc/rc.d/netif start ath0`;
print $data;
print "Connected via wireless\n";
} else {
# Move to .1 wire (bge0)
($data) = `/etc/rc.d/netif stop ath0`;
print $data;
($data) = `route delete default`;
print $data;
($data) = `/etc/rc.d/netif start bge0`;
print $data;
($data) = `/etc/rc.d/routing start`;
print $data;
print STDERR "Connected via ESnet on bge0\n";
FreeBSD-STABLE (says 7.2-PRERELEASE at the moment).
I haven't tried lagg(4), because I didn't know it existed, but I
will look into it--it sounds like just what I need, if it works!
In fact, I am only doing WEP on this network. The laptop that
I'm using is an employer-issued Dell Latitude E6500, which has
the dreaded Intel 5100AGN among its faults. To get wireless
working, I'm ignoring that and using an old Agere Orinoco Gold
card (wi), which AFAIK doesn't know how to do WPA--I could be
wrong. The reason I'm having to switch between it and the wired
interface is that I can get no better than about 3 Mbps through
the wireless card, and I actually have 10 Mbps downlink service
here. So I do wired when I need performance and wireless when I
need mobility, at least until support for the 5100 arrives.
> J. Porter Clark wrote:
>> I've been playing around with this sort of setup, too, where I
>> want a command line to change from wired to wireless (at the
>> same IP address, even) and back again. I haven't found the
>> magic solution, particularly one that doesn't have a lot of
>> hardcoded network config in it. I'm also somewhat ticked that
>> "route flush" doesn't really flush all routes like the man page
>> says. 8-) Eventually, I usually arrive at a point where I can't
>> find my way back and have to reboot to get some work done.
>>
>> Some things I've been using are "route delete <my ip address>"
>> and "route add -ifp <interface> default". Might be a good idea
>> to "arp -a -d", too.
>>
>>
> If this is 7.x or later, have you tried using lagg(4) to do automatic
> failover? The man page says wpa doesn't work but after talking to Andrew we
> think that's no longer true. I haven't had a chance to try it myself.
Yeah, but as far as I can recall, lagg isn't able to change the
MAC address on the cloned wlanX interface. lagg with wireless
and wired interfaces used to work before wlan cloning was added.
I haven't tested it in a while, though. Has this been fixed?
--
DE
Sam
This is becuase lagg(4) will set the interface down/up when grabbing it
and wpa_supplicant does not get restarted. This may work now but looking
through /etc/devd.conf I dont see a rule to handle it (only ATTACH and
LINK_UP events). A new devd event may need to be added to handle this
situation. Patches welcome.
Andrew
> No, there's no PR as far as I can tell. I'll try and set up a
> test system to duplicate it again, so I have proper information
> for a PR.
>
> I seem to recall that if wlanX is your primary/first lagg
> interface, then it uses the MAC address from the underlying
> interface as lagg's MAC address. In this case it works,
> but that's not the usual case 'cause you'd rather use a
> faster wired interface first if it exists.
>
> So this works:
>
> ifconfig lagg0 laggproto failover laggport wlan0 laggport bge0
>
> but this doesn't:
>
> ifconfig lagg0 laggproto failover laggport bge0 laggport wlan0
>
> In the latter case, lagg only works when bge0 is up.
Also note that lagg(4) still references ath0 in its example instead
of wlan0.
# ifconfig em0 up
# ifconfig ath0 nwid my_net up
# ifconfig lagg0 laggproto failover laggport em0 laggport ath0 \
192.168.1.1 netmask 255.255.255.0
--
DE
Right, that's what I meant above - the MAC gets set on wlan0,
but not on ath0, for instance.
> if you force it after, and I'm not sure you can make it work). I'm starting
> to remember now about this. Was there a PR filed? I completely forgot about
> this issue and it's likely to happen again w/o one.
No, there's no PR as far as I can tell. I'll try and set up a
test system to duplicate it again, so I have proper information
for a PR.
I seem to recall that if wlanX is your primary/first lagg
interface, then it uses the MAC address from the underlying
interface as lagg's MAC address. In this case it works,
but that's not the usual case 'cause you'd rather use a
faster wired interface first if it exists.
So this works:
ifconfig lagg0 laggproto failover laggport wlan0 laggport bge0
but this doesn't:
ifconfig lagg0 laggproto failover laggport bge0 laggport wlan0
In the latter case, lagg only works when bge0 is up.
--
DE
I'm fixing various issues in handling the mac address (in head). I can
now use lagg w/o wpa so long as you force the mac address manually. If
there had been a PR this problem would not have been lost.
Sam
I am sorry :( I do remember trying to figure out how to do this
myself and did have an outstanding email with you and/or Andrew that
went unanswered. I got side-tracked on something else after that
and never got back to it.
--
DE
Probably me, sorry about that.
Andrew
r190526 makes it possible to do the wired/wireless failover in HEAD.
The only caveat is you must manually set the mac address of the wireless
device to match the wired device because lagg's automatic setting of the
wlanX ifnet doesn't propagate to the underlying device (the way
if_setlladdr works makes it difficult). In the mean time you can do:
ifconfig ath0 ether 00:11:22:33:44:55
where the mac address is whatever your wired nic's address is and then
setup lagg0 using the wlan; e.g.
ifconfig ath0 ether 00:11:22:33:44:55
ifconfig wlan create wlandev ath0 ssid my_net up
ifconfig lagg create laggproto failover laggport em0 laggport wlan0 ...
I also verified it works with WPA. In fact I tested this on a thinkpad
in a docking station and it did the right thing just un-docking and
re-docking. My only complaint is my ping running during all this lost
one packet in the transition; not sure where.
Sam
Great! Does this also work for hostap mode now? I'd like to unify my internal
network, currently using rum as hostap.
If the answer is no, I pledge to file a PR. ;)
I don't understand what you're looking for but it's unlikely this will
do what you want. lagg's failover protocol acts like a single-position
switch funneling packets to one of several devices (all of which are
assigned the same mac address).
Sam
> > Great! Does this also work for hostap mode now? I'd like to unify my
> > internal network, currently using rum as hostap.
> > If the answer is no, I pledge to file a PR. ;)
>
> I don't understand what you're looking for but it's unlikely this will
> do what you want. lagg's failover protocol acts like a single-position
> switch funneling packets to one of several devices (all of which are
> assigned the same mac address).
What I'd like is my wireless and wired network to be on the same /24 and my
hostap/gateway to nat between lagg0 and tun0. As you've now described lagg,
this doesn't seem viable and I'll have to look for a different solution.
The reason I want it, is that it greatly simplifies my rdr rules and I can
seemlessly plug in/out my laptop without having to change default route or
getting arp errors if I use lagg on it.
Wireless routers (at least my retired Linksys) seem to be able to handle a
unified wired/wireless network just fine, is there anything comparable in
FreeBSD?
--
Mel
It sounds like you just want wired+wireless bridged with single dhcp
server. So long as your machines aren't simultaneously connected to
both it should not be an issue. NAT is irrelevant unless you want to
connect the outside world and want only 1 IP address to be exposed.
Sam
So I can't have this:
lagg0 via wpi <-> lagg0 via rum-hostap
/ \
+-----------+ +--------------+
+ laptop + 192.168.1.0/24 + gateway +-- tun0-inet
+-----------+ +--------------+
192.168.1.2 \ / 192.168.1.1
lagg0 via em0 <-> lagg0 via fxp0
And have both connected/disconnected at will.
--
Mel
I just verfied this now works for me in -current. As you said,
the only work-around needed is that one must set the mac address
on the wireless device(s) to match the master laggport.
--
DE
Hallo,
I've tried to figure out how to make this persistant via rc.conf and I'm
running into a dependency issue -- lagg is created before wlan:
This is in my rc.conf:
ifconfig_sk0="up"
ifconfig_iwi0="ether 00:11:22:33:44:55" # match wired (sk0)
wlans_iwi0="wlan0"
ifconfig_wlan0="wpa"
cloned_interfaces="lagg0"
ifconfig_lagg0="laggproto failover laggport sk0 laggport wlan0 dhcp"
And this is the result of /etc/rc.d/netif restart :
Stopping Network: lo0 sk0 fwe0 fwip0 iwi0 wlan0.
[...]
ifconfig: interface wlan0 does not exist
Starting wpa_supplicant.
ifconfig: SIOCSLAGGPORT: Device busy
Starting Network: lo0 sk0 iwi0 lagg0.
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=3<RXCSUM,TXCSUM>
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x5
inet6 ::1 prefixlen 128
inet 127.0.0.1 netmask 0xff000000
sk0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=b<RXCSUM,TXCSUM,VLAN_MTU>
ether 00:11:22:33:44:55
media: Ethernet autoselect (none)
status: no carrier
iwi0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 2290
ether 00:11:22:33:44:55
media: IEEE 802.11 Wireless Ethernet autoselect mode 11g
status: associated
lagg0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=b<RXCSUM,TXCSUM,VLAN_MTU>
ether 00:11:22:33:44:55
media: Ethernet autoselect
status: no carrier
laggproto failover
laggport: sk0 flags=1<MASTER>
Please note that wlan0 is not part of lagg0 (!)
If I create it from command line it works as described in previous email.
It looks to me that wlan0 is not created fast enough and thus not added
to lagg0. :-/
Any suggestions how to solve this please ?
Thanks!
Martin
PS: This is on 8.0-R.
Use an explicit 'network_interfaces' value in rc.conf that puts lagg0 last.
--
John Baldwin
Hallo,
Thanks for the hint. However it behaves very strangely..
This is what I added to my rc.conf (above):
network_interfaces="lo0 sk0 iwi0 wlan0 lagg0"
After /etc/rc.d/netif restart I see various funny things:
1)
wpa_supplicant not running? (check /var/run/wpa_supplicant/wlan0.pid).
even though it seems to be running (checked before):
$ cat /var/run/wpa_supplicant/wlan0.pid
10349
$ PS wpa
root 10349 1 10349 10349 0 Ss ?? 0:00.00
/usr/sbin/wpa_supplicant -s -B -i wlan0 -c /etc/wpa_supplicant.conf -D
2)
ifconfig: interface wlan0 does not exist
even though as checked before:
$ ifconfig wlan0
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
ether 00:11:22:33:44:55
media: IEEE 802.11 Wireless Ethernet autoselect mode 11g
status: associated
ssid gamato channel 1 (2412 Mhz 11g) bssid 00:01:02:03:04:05
country US authmode WPA2/802.11i privacy ON deftxkey UNDEF
AES-CCM 2:128-bit txpower 0 bmiss 24 scanvalid 60 protmode CTS wme
roaming MANUAL
3)
lagg0 listed twice (!):
Stopping Network: lo0 sk0 iwi0 wlan0 lagg0 lagg0.
[...]
Starting wpa_supplicant.
ifconfig: SIOCSLAGGPORT: Device busy
ifconfig: SIOCSLAGGPORT: Device busy
Starting Network: lo0 sk0 iwi0 wlan0 lagg0 lagg0.
[...]
lagg0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
[...]
lagg0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
4)
Right now, as if it was not enough, something new is happening:
Starting wpa_supplicant.
ioctl[SIOCS80211, op 26, arg 0x0]: Operation not supported
ELOOP: remaining socket: sock=5 eloop_data=0x28407140
user_data=0x2840e040 handler=0x8069f40
/etc/rc.d/wpa_supplicant: WARNING: failed to start wpa_supplicant
ifconfig: SIOCSLAGGPORT: Device busy
ifconfig: SIOCSLAGGPORT: Device busy
and in /var/log/messages:
Dec 31 11:40:10 mb-aw1n-bsd kernel: iwi0: timeout processing command
blocks for iwi_bss firmware
Dec 31 11:40:10 mb-aw1n-bsd kernel: iwi0: could not load boot firmware
iwi_bss
Dec 31 11:40:10 mb-aw1n-bsd kernel: iwi0: timeout waiting for master
[...]
Dec 31 11:40:10 mb-aw1n-bsd wpa_supplicant[12833]: ctrl_iface exists and
seems to be in use - cannot override it
Dec 31 11:40:10 mb-aw1n-bsd wpa_supplicant[12833]: Delete
'/var/run/wpa_supplicant/wlan0' manually if it is not used anymore
Dec 31 11:40:10 mb-aw1n-bsd wpa_supplicant[12833]: Failed to initialize
control interface '/var/run/wpa_supplicant'. You may have another
wpa_supplicant process already ru
Dec 31 11:40:10 mb-aw1n-bsd wpa_supplicant[12833]: Failed to disable WPA
in the driver.
Dec 31 11:40:10 mb-aw1n-bsd root: /etc/rc.d/wpa_supplicant: WARNING:
failed to start wpa_supplicant
while there is nothing to delete:
$ ll /var/run/wp*
ls: /var/run/wp*: No such file or directory
Something seems to be broken. :-/
With regards,
Martin