NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ifwatchd - howto choose cable/wifi



On Sun, Jul 01, 2012 at 08:39:26PM +0200, herbert langhans wrote:
> On Sun, Jul 01, 2012 at 08:22:38PM +0200, Daniel Horecki wrote:
> > herbert langhans <w3%langhans.com.pl@localhost> writes:
> > 
> > >> > Ethernet cable fxp0:
> > >> > Wifi card ipw0:
> > >> >
> > >> > DHCP enabled, no need for WPA (router is using MAC to filter).
> > >> >
> > >> > I would like my laptop to choose either the Ethernet connection if the
> > >> > cable is pluged in. Or, if the cable is not connected, to start the
> > >> > Wifi. Both use DHCP. Just for booting.
> > >> >
> > >> > So far I have my /etc/rc.d like this:
> > >> > dhclient=YES
> > >> > dhclient_flags="fxp0"
> > >> > dhclient_flags="ipw0"
> > >> > ifwatchd=yes
> > >> >
> > >> > But it always starts up the Wifi ipw0. I have to set some flags or
> > >> > create some scripts, right?
> > >> >
> > >> > Is anybody out there, who has already done this? I googled for 
> > >> > examples,
> > >> > but not very successful. I know I am doing something wrong, but don't
> > >> > get the idea of ifwatchd ...
> > >> >
> > >> > Thank you!
> > >> 
> > >> Something like this: 
> > >> http://www.feyrer.de/NetBSD/bx/blosxom.cgi/nb_20070816_1133.html
> > >> Regards
> > >> Daniel Horecki
> > >
> > > Yes and no. I have found it before, but it is with all the WPA-things
> > > in. I have just an open Wifi with DHCP - there might be a simple
> > > solution, but I dont get it how to plug the things together ...
> > > Cheers
> > > herb langhans
> > >
> > 
> > wpa_supplicant could be used to connect to wifi network with WPA, WEP or no 
> > encryption.
> > But you can replace wpa_supplicant startup with ifconfig commands in 
> > scripts. 
> > 
> > Regards,
> > 
> 
> Aha - this 'ifwatchd_flags="-c somescript.sh -n otherscript.sh' what is in 
> rc.d decides,
> what connection is active and passes the further configuration things to
> the script. In the script I will use ifconfig ipw0, for example.
> 
> dhclient=YES from rc.d will stay like that? And it applies for either
> interface what ifwatchd dedects? Is this the correct logics?
> 
> Thanks!
> herb langhans
> 

It could stay, but if you want to run dhclient from scripts, you can
remove it. I don't know how dhclient will react, if interface will be
changed.

Regards,

-- 
Daniel Horecki
http://morr.pl http://linux.pl http://netbsd.pl http://netbsd.org
HAIL ERIS!
BOFH since 1999.


Home | Main Index | Thread Index | Old Index