Wifi & Networking Configuration: Difference between revisions

From Elvanör's Technical Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 83: Line 83:
to get a list of available networks. If no results appear, then it's best to reboot your machine.
to get a list of available networks. If no results appear, then it's best to reboot your machine.


== ipw3945 specific notes ==
== ipw3945 specific notes (pre-iwlwifi) ==


* These notes are obsolete now that the recommended driver to use for this card is iwlwifi.
* Be careful to add the daemon init script to the '''boot''' runlevel, not the default one. Else things won't work automatically after boot.
* Be careful to add the daemon init script to the '''boot''' runlevel, not the default one. Else things won't work automatically after boot.
* Include ipw3945 in the list of modules to be autoloaded. However by default it will start the daemon as soon as it is loaded, and this does not work well on Gentoo (maybe because it should wait a little?). So modify the file /etc/modules.d/ipw3945d so that installing the module does not load the init script automatically. Then run (of course) update-modules. This way you can have a clean boot sequence without errors :)
* Include ipw3945 in the list of modules to be autoloaded. However by default it will start the daemon as soon as it is loaded, and this does not work well on Gentoo (maybe because it should wait a little?). So modify the file /etc/modules.d/ipw3945d so that installing the module does not load the init script automatically. Then run (of course) update-modules. This way you can have a clean boot sequence without errors :)



Revision as of 11:00, 10 January 2009

DNS, Hosts

  • If you want to be able to type ssh valinor, and have the system automatically search for valinor.elvanor.net by default, you can add the following line to /etc/resolv.conf
search elvanor.net
  • If you use DHCP, resolv.conf will be wiped, so you must edit the file /etc/dhcp/dhclient.conf and add:

supersede domain-name "elvanor.net";

Note that you could also configure the DHCP server so that it gives this information to the clients.

Wifi

Setting up Wifi under Gentoo involves several steps.

Get your driver working

  • This depends on your wireless card. Usually it will require very recent releases of the Linux kernel, and additional drivers or programs.
  • Be sure to select the following stuff:
    • Device drivers -> Network devices -> Wireless LAN
    • Generic IEEE 802.11 Networking Stack
    • Associated cryptographic support within the networking stack (WARNING: this may be available ONLY after you said "yes" to Wireless LAN)
  • Once you have an interface working (eg iwconfig lists something) you can proceed to the next step.

Intel Wireless cards

  • The drivers are now present in the vanilla kernel. You just need to install the microcode which is present in Portage (for example iwl3945-ucode).

Associating with an access point and Authentication

  • Emerge wpa_supplicant.
  • The configuration file used by wpa_supplicant under Gentoo is in /etc/wpa_supplicant/wpa_supplicant.conf. So edit your changes there. Sample below:
network={
        ssid="Arda"
        scan_ssid=1
        proto=WPA
        pairwise=CCMP TKIP
        psk="password_goes_here_56831"
        priority=2
}
  • The pairwise option specifies the cryptographic algorithms used for authentication. CCMP also means AES.
  • To basically test if authentication is working, launch wpa_supplicant with the -c and -i flags, supplying both a configuration file and an interface name. Example:
wpa_supplicant -ieth1 -c/etc/wpa_supplicant/wpa_supplicant.conf

Note that if you forget the -i or -c flag, wpa_supplicant will refuse to work.

  • Once it is working, create a symlink in /etc/init.d:
ln -s net.lo net.eth1

where you replace eth1 with your interface name.

  • Finally run /etc/init.d/net.eth1 start and if everything goes smoothly, you can add it to the default run level.

WEP access

  • WEP access is much easier than WPA, just don't use WPA supplicant! All you need is in the wireless-tools package. Issue the following commands:
iwconfig eth1 essid MyNetworkName
iwconfig eth1 key 0123456789
dhcpcd eth1
  • Edit /etc/conf.d/net to get wifi networking automatically started at boot.
  • If your ESSID name contains a single quote ('), then you are in trouble. I was unable to properly escape this character in /etc/conf.d/net. The easiest way is then to create your own script (/etc/init.d/wireless) containing the above commands.
  • Note for troubleshooting: some problems can put the card in a buggy state. Issue the command:
iwlist eth1 scan

to get a list of available networks. If no results appear, then it's best to reboot your machine.

ipw3945 specific notes (pre-iwlwifi)

  • These notes are obsolete now that the recommended driver to use for this card is iwlwifi.
  • Be careful to add the daemon init script to the boot runlevel, not the default one. Else things won't work automatically after boot.
  • Include ipw3945 in the list of modules to be autoloaded. However by default it will start the daemon as soon as it is loaded, and this does not work well on Gentoo (maybe because it should wait a little?). So modify the file /etc/modules.d/ipw3945d so that installing the module does not load the init script automatically. Then run (of course) update-modules. This way you can have a clean boot sequence without errors :)

A note on init scripts on Gentoo

In fact there is only a single init script, net.lo, for the loop back interface. Other scripts are simply added by making symbolic links to net.lo, changing the "lo" with the new interface name.