View previous topic :: View next topic |
Author |
Message |
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Fri Jan 09, 2004 1:07 am Post subject: Wireless configuration and startup - The Gentoo way |
|
|
WIRELESS CONFIGURATION IS NOW IN PORTAGE
It's in sys-apps/baselayout-1.11.0 - which is currently package.masked
If you wish to try it out, do the following
Code: | mkdir -P /etc/portage
echo "=sys-apps/baselayout-1.11.0" >> /etc/portage/package.unmask |
If you're running x86 instead of ~x86, set baselayout to the ~x86 package
Code: | echo "=sys-apps/baselayout-1.11.0 ~x86" >> /etc/portage/package.keywords |
emerge baselayout
Code: | emerge sync
emerge -av sys-apps/baselayout
etc-update |
Ensure that version 1.11.0 or newer is going to get installed and go for it!
Otherwise, find out why it's not (hint: step 1 or 2 is wrong)
Ensure that etc-update updates /etc/conf.d/net and /etc/conf.d/net.lo - please do this
Then symlink any net.* devices to net.lo instead of net.eth0
Consult /etc/conf.d/net.example for details about how to configure networking
If you have net-wireless/wireless-config installed, remove it
Code: | emerge unmerge net-wireless/wireless-config
rm /etc/init.d/wireless.sh |
If you did not update /etc/conf.d/net in the steps above, you need to manually remove the patch to /etc/conf.d/net which loads wireless.sh and calls wireless_* in preup(), predown() and/or postdown() functions if they exist - it's now automatic
Consult /etc/conf.d/wireless.example for how to configure wireless
And you're done
PS - you need to have wireless-tools emerged for wireless to work ....
FAQ
Q. I don't have net.wlan0, net.eth1, net.ath0 or similar in /etc/init.d!
A. Read up on Gentoo networking in their handbook
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=8#doc_chap2
A2. The docs will be wrong when baselayout hits stable - you need to symlink to net.lo instead of net.eth0
Q. I'm seeing Wireless extensions not found for $interface - but it's a wireless device!
A. You need to enable wireless-extensions in your kernel.
To do this, enable the following config options in /usr/src/linux/.config Code: | CONFIG_NET_RADIO=y
CONFIG_NET_WIRELESS=y |
Then recompile your kernel and modules and re-install them
If your driver is external then re-compile and re-install that.
Finally, re-emerge wireless-tools against the new kernel and driver
Q. I get the following error or similar Code: | SIOCSIFADDR: No such device |
A. It's a kernel/driver problem. Chances are you're using ndiswrapper and it's not configured correctly.
Q/ I get the following error or similar Code: | SIOCSIFFLAGS: No such file or directory |
A. Again, it's a driver problem. This normally means that the firmware for your card has not been uploaded properly.
Q. I have an Prism based card and it appears to configure correctly but it's unreliable.
A. You may have old buggy firmware. Here's a possible fix (Thanks to hotplainrice)
Q.Are there any drivers that do not work with this?
A.The only one I know of is linux-wlan-ng. They have their own setup software which is vastly different from anyone elses. All other drivers use wireless-tools which is what my script uses. The developers of linux-wlan-ng are in the process of making their driver support wireless-tools - so eventually it should work. Bug them about this, not me.
Q. WTF am I doing wrong?
A. Please check that you have a working kernel module for your wireless card. There's a whole lotta hardware out there that I do not have, and probably will never have and I cannot help with driver/hardware issues. Please start a new thread in the forum if this is the case.
Q. OK, I got a working kernel module that's reported by iwconfig but it's still not working!
A. I need information. Specifically, the output of net.eth0 start and any uncommented lines in /etc/conf.d/wireless
Q. Will this work on the LiveCD?
A. No Gentoo LiveCD currently supports wireless - so no
However, you should be able to install Gentoo from a Knoppix CD and some of them support wireless.
Q. Is WPA supported?
A. Not at the moment, but I do have plans to support it
Q. I cannot get WEP working!
A. WEP is a fickle beast. Some drivers don't support both encryption methods, some cards/drivers won't talk to some Access Points. Remember that encryption method on the Access Point has to match the method on the client otherwise it will not work. Basically, if you can get WEP to work on the command line it will work with my script.
Q. The script claims to connect, but I cannot get a DHCP address or ping computers
A Are you using WEP? See above. Remember that this script just configures wireless for you and some settings allow you to "connect" even though they are blatently wrong. This is dependant on card, driver, AP, etc. If you've got this far, don't expect too much help from me as I'm a developer and not a network engineer.
OLD EBUILD INSTRUCTIONS
Ebuild for sys-apps/baselayout>=1.8.11 <1.11.0
net-wireless/wireless-config-0.6.2.ebuild
If you used my old net.eth0 script prior to using this ebuild, you do not need it anymore
If you've never put a custom ebuild into your local portage tree before, here's how
- edit /etc/make.conf and enable PORTDIR_OVERLAY (defaults to /usr/local/portage)
- ensure that the folder exists
Code: | mkdir -p /usr/local/portage/net-wireless/wireless-config |
add wireless-config to package.keywords if not running ~ARCH
Code: | mkdir -p /etc/portage
echo "net-wireless/wireless-config ~x86" >> /etc/portage/package.keywords |
(note - change ~x86 to match your ~arch)
You only have to do the above steps once. Repeat the below steps every time you download a custom ebuild
- put the ebuild in that folder
Code: | cd /usr/local/portage/net-wireless/wireless-config
wget http://rsm1.demon.co.uk/wireless-config-0.6.2.ebuild |
fetch and digest the source Code: | ebuild wireless-config-0.6.2.ebuild digest |
emerge it and follow the ebuilds instructions
Code: | emerge net-wireless/wireless-config |
Checkout /etc/conf.d/wireless.example for all settings and save them to /etc/conf.d/wireless
enjoy wireless networking
END
Newcomers to this thread are advised to skip to the last few pages of this thread as it's very big and starts off with stuff that is no-longer used
MOD EDIT:
13.DEC.04: Since it is "outdated" I've moved it back to Networking & Security from Documentation, Tips & Tricks. --pjp
Moved from Networking & Security.
-- Deathwing00
NOTE: Currently cannot detect if /etc/conf.d/net has been patched when >=sys-apps/baselayout-1.10 is installed
Last edited by UberLord on Thu Sep 16, 2004 5:25 pm; edited 125 times in total |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Fri Jan 09, 2004 6:11 pm Post subject: |
|
|
I know some people like em - or at least they're trying them
I've updated them.
Changes
Changed the configuration slightly.
Now, you can set channel, rate, mode, rts, frag and essid per interface instead of per essid (makes for sense I think)
Features
Warnings when you try an unsupported feature on your driver
If your card can't scan - and my lappy one won't - or you need to choose essids manually you can configure them via grub.
Append wireless_essid_ath0=UberNET to the kernel line
Of course, change ath0 and UberNET to your interface and essid
Gimmie some feedback if you love em or hate em |
|
Back to top |
|
|
preacher n00b
Joined: 09 Jan 2004 Posts: 55 Location: Göteborg, Sweden
|
Posted: Fri Jan 09, 2004 7:52 pm Post subject: |
|
|
I like it a lot, it made configuring my new wireless card much easier than I thought it would be. However, I'm just not there yet. When I try
# /etc/init.d/net.ath0 start
I get the following output:
/sbin/runscript.sh: line 20: roaming: command not found
* Bringing ath0 up...
* Failed to bring ath0 up [ !! ]
What gives?
Also, when I try to load the ath_pci module, I get an error message saying
/lib/modules/2.4.22-gentoo-r3/net/ath_pci.o: init_module: No such device
Hint: insmod errors can be caused by incorrect module parameters, including invalid IO or IRQ parameters.
You may find more information in syslog or the output from dmesg
/lib/modules/2.4.22-gentoo-r3/net/ath_pci.o: insmod /lib/modules/2.4.22-gentoo-r3/net/ath_pci.o failed
/lib/modules/2.4.22-gentoo-r3/net/ath_pci.o: insmod ath_pci failed
The madwifi-driver is the emerged one. |
|
Back to top |
|
|
preacher n00b
Joined: 09 Jan 2004 Posts: 55 Location: Göteborg, Sweden
|
Posted: Fri Jan 09, 2004 9:15 pm Post subject: |
|
|
Never mind the roaming stuff, it was me who had an extra linebreak where it shouldn't be.
However, I still cant get the ath_pci module to load, I recompiled the kernel with Wireless support built in but the problem remains. |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Fri Jan 09, 2004 9:57 pm Post subject: |
|
|
I didn't actually upload the new scripts to the correct location
They are there now
preacher, whats the problem loading the module? Is there an error? Can you post it or your dmesg output? |
|
Back to top |
|
|
preacher n00b
Joined: 09 Jan 2004 Posts: 55 Location: Göteborg, Sweden
|
Posted: Fri Jan 09, 2004 10:51 pm Post subject: |
|
|
insmod wlan and ath_hal both go fine, but when i do
I get
Code: | Using /lib/modules/2.4.22-gentoo-r3/net/ath_pci.o
/lib/modules/2.4.22-gentoo-r3/net/ath_pci.o: init_module: No such device
Hint: insmod errors can be caused by incorrect module parameters, including invalid IO or IRQ parameters.
You may find more information in syslog or the output from dmesg |
And dmesg says
Code: | wlan: 0.7.2.0 BETA
ath_hal: 0.9.6.3
ath_pci: 0.8.4.0 BETA
ath_pci: No devices found, driver not installed. |
I've tried a lot now, I made sure wlan was compiled into the kernel, and after reboot I have reemerged both wireless-tools and madwifi-driver.
I've tried switching PCI-slot for my network-card, which is DLink G520+, but still the error remains.[/code] |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
|
Back to top |
|
|
preacher n00b
Joined: 09 Jan 2004 Posts: 55 Location: Göteborg, Sweden
|
Posted: Sat Jan 10, 2004 2:56 am Post subject: |
|
|
Thanks for your reply, however, that is sadly not the case.
Because of D-Links retarded naming-scheme these devices are very easy to mix up.
After a lot of searching I found out this. The DWL-G520+ is based on a chip from Texas Instruments, for which no driver exists. That's right, nada, zip. Also note that this card is different from the DWL-G520 (without +).
And I bought two, and when one didn't work I opened the other one. Which means that here I am with two useless cards and I can't even return one of them. Woe me.
I tried the wrapper from linuxant, but I got unresolved symbols when loading the module.
I'm sure your scripts are great, but atleast I wont have any use of them in the near (far?) future |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Sat Jan 10, 2004 3:05 am Post subject: |
|
|
preacher wrote: |
After a lot of searching I found out this. The DWL-G520+ is based on a chip from Texas Instruments, for which no driver exists. That's right, nada, zip. Also note that this card is different from the DWL-G520 (without +). |
The acx100 driver is made by Texas Instruments.
Have you even tried it? |
|
Back to top |
|
|
zfc-tinkerer Tux's lil' helper
Joined: 05 May 2003 Posts: 126
|
Posted: Sat Jan 10, 2004 3:37 am Post subject: |
|
|
if you have a card which is truly not supported by any linux drivers, you might try ndis-wrapper (available on sourceforge.net) which will allow you to use windows drivers for that card. Just don't do the dumb thing I did and forget to get the most recent version of the windows drivers. I'm not crazy about using non-native drivers like this, but I already have the card, so it's not like I bought a card planning on using the windows drivers and a wrapper.
ndis-wrapper is free, unlike the linuxant wrapper, and at least for me it seems to run better and be simpler to set up. if only some brave and wonderful person would make an ebuild for it |
|
Back to top |
|
|
preacher n00b
Joined: 09 Jan 2004 Posts: 55 Location: Göteborg, Sweden
|
Posted: Sat Jan 10, 2004 3:40 am Post subject: |
|
|
Yes I know, but this is another chipset not compatible with acx100.
I haven't tried it since it specifically states that it won't work with the G520+.
However, I actually got driverloader from linuxant working!
Now I am able to run your script, but the output is:
Code: | corinthian init.d # ./net.eth1 restart
* Bringing eth1 down...
* Configuring wireless network for eth1...
* Scanning for Access Points
* Found peters
* Connecting to peters
/sbin/runscript.sh: line 46: [: =: unary operator expected
* Bringing eth1 up... |
The output from ifconfig looks like this:
Code: | eth1 Link encap:Ethernet HWaddr 00:80:C8:2D:1E:1D
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:4 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) |
and iwconfig:
Code: | eth1 IEEE 802.11-DS ESSID:"peters" Nickname:"unknown"
Mode:Managed Frequency:2.437GHz Bit Rate=54Mb/s Tx-Power=0 dBm
RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
Link Quality:1/1 Signal level:-52 dBm Noise level:-200 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0 |
As you see I don't get an ipadress for some reason...
Btw, I'm temporarly running without encryption just to test things out.
Any ideas? |
|
Back to top |
|
|
bruor Apprentice
Joined: 08 Jul 2003 Posts: 239
|
Posted: Sat Jan 10, 2004 5:54 am Post subject: |
|
|
ive just tried your scripts out and while they look promising i have some questions.
theres a link that says its supposed to be /etc/init.d/net.ath0 but when i try to start it it says it doesnt exist in /etc/conf.d/net... so i renamed the iface_eth1 to iface_ath0. is this the right thing to do?
after trying that it tries to bring up ath0 but it doesnt seem to work.
im using a linksys wpc55ag with the madwifi driver.
any help you can give would be greatly appreciated |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Sat Jan 10, 2004 11:28 am Post subject: |
|
|
bruor wrote: | ive just tried your scripts out and while they look promising i have some questions.
theres a link that says its supposed to be /etc/init.d/net.ath0 but when i try to start it it says it doesnt exist in /etc/conf.d/net... so i renamed the iface_eth1 to iface_ath0. is this the right thing to do? |
Yeah thats right.
Kinda silly really. I made the net script on my lappy and forgot to change the interface back to ath0 for my workstation :/
I've changed mt net script to reflect this
Quote: |
after trying that it tries to bring up ath0 but it doesnt seem to work.
im using a linksys wpc55ag with the madwifi driver.
any help you can give would be greatly appreciated |
If you're not getting a DHCP address then try doing this
Sometimes the dhcp daemon doesn't fire as the script thinks the link is already "up". I'll look into this some more if this is the case |
|
Back to top |
|
|
bruor Apprentice
Joined: 08 Jul 2003 Posts: 239
|
Posted: Sat Jan 10, 2004 6:44 pm Post subject: |
|
|
ok i did what you said and, at the accesspoint at work, all went well.
i had to disable the encryption though...
when i run commands like
Code: | iwconfig ath0 essid essidname
|
i get this out
Code: | Error for wireless request "Set ESSID" (8B1A):
SET failed on device ath0 ; Invalid argument.
|
id like to get it going with encryption but i if i try to set the key i also get the same output. am i doing something wrong?
thanks for your help |
|
Back to top |
|
|
ryandlugosz n00b
Joined: 15 Jan 2003 Posts: 26 Location: Cincinnati, OH
|
Posted: Sat Jan 10, 2004 7:57 pm Post subject: Tweaks for ndiswrapper |
|
|
I've tweaked the original script a bit... I use ndiswrapper (0.4) to make my TrueMobile 1300 (Broadcom) wifi work. I found that I always had to start net.wlan0 (what I had renamed the script to) *twice* before it would successfully connect.
I've attributed this to the fact that before the kernel module is loaded, the iwconfig command does not have an entry for the interface that you're looking for. Because of this, the setup_ or associate_ wireless commands are skipped over and then the ifconfig $IFACE stuff happens. This (of course) causes the kernel module to get loaded, but the iwconfig commands (scanning for the essid, key setup, etc) won't have happened (causing dhcpcd to fail). The second time you run the net.wlan0 start command, iwconfig will have the interface listed since the kernel module have been loaded. Now the setup_ and associate_ wireless methods will execute and the wireless stuff will work correctly.
My solution was to check to see if the ndiswrapper module has been loaded inside the setup_env method, just before we check to see if the wireless interface is listed in iwconfig. Doing this makes the script work correctly on the first try. I have not tested to see what happens when the network is unavailable... hopefully it will time out on it's own.
Also, I added a line in stop that will remove the ndiswrapper kernel module after stopping all of the interfaces. Note that before version 0.4 of ndiswrapper an rmmod like this would cause an oops and you're DOA.
Please respond if you can make any improvements / genericise this a bit.
My new version of the script
-Ryan |
|
Back to top |
|
|
amphibious Apprentice
Joined: 25 Sep 2003 Posts: 174 Location: boston, massachusetts, usa
|
Posted: Sat Jan 10, 2004 8:18 pm Post subject: |
|
|
bruor wrote: |
when i run commands like
Code: | iwconfig ath0 essid essidname
|
i get this out
Code: | Error for wireless request "Set ESSID" (8B1A):
SET failed on device ath0 ; Invalid argument.
|
|
This is the EXACT error I'm getting... I just offered $10 to the first person that can fix it in this post. _________________ http://amphibio.us |
|
Back to top |
|
|
amphibious Apprentice
Joined: 25 Sep 2003 Posts: 174 Location: boston, massachusetts, usa
|
Posted: Sat Jan 10, 2004 8:20 pm Post subject: Re: Tweaks for ndiswrapper |
|
|
ryandlugosz wrote: |
Also, I added a line in stop that will remove the ndiswrapper kernel module after stopping all of the interfaces. Note that before version 0.4 of ndiswrapper an rmmod like this would cause an oops and you're DOA.
Please respond if you can make any improvements / genericise this a bit.
|
Can you post the exact command lines you use to get everything working? _________________ http://amphibio.us |
|
Back to top |
|
|
ryandlugosz n00b
Joined: 15 Jan 2003 Posts: 26 Location: Cincinnati, OH
|
Posted: Sat Jan 10, 2004 8:30 pm Post subject: Re: Tweaks for ndiswrapper |
|
|
amphibious wrote: |
Can you post the exact command lines you use to get everything working? |
First, download the latest version of ndiswrapper (0.4). Install it by running ./install.sh as root. During the install, give it the correct paths to the windows driver files.
IMPORTANT: When it asks you where to write the module config, write it to:
/etc/modules.d/ndiswrapper
DO NOT write it to modules.conf, because that will get overwritten eventually. Now, as root run modules-update
Restart. Now, put my net.wlan0 into your /etc/init.d and add the config lines from the /etc/conf.d/net file that is linked in the beginning of this thread. Be sure to set the right values for your key that correspond to your essid. The truemobile 1300 can scan, so you don't need to set an explicit essid.
run /etc/init.d/net.wlan0 start
as root & let me know what happens.
You can paypal ryan@dlugosz.net (just kidding, it's not really necessary)
-Ryan |
|
Back to top |
|
|
amphibious Apprentice
Joined: 25 Sep 2003 Posts: 174 Location: boston, massachusetts, usa
|
Posted: Sat Jan 10, 2004 9:42 pm Post subject: Re: Tweaks for ndiswrapper |
|
|
ryandlugosz wrote: |
Restart. Now, put my net.wlan0 into your /etc/init.d and add the config lines from the /etc/conf.d/net file that is linked in the beginning of this thread. Be sure to set the right values for your key that correspond to your essid. The truemobile 1300 can scan, so you don't need to set an explicit essid.
run /etc/init.d/net.wlan0 start
as root & let me know what happens. |
Ok... well... it gives a pretty generic error:
Code: | * Bringing wlan0 up... [ !! ]
* Failed to bring wlan0 up |
I added these lines to /etc/conf.d/net:
Code: | iface_wlan0="dhcp"
dhcpcd_wlan0="-h memory -D"
wireless_essid_wlan0="memory"
wireless_channel_wlan0="13"
wireless_mode_wlan0="auto"
wireless_rate_wlan0="auto"
wireless_rts_wlan0="off"
wireless_frag_wlan0="iff"
wireless_key_memory="dbb6d2a42d" |
I'm not sure if I've entered the syntax of the key right... it's a 64bit WEP key, the iwconfig manpage is a little ambiguous as to how to enter different kinds of keys.
I'm serious about the money too... _________________ http://amphibio.us |
|
Back to top |
|
|
ryandlugosz n00b
Joined: 15 Jan 2003 Posts: 26 Location: Cincinnati, OH
|
Posted: Sun Jan 11, 2004 3:09 am Post subject: Re: Tweaks for ndiswrapper |
|
|
amphibious wrote: |
wireless_key_memory="dbb6d2a42d"[/code]
I'm not sure if I've entered the syntax of the key right... it's a 64bit WEP key, the iwconfig manpage is a little ambiguous as to how to enter different kinds of keys.
|
Could you try putting your key in this format:
wireless_key_memory="restricted DBB6-D2A4-2D"
Then (if you're using my version of net.wlan0) do a /et/cinit.d/net.wlan0 stop and then a /etc/init.d/net.wlan0 start as root. What happens?
-Ryan |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Sun Jan 11, 2004 1:07 pm Post subject: |
|
|
To load the kernel modules automatically, simply add them to /etc/modules.autoload.d/kernel-<version>
That way they should get loaded at boot, which means the you don't need to change the script.
This is the Gentoo recommended way (according to their docs) to configure networking |
|
Back to top |
|
|
ryandlugosz n00b
Joined: 15 Jan 2003 Posts: 26 Location: Cincinnati, OH
|
Posted: Sun Jan 11, 2004 1:37 pm Post subject: |
|
|
UberLord wrote: |
That way they should get loaded at boot, which means the you don't need to change the script. |
Hm... I must have missed that in the docs. Wish I had known about it before changing the script!
Meh - on the bright side, I probably save 59k or so of memory by removing the driver!
-ryan |
|
Back to top |
|
|
ryandlugosz n00b
Joined: 15 Jan 2003 Posts: 26 Location: Cincinnati, OH
|
Posted: Sun Jan 11, 2004 4:56 pm Post subject: Wireless not available |
|
|
Anyone have any thoughts on how to modify the script so that it will eventually timeout when connecting to the wireless? I've been using this as a startup script and if the wireless isn't available it'll sit there for a long time (forever, I think).
Any thoughts on this? Is there a way that I can set it up so that if I pass an argument at boot time the network won't start?
Thanks,
Ryan |
|
Back to top |
|
|
UberLord Retired Dev
Joined: 18 Sep 2003 Posts: 6835 Location: Blighty
|
Posted: Sun Jan 11, 2004 5:52 pm Post subject: Re: Wireless not available |
|
|
ryandlugosz wrote: | Anyone have any thoughts on how to modify the script so that it will eventually timeout when connecting to the wireless? I've been using this as a startup script and if the wireless isn't available it'll sit there for a long time (forever, I think).
Any thoughts on this? Is there a way that I can set it up so that if I pass an argument at boot time the network won't start?
Thanks,
Ryan |
I'll put a timeout in there tomorrow.
The only place it needs to timeout is when trying to associate with an access point. |
|
Back to top |
|
|
jshaw523 n00b
Joined: 29 Dec 2003 Posts: 12 Location: Columbus, OH
|
Posted: Sun Jan 11, 2004 6:44 pm Post subject: |
|
|
I just wanted to reply and say I love the script, much much better then the one I first put together. I think I am going to modify it slightly so it'll post a specific error message when the network card doesn't support scanning, but other then that it works great. |
|
Back to top |
|
|
|