1. The default command line text editor in Gentoo is nano.
2. The network cards need to be activated from /etc/init.d
3. Edit the configuration file /etc/conf.d/net
4. To start,stop.restart use /etc/init.d/net.eth0 start/stop/restart
There are currently two ways to configure wireless networking in Gentoo. The first way is by using the options documented in /etc/conf.d/wireless.example to setup a full configuration, which uses iwconfig (located in the "wireless-tools" ebuild). The wireless.example file is well documented and should list everything you need to get started, including information on setting up WEP. Be sure to check this file for variable changes/additions/removals for new versions!
These wireless settings are held in /etc/conf.d/wireless - but could be held in /etc/conf.d/net as well
Here's a sample config for /etc/conf.d/wireless:
|File: /etc/conf.d/wireless snippet|
Replace YOUR-ESSID with your ESSID and mywepkey with your WEP key - if it's needed
. Some cards (or drivers) may need some time to complete the association with the access point. Add something like this, if needed:
|File: /etc/conf.d/wireless snippet|
To troubleshoot the connection, set RC_VERBOSE=yes in /etc/conf.d/rc for more wireless output.
It's possible to run completely different network settings per ESSID connected to - check the /etc/conf.d/wireless.example file for details on how to achieve this.
To connect, first create a link that corresponds to your network inteface in /etc/init.d and then start it:
|Code: in /etc/init.d|
To start the interface automatically, execute:
Of course, one can also create a script to connect to your home protected wireless wep connection, for example:
then make the wireless executable:
# chmod +x wireless
To use the script just do
Configuration using wpa_supplicant
The second way of configuring wireless, and in my opinion, the best way, is by using wpa_supplicant. To install, simply emerge wpa_supplicant. Once installed, you can edit the /etc/wpa_supplicant/wpa_supplicant.conf file by checking out the examples in /usr/share/doc/wpa_supplicant-0.4.9/wpa_supplicant.conf.example.gz. This file contains many options, and is well documented, and is a little easier to setup for multiple APs than by using /etc/conf.d/wireless. The bonus in configuring your wireless setup using wpa_supplicant is that it supports all types of encryption currently used: WEP, WPA, and even non-encrypted.
To use wpa_supplicant over iwconfig for wireless configuration, put the following in /etc/conf.d/net:
|File: /etc/conf.d/net snippet|
Note: Replace ath0 as required with wlan0, eth1 etc, and madwifi with ndiswrapper or the correct drivers for your wireless card (see wpa_supplicant --help for a list of drivers).
Note: You will need to comment out any config_ESSID settings, as they do not work in conjunction with wpa_supplicant. If not, you will receive the following hard-to-read error:
Nov 13 06:14:20 yourhost wpa_cli: interface ath0 CONNECTED
Nov 13 06:14:21 yourhost wpa_cli: executing '/etc/init.d/net.ath0 --quiet start' failed
- Q. How I can connect to several wireless networks at the same time?
- A. You can't, at least not with only one wireless card. Just as a single ethernet card cannot be on two (physical) networks at once, a wireless card can only be associated with one wireless network at once. However, with the proper configuration, a card could be configured to intelligently switch between available wireless networks dynamically. wpa_supplicant makes this an easier task than with wireless-tools, but neither is quite as simple as in Windows XP at this time.
- 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:
Link to net.lo instead of net.eth0 if you are using a current baselayout (>=1.11).
- 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
|Linux Kernel Configuration: |
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