View previous topic :: View next topic |
Author |
Message |
woody77 n00b
Joined: 06 Feb 2004 Posts: 69 Location: SC Mtns, CA, USA
|
Posted: Wed Feb 18, 2004 9:35 pm Post subject: |
|
|
ifplugd is used to bring interfaces up/down when they have a good link. this works great for wired interfaces, but doesn't work right for wireless, at least not right off the bat.
With my wireles interface, you don't get what qualifies as a good connection until the interface is actually up, and then that kinda defeats the purpose.
With a bit of work, however, you could probably create a set of scripts that continually scanned for networks, and brought up the interface whenever a "more preferred" network was found. This is essentially what my windows drivers use, but getting this to work under linux is a bit more "interesting". Ripping your hair out ahead of time might save you some effort...
I think that my problems stem from the fact that my card seems to need to be driven by another app to perform the scanning. Hmm. This actually wouldn't be a hard app to write in C. I just would need to learn how to write a daemon that receives signals.
Basically sit in a loop, and scan, until a network is found, and then connect. Then, when you lose the network, continue scanning again. The difficult bit would be scanning for other networks while still attached to a network (my card seems to bork at this). |
|
Back to top |
|
|
Remillard Apprentice
Joined: 07 Mar 2003 Posts: 200 Location: Irvine, CA
|
Posted: Wed Feb 18, 2004 10:54 pm Post subject: |
|
|
Okay, I think things are working alright from a kernel module aspect. I get this from dmesg.
Code: |
wlan: 0.7.3.1 BETA
ath_hal: module license 'Proprietary' taints kernel.
ath_hal: 0.9.6.11
ath_pci: 0.8.5.2 BETA
ath0: mac 5.6 phy 4.1 5ghz radio 1.7 2ghz radio 2.3
ath0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
ath0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
ath0: 802.11 address: 00:09:5b:96:44:ae
ath0: Atheros 5212: mem=0xde020000, irq=18
|
And I think that all looks fine and dandy. I do have a question about the scripts. It seems like everything is sort of munged together for /etc/conf.d/net, hardline and wireless together. Am I understanding this correctly? From a configuration standpoint, I don't see a problem, but I don't know if this is suited to a machine with both 10/100 eth and wifi.
I have a 10/100 eth0 on the machine. Currently that is eth0. Do I need to rename the wireless init.d script 'eth1' so that I don't conflict? It seems like I must, but I'm getting the eth's and the ath's mixed up potentially.
Regards,
Remillard _________________ This signature is printed with 100% post-consumer recycled electrons. |
|
Back to top |
|
|
fjorderus n00b
Joined: 07 Feb 2004 Posts: 3
|
Posted: Wed Feb 18, 2004 11:44 pm Post subject: |
|
|
Quote: | I have a 10/100 eth0 on the machine. Currently that is eth0. Do I need to rename the wireless init.d script 'eth1' so that I don't conflict? It seems like I must, but I'm getting the eth's and the ath's mixed up potentially. |
Remillard:
You should have something like net.eth0 in your /etc/init.d directory. To add interfaces, just add the stuff in /etc/conf.d/net like you did and then "ln -s net.eth0 net.eth1" in your /etc/init.d directory. That is, the script will be the same as eth0...it just looks at the runname to get the iface name.
Then if you want to add net.eth1 to the default runlevel do "rc-update add net.eth1 default"
Best,
F |
|
Back to top |
|
|
woody77 n00b
Joined: 06 Feb 2004 Posts: 69 Location: SC Mtns, CA, USA
|
Posted: Thu Feb 19, 2004 5:29 am Post subject: |
|
|
However, if you have both wireless and wired, as I do, then you have two different interfaces:
eth0 <-- wired
ath0 <-- wireless
Now, you'll want to use the gentoo-supplied init-script for eth0, and you'll want to use the script at the start of this thread for ath0. Copy the script to "/etc/init.d/net.ath0".
Then do the above command for rc-update:
Code: |
rc-update add net.ath0 default
|
This will automatically bring up the wireless adapter along with the wired adapter at startup. Use ifplugd to control the wired adapter (ie, don't bring it up if it's not connected), and then this script will control the wireless adapter. My wireless adapter doesn't seem to want to automagically scan, so that option is out for me, so I have to kind manually run the script to bring it up/down, but it's not much pain. |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Thu Feb 19, 2004 9:54 am Post subject: |
|
|
waproamd is made by the same author who wrote ifupd.
waproamd is great - however it does have a few caveats
1) It can't associate with AP's which do not broadcast their ESSID
2) It has no easy way of changing from DHCP to static IP's and/or setting new nameservers
3) If you're in range of 2 or 3 networks which you have configured, there's no way of saying which one you would prefer.
I've decided to start work on a more simple daemon. It just looks at the link quality. When it drops to zero it will restart the interface. That's all it will do.
Besides, it's a good way to brush up on my C skills. And I've never written a process on Linux before
If waproamd ever gets the above functionality then I would recommend it over my own scripts any day. |
|
Back to top |
|
|
woody77 n00b
Joined: 06 Feb 2004 Posts: 69 Location: SC Mtns, CA, USA
|
Posted: Thu Feb 19, 2004 7:07 pm Post subject: |
|
|
See, what I was thinking was something very much like what you suggest, but which executes configurable commands instead of forcibly doing anything.
Sounds like waproamd could be a good starting point.
I've got plenty of C/C++ experience, the problem is writing daemons. Something I've not done. |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Thu Feb 19, 2004 8:43 pm Post subject: |
|
|
woody77 wrote: | I've got plenty of C/C++ experience, the problem is writing daemons. Something I've not done. |
I've got little C/C++ experience and have never written a daemon before. I am, however a very competent VB and PHP developer.
Until today that is .........
I've got a working daemon that monitors links quality and then resets the interface if it drops below a configurable level. It also logs to syslog. Doesn't have any kernel interaction - just reads /proc/net/wireless.
The internet is an excellent resource |
|
Back to top |
|
|
woody77 n00b
Joined: 06 Feb 2004 Posts: 69 Location: SC Mtns, CA, USA
|
Posted: Thu Feb 19, 2004 9:28 pm Post subject: |
|
|
excellent!
Where'd you find good (or passable) instructions on writing a daemon? and traping the signals sent to shut it down/restart? |
|
Back to top |
|
|
Remillard Apprentice
Joined: 07 Mar 2003 Posts: 200 Location: Irvine, CA
|
Posted: Fri Feb 20, 2004 7:01 am Post subject: |
|
|
Okay, I'm trying to set up the /etc/conf.d/net file and having a bit of trouble mapping the things that are on the wireless router to the items in the file. The Router is the Netgear WGR614. The card is the Netgear WG311 PCI card.
The madwifi drivers emerged, compiled, and have insmodded successfully into the kernel.
So in /etc/conf.d/net I have the following bits:
Code: |
#eth0 is hardline
iface_eth0="dhcp"
#eth1 is the wireless
iface_eth1="dhcp"
wireless_essid_eth1="mySSIDfromrouter"
# fairly certain mode and scan is correct
wireless_mode_eth1="Managed"
wireless_scan_mode_eth1="Ad-Hoc"
|
Here's where I run into trouble though, with the WEP. The router is set up to do 64(48) bit encryption, and authentication type "automatic". I think the type says the router will figure it out. So anyway onto the confusion. The net file says I can define a WEP key per ESSID. On the router it has a place for 4 keys though.
So, from the net documentation I can put in one key:
Code: |
wireless_key_100acrewoods="abcdef1234"
|
And then where do the other 3 keys go? I suppose I'm not certain what all the keys are for. When this link gets set up, does the card and router have to match all 4 keys, or do they sort of slide them against each other til at least one hits a match?
I should note that I'm not too concerned about signal strength here, because the distance will be roughly 2-3 meters at most. This is done mostly so my wife doesn't have to walk over a cable on the tile floor ;-) (plus the laptop uses the wireless too).
Another question, the net config file has a line for a couple of timeouts. Is the number in minutes, or seconds? I'm kind of figuring minutes at the moment, but I'm not entirely sure.
So I think that about covers it. The machine doesn't move, and I only have the one SSID to connect to, so I don't need to define the multiple site lines, and it's a DHCP connection, so gateway and nameserver, etc should be given.
Can someone check out the bits I have done already and give me a pointer or three on how to handle the WEP keys?
Thanks.
Remillard _________________ This signature is printed with 100% post-consumer recycled electrons. |
|
Back to top |
|
|
milkypostman n00b
Joined: 10 Oct 2002 Posts: 45
|
Posted: Fri Feb 20, 2004 7:21 am Post subject: |
|
|
I am using your script and i like it except in running it i found that it was getting called from the pcmcia. Well, basically, cardmgr calls /etc/pcmcia/network (as per the /etc/pcmcia/config file) and from there it calls the /etc/pcmcia/wireless script and then calls /etc/init.d/net.eth1 (from the network script. it appears that rather than using your script you can edit /etc/pcmcia/wireless.opt and put in the ESSID and other information there.
However, i decided not to do this, i edited /etc/pcmcia/config and instead of setting the class to "network" i set it to "shared" which doesn't call any other scripts.
The pcmcia script is required for operation of the network card (loads the modules) and while i haven't tried their configuration utility i'll try it and see how it goes. Basically what it looks like it will do is set the ESSID and all he other parameters and THEN call net.eth1 (gentoo version not yours) and handle the actual interface configuration there. Going to give it a shot tommorrow. Too tired from digging through the files to see what was going on. _________________ cupid packs the pistol |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Fri Feb 20, 2004 9:46 am Post subject: |
|
|
Remillard wrote: |
So, from the net documentation I can put in one key:
Code: |
wireless_key_100acrewoods="abcdef1234"
|
And then where do the other 3 keys go? I suppose I'm not certain what all the keys are for. When this link gets set up, does the card and router have to match all 4 keys, or do they sort of slide them against each other til at least one hits a match? |
AFAIK, only one key can be active at any time. You can put other keys in there though if you want to check the iwconfig manual for how to do multiple keys on one line. Just remember that the script puts "iwconfig iface key" in front of the string.
Quote: |
Another question, the net config file has a line for a couple of timeouts. Is the number in minutes, or seconds? I'm kind of figuring minutes at the moment, but I'm not entirely sure. |
Seconds - I'll update the documentation |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Fri Feb 20, 2004 9:48 am Post subject: |
|
|
milkypostman wrote: |
The pcmcia script is required for operation of the network card (loads the modules) and while i haven't tried their configuration utility i'll try it and see how it goes. Basically what it looks like it will do is set the ESSID and all he other parameters and THEN call net.eth1 (gentoo version not yours) and handle the actual interface configuration there. Going to give it a shot tommorrow. Too tired from digging through the files to see what was going on. |
Thats basically correct.
For my lappy, I just editied wireless.opts in /etc/pcmcia and removed the defaults.
I'm more than happy when the net.ethx script is started and stopped when the card is removed |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Fri Feb 20, 2004 9:59 am Post subject: |
|
|
woody77 wrote: | excellent!
Where'd you find good (or passable) instructions on writing a daemon? and traping the signals sent to shut it down/restart? |
Trapping signals
http://www.enderunix.org/docs/eng/daemon.php
I used the daemon command instead of fork though
"man daemon" for more info. |
|
Back to top |
|
|
milkypostman n00b
Joined: 10 Oct 2002 Posts: 45
|
Posted: Fri Feb 20, 2004 6:18 pm Post subject: |
|
|
I don't know much about the script you wrote... its full of fun lines but it doesn't appear to have any place in it for leap authentication. I wouldn't mind contributing and i know the procedure to get it going. Any chance you could throw something in there to handle it? Like extra parameters based off ESSID? _________________ cupid packs the pistol |
|
Back to top |
|
|
funkmankey Guru
Joined: 06 Mar 2003 Posts: 304 Location: CH
|
Posted: Fri Feb 20, 2004 9:13 pm Post subject: |
|
|
UberLord: many thanks.
I am using a ralink 2460 based minipci card in my toshiba appliance server, and it is very picky about the order in which various ifconfig/iwconfig values are assigned. whether by luck or by design, this script works perfectly. _________________ I've got the brain, I'm insane, you can't stop the power |
|
Back to top |
|
|
giannifive n00b
Joined: 29 Jan 2004 Posts: 50 Location: Chicago, IL
|
Posted: Sat Feb 21, 2004 5:14 am Post subject: |
|
|
Thanks UberLord. This wireless setup should be a standard part of Gentoo! |
|
Back to top |
|
|
MrDooM n00b
Joined: 22 Oct 2003 Posts: 69
|
Posted: Sat Feb 21, 2004 9:15 am Post subject: |
|
|
My wirless lan works now very fine. Thank you.
I've only one problem. After some hours of running (Filesharing for example) i come back to my computer and see this:
Link Quality:0/94
My net.ath0 is offline and i have no connection.
If i do a /etc/init.d/net.ath0 restart everything is ok for the next hours.
I use the scripts from uberlord, my card is a netgear 311 pci card.
Under win xp everything works fine mor than days, so the card is not defect.
Has anyone this problems too or can anyone help me?
I use the newest CVS madwifi drivers.
Thx |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Sun Feb 22, 2004 11:08 am Post subject: |
|
|
Mr DOOM - I have the exact same problem with my 311 card as well. It has to be a madwifi-driver problem |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Sun Feb 22, 2004 11:10 am Post subject: |
|
|
milkypostman wrote: | I don't know much about the script you wrote... its full of fun lines but it doesn't appear to have any place in it for leap authentication. I wouldn't mind contributing and i know the procedure to get it going. Any chance you could throw something in there to handle it? Like extra parameters based off ESSID? |
No, there's nothing in there for leap authentication. I've never actually heard of it
How about you post up the procedure for getting it going. And does it need to be done before or after association? |
|
Back to top |
|
|
milkypostman n00b
Joined: 10 Oct 2002 Posts: 45
|
Posted: Sun Feb 22, 2004 10:05 pm Post subject: |
|
|
Procedure is as follows:
1) associate to the ESSID
2.a [optional]) run /opt/cisco/bin/bcard (this sets up saved cisco settings, i don't personally use it)
2.b) run /opt/cisco/bin/leapscript <user> <password> (yeah unfortunatly plain text)
3) run dhcpd or setup static ip settings. _________________ cupid packs the pistol |
|
Back to top |
|
|
truth n00b
Joined: 20 Jun 2002 Posts: 31
|
Posted: Sun Feb 22, 2004 10:17 pm Post subject: Wep Key not being held |
|
|
For some reason my Wep key doesnt show in iwconfig after this script runs, And therefore does not connect to the AP. However I can get the wireless NIC running if i use: iwconfig eth1 essid truth; iwconfig eth1 enc 123456789; dhcpcd eth1. When running the script i get t he following:
Code: | * Configuring wireless network for eth1...
* Connecting to "truth"
* Failed to associate with the access point truth
* Failed to configure wireless for eth1 [ !! ]
|
My /etc/conf.d/net is as follows:
Code: |
# /etc/conf.d/net:
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/conf.d/net,v 1.7 2002/11/18 19:39:22 azarah Exp $
iface_eth0="dhcp"
iface_eth1="dhcp"
#dhcpcd_eth0="..."
wireless_mode_eth1="Managed"
#wireless_config_eth1="ap any"
wireless_essid_eth1="truth"
wireless_eth1_truth="restricted 9AC0-81B5-9203-2281-B3E7-74CE-88" #key has been changed to protect the innocent.
#wireless_eth1_truth="dhcp"
|
I have also tried changing the format in which i set the wireless_eth1_truth="restricted 12345768797" i have also done wireless_eth1_truth="123456789ABCDEF" and "open 123456789ABCDEF" none have worked. Evertime i run iwconfig after /etc/init.d/net.eth1 the essid is set to truth correctly but Encryption Key is set to "off". If i use iwconfig eth1 esid truth; iwconfig eth1 key 12345467ABCDEF; dhcpcd eth1 it comes up fine. I am using 2.6.2 kernel, pcmcia is built into the kernel, the wireless pcmcia NIC is a cisco aironet 350 which is compiled as a module and is loaded in /etc/modules.autoload.d/kernel-2.6 before pcmcia is loaded. So i guess i need to understand why it says "failed to associate with the access point truth" and why it doesnt seem to set the key correctly from /etc/conf.d/net
Any suggestions? I would rather not remove WEP. _________________ truth
---------
Squirells..Natures little speed bumps. |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Sun Feb 22, 2004 11:18 pm Post subject: |
|
|
WEP and ESSID are reset to nothing by my script if it cannot associate with an AP which explains your last point.
For WEP problems, I would recommend trying to associate without WEP. When that works - and you can use the wireless correctly - then apply the WEP settings.
A common problem with WEP is a typo - but most times you can associate with an invalid WEP key. Which is why I recommend trying without WEP first. |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Sun Feb 22, 2004 11:20 pm Post subject: |
|
|
milkypostman wrote: | Procedure is as follows:
1) associate to the ESSID
2.a [optional]) run /opt/cisco/bin/bcard (this sets up saved cisco settings, i don't personally use it)
2.b) run /opt/cisco/bin/leapscript <user> <password> (yeah unfortunatly plain text)
3) run dhcpd or setup static ip settings. |
So this is a cisco specific thing? Not sure that I would want to do that, but I suppose I could launch an external script after association. |
|
Back to top |
|
|
truth n00b
Joined: 20 Jun 2002 Posts: 31
|
Posted: Mon Feb 23, 2004 4:55 am Post subject: Wep Problems continue |
|
|
As i suspected it connects fine with WEP disabled. However i would like WEP enabled, I have tried more than one key and triple checked the key to make sure it isnt a typo. Maybe my config is missing something? Guess im not particularly clear about the association process. Like i mentioned in my previous post WEP works fine when i use iwconfig to bring up the wireless NIC.
Any Suggestions anyone? _________________ truth
---------
Squirells..Natures little speed bumps. |
|
Back to top |
|
|
truth n00b
Joined: 20 Jun 2002 Posts: 31
|
Posted: Mon Feb 23, 2004 5:37 am Post subject: Problem Solved |
|
|
I went through the script and found key_iface so i changed /etc/conf.d/net to read wireless_key_<essid>="restricted 123456789ABCDEF" instead of wireless_iface_<essid>="restricted 123456789ABCDEF" and it worked. Not sure if this is correct but if it is then i misread your example conf. What would i need to do to have it scan for available AP's?
Thx for the response earlier Uber. _________________ truth
---------
Squirells..Natures little speed bumps. |
|
Back to top |
|
|
|