Iwlwifi

iwlwifi is Intel's open source driver for their newer wireless network adapters (Intel PRO/Wireless 3945ABG/BG and newer). The driver is included in the linux kernel since version 2.6.24.

Kernel Setup
Enable the "mac80211" WLAN stack and crypto options for WEP, WPA and WPA2:

Then, be sure you have activated the option "Prompt for development and/or incomplete code/drivers" in the "General Setup" section of the kernel configuration:

Otherwise you won't be able to access the iwlwifi driver options in the kernel configuration!

Later on, you will also have to install the corresponding microcode file for your iwlwifi network adapter (it is, of course, available in portage). The iwlwifi driver loads this file at startup. To get this working, we need to enable the kernel's firmware_loader infrastructure:

IMPORTANT: For the next steps, it is highly recommended to compile the drivers as kernel modules ( instead of <*>). This is because the driver needs access to the file system (i.e. /lib/firmware) to load the firmware. If you compile the driver as built-in, it will not be able to load the (essential) firmware since the file systems are mounted *after* the kernel has been loaded.

Kernels >=3.1.0
Here is an example of a configuration for an Intel 5100 card.

Kernels >=2.6.30
Starting with 2.6.30, some of the options have been moved or renamed. For instance, the LED support. Here is an example of a configuration for an Intel 5100 card.

Kernels >=2.6.26
If you have an Intel PRO/Wireless 3945AGB/BG Network Connection adapter, activate the iwl3945 driver:

Or if you have an Intel Wireless WiFi 4965AGN adapter, activate the iwl4965 driver:

There is also now support for the WLAN LEDs, but be aware, that the LED blinks a lot when there is traffic:

Kernel 2.6.25
If you have an Intel PRO/Wireless 3945AGB/BG Network Connection adapter, activate the iwl3945 driver:

Or if you have an Intel Wireless WiFi 4965AGN adapter, activate the iwl4965 driver:

Software Setup - Installing the microcode files
You have to install the corresponding firmware/microcode for your iwlwifi network device in order to become really useful as a wireless adapter.

Here is a short (and not complete) overview about what the microcode does, taken from the file README.iwlwifi-3945-ucode that is shipped with the microcode package iwl3945-ucode from portage:

To install the microcode, simply emerge :

or, respectively :

or, if you have a Intel Wifi Link 5100/5300 :

If you have a Intel Wifi Link 6000, then you need (see ).

If the required microcode/firmware is not in portage yet, then the latest microcode/firmware can be obtained at.

It is also recommended to check the README files of the microcode packages, as they contain other useful information for setting up the device. You can usually find them in /usr/share/doc/iwl3945-ucode-*/ or /usr/share/doc/iwl4965-ucode-*/ respectively, where * is to be replaced with the package version.

For further configuration follow the Gentoo Handbook.

Networking
For easy desktop configuration of your wireless adapter, use either NetworkManager or wicd. NetworkManager is heavier, with more dependencies, but with better integration across many applications. wicd is more lightweight. Both wrap wpa_supplicant, and make changing networks often easier. If you use either, you may ignore the next section.

wpa_supplicant
If you want to use wpa_supplicant directly, here is how to configure it.

Advanced Topics
There are a few things you can play with through the sysfs interface /sys/bus/pci/drivers/iwl3945/00*/*

Monitor mode
To learn how set your card into monitor mode, see the guide at aircrack-ng.org.

Hibernate (kernels < 3.0.0 only)
The hibernate package needs to be told to restart the networking interface when hibernate resumes. The networking interface (includes and is not limited to: apipa arping ccwgroup macchanger macnet rename iwconfig essidnet iptunnel ifconfig pppd system dhcpcd ip6to4 ifconfig pppd dhcpcd) needs to be restarted when hibernation is invoked.

The hibernate package contains a convenient mechanism to restart the networking interface. The hibernate configuration file contains a section for networking:

Try to do this: uncomment the resume interface operation declarations and set it to the interface of your wireless interface.

Switching from ipw3945
If you switched from ipw3945, you should unmerge everything that belonged to ipw3945. Also you may want to clean up your device names. Problems occur here because some drivers refer to your wireless interface as wlan0, some as ethX. You need to reconfigure /etc/udev/rules.d/70-persistent-net or recreate the rules there. You can use udevadm to recreate the rules #udevadm trigger --subsystem-match=net

Occasionally switching from ipw3945 to iwlwifi will not work because of some missing symlinks. See iwl3945 + wpa_supplicant + hardware switch for a detailed description. In summary:

My WLAN LED does not work ?
Support is added since kernel 2.6.26.

iwl4965: iwlwifi-4965-1.ucode firmware file req failed: Reason -2
This error indicate a firmware version/filename mismatch. Just rename the file to whatever iwlwifi displays in this case: iwlwifi-4965-1.ucode If this fails, try an alternate version, perhaps net-wireless/iwl4965-ucode-228.57.1.21.

Problem with wpa_supplicant and association
If the AP SSID is hidden or there multiple SSIDs with the same name, be sure that ap_scan does not exist or is commented out in /etc/wpa_supplicant/wpa_supplicant.conf.

Netmount starting too early
Netmount crapped out because the network was not ready. The solution, from this gentoo-user post is to edit /etc/conf.d/rc so that the Wifi is not started by udev, e.g., RC_PLUG_SERVICES="!net.wlan".

Unable to associate with access point (AP) and 'iwlist wlan0 scanning' says 'Interface doesn't support scanning'
Try to do this:

If 'iwlist wlan0 scanning' now works, create /etc/modprobe.d/iwl3945 and run update-modules like this:

When I got this message I did it the other way around:

And then I was able to scan. If you are also able to scan after changing to 0 you can do the following to make the change permanent:

Unable to associate with access point (AP) that uses WEP and 'MAC is in deep sleep" in /var/log/messages
Check if your /etc/conf.d/net ESSID contains any special characters and if yes, the key_ESSID=" " should no longer contain '_' in stead of the special characters - in stead write the real ESSID. E.g. if ESSID is 'Rødgrød', use key_Rødgrød=" ", NOT key_R_dgr_d=" ".

If you want to debug why /etc/init.d/net.wlan0 start fails, use /etc/init.d/net.wlan0 --debug --verbose start to see the steps. The above was found like that, the output showed that WEP was disabled.

Switching to Ad-Hoc mode doesn't work
If you are using iwconfig and trying to switch to Ad-hoc mode, but keep getting the following error:

The issue probably relates to the new CRDA regulatory stuffs in >=2.6.28 kernels. See this bug on intellinuxwireless.org for more info and how to fix.

RTNETLINK answers: Unknown error 132
If you get this error after trying to bring up your WLAN interface (see the following two examples), then your kernel driver might try to access the wrong microcode/firmware.

In this case, run dmesg. If you get the following messages, then you have either installed no microcode/firmware or the wrong one.

$ dmesg

The microcode/firmware is installed in /lib/firmware/. If there is no microcode/firmware file or a wrong one, which does not match any microcode/firmware listed in dmesg output, then you have to install one of them (in this case iwlwifi-6000-4.ucode, iwlwifi-6000-3.ucode, iwlwifi-6000-2.ucode, or iwlwifi-6000-1.ucode). Afterwards reboot your system (just removing and loading the interface kernel driver didn't work).

In this example a Intel WiFi Link 6000 interface is used that requires microcode/firmware iwlwifi-6000-4.ucode. However, microcode/firmware iwlwifi-5000-2.ucode is installed.

$ ls -l /lib/firmware/

If you are sure that you have the correct microcode installed, it could be that your interface is software blocked. Please try the following:

Authentication with 00:ef:dd:cc:bb:aa timed out
If everything is going well (there are no errors in the syslog see below) but there is always a timeout during authentication, then your access point might has MAC-based access control enabled. Check your access point whether MAC-based access control is enabled and add your WLAN interface's MAC address to this list. Afterwards, a successful authentication should be possible.

If your notebook is sometimes able to connect and other times not and you use WEP 40/128-bit for security. Take a look what you choosed for authentication. There are two modes "open system" and "shared key". After I changed to "open system" the problem was solved.

Links

 * iwlwifi website
 * Gentoo wireless LAN howto

Iwlwifi