WiFi — wireless networking

Sunday, 3 December 2006, michuk

If you have a modern laptop it is likely that it comes with a built-in WiFi modem. If you are lucky (or did some research before buying one) and your modem is fully supported under GNU/Linux (the free software drivers are available) it may just work out-of-the-box. This is the case with Intel PRO/Wireless line of modems and many other. If you are not lucky (and performed no research) it may occur that the only way to get your WiFi working under GNU/Linux is by emulating the Windows drivers.

Wireless security: WEP and WPA

Wireless networks are much more vulnerable to attacks than the traditional ones. A misconfigured access point may be kindly offering the Internet connection to all wireless devices around. This is the main reason one should use encryption and password protection in all wireless networks. The two most common encryption standards for WiFi are WEP and WPA. They are both supported under GNU/Linux, but WEP is usually supported by default and WPA, due to its patent issues, is not. WPA is however much more secure and it is recommended for all wireless networks nowadays.

Configuring WEP is as easy as entering the adapter password in the network manager wizard, like the default GNOME or KDE network admin. For WPA you need a program called wpasupplicant. We won’t cover configuring WPA here it detail, but it it does not just work, you can read more about it in the external articles we recommend.

External articles on WEP and WPA

NetworkManager in action

NetworkManager — Pain-Free Networking

If you are using GNOME desktop you may be interested in NetworkManager project which aims in making (wireless) networking in GNU/Linux as easy as a one click to switch between different access points. The program is already available in many GNU/Linux distributions (like Ubuntu or Fedora Core) by default. For other systems you may need to install it manually.

If it’s not started you can trigger it by entering nm-applet in the system terminal. A small applet should appear in the GNOME panel indicating the current state of the wireless connection. You can easily switch between different access points by selecting them from the list. If the selected access point requires a password (for WPA or WEP) NetworkManager asks you to enter it and then attempts to connect.

Configuring your network manually

It’s all great when WiFi works out-of-the-box. Still, if the network does not start automatically, you may need to examine the reasons by yourself. The command line is your friend from now on! First, check whether the the interface is up. You can do this by calling the iwconfig command. Typical output of iwconfig is:

$ iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.

wlan0     IEEE 802.11g  ESSID:"BrustracjaRouter"
          Mode:Managed  Frequency:2.462 GHz  Access Point: 00:C0:49:F9:27:74
          Bit Rate=48 Mb/s   Tx-Power=20 dBm   Sensitivity=8/0
          Retry limit:7   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=80/100  Signal level=-48 dBm  Noise level=-83 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:2

This particular output indicates that the wireless network has been detected on interface wlan0 and that we are connected to the access point called “BrustracjaRouter”. If the wireless interface is not found, it means that the proper driver is not loaded and you need to do this manually. If you are using a modern user-friendly distribution like Ubuntu or openSUSE it probably simply means that you have an adapter that is not supported under GNU/Linux directly. Read about ndiswrapper to learn more about it.

However, if the interface is detected but you still have no network, first thing to check if to search for the available access points. You can do this using the iwlist command:

$ iwlist wlan0 scan
wlan0      Scan completed :
          Cell 01 - Address: 00:C0:49:F9:27:74
                    Protocol:IEEE 802.11bg
                    Encryption key:off
                    Bit Rates:54 Mb/s
                    Extra: Rates (Mb/s): 1 2 5.5 6 9 11 12 18 22 24 36 48 54
                    Quality=80/100  Signal level=-49 dBm
                    Extra: Last beacon: 384ms ago

	  Cell 02 - Address: 00:00:00:00:00:01
                   Frequency:2.432 GHz (Channel 5)
                   Quality:0/70  Signal level:-76 dBm  Noise level:-93 dBm
                   Encryption key:off
                   Bit Rate:1 Mb/s
                   Bit Rate:2 Mb/s
                   Bit Rate:5.5 Mb/s
                   Bit Rate:11 Mb/s

The result above indicates that there are two network adapters around and you can try to connect to one of them. If you rather see something like:

iwlist wlan0 scan
eth1 No scan results

then it means that no network adapters has been detected around you. It may be a problem with adapter’s configuration, as well as it may mean that there really are no adapters around or they are deliberately hidden.

If your access point has been detected, you can connect to it by entering the following commands:

iwconfig wlan0 essid BrustracjaRouter
dhclient wlan0

This sets the desired access point to “BrustracjaRouter” (which has no password set, yet) and tries to connect to it using a default DHCP client. If you need to set a password or some specific networking parameters, please consult the iwconfig manual: man iwconfig or take a look at the external resources we recommend.

External articles on wireless-tools

Ndiswrapper — handle Windows-only drivers

If you have a wireless network adapter which has free (as in freedom) drivers available, things are quite easy. In most of the user-friendly distros, the wireless networking will be available out-of-the-box since most of those distros come with the free WiFi drivers pre-installed. If for some reason the system does not detect your device, it might be that you will have to install the drivers manually. However, if you have a network adapter provided by a vendor that cares little about you and protects the specification of his hardware, it may be that emulating Windows wireless architecture will be needed.

Ndiswrapper is an open source driver wrapper that enables the use of most wireless network cards on Linux by implementing the Windows kernel and NDIS APIs and dynamically linking the vendor’s Windows drivers to this implementation. This is an important project because many vendors do not release Linux supported drivers for their wireless network cards. There is a list available of all the wireless network cards known to work with Ndiswrapper.

Ndiswrapper is available in almost all GNU/Linux distributions as well as in some BSD systems. In order to make any use if it, you will need the Windows driver for your adapter. It’s usually available in C:\Windows\inf\ in MS Windows installations. You can also extract it from the WiFi installation CD. Assuming that you already have the driver, installing it under GNU/Linux is as easy as performing:

ndiswrapper -i filename.inf

This copies the driver to appropriate folder and creates a configuration file for it. If it goes fine, you can now load the ndiswrapper module and the network should be up and running:

modprobe ndiswrapper

Of course things may not go as flawless as described here. In such case, it is recommended to visit the Ndiswrapper Wiki to examine the problem.

External articles on Ndiswrapper

Some content on this page has been directly copied from the Wikipedia article: Ndiswrapper.