Configuring Wireless

From gr0x0rd
Jump to navigation Jump to search

Configuring Hardware - Configuring Wireless

If you set up your kernel correctly, you installed the driver for your wireless card as a module. As another example, let's investigate the wireless network controller using lspci:

$ sudo lspci -v | grep Wireless 

The results should look something like this:

03:00.0 Network controller: Atheros Communications Inc. AR9285 Wireless Network Adapter (PCI-Express) (rev 01)

For this card, the kernel config is as follows:

[*] Networking support  ---> 
 -*-   Wireless  --->
  <*>   cfg80211 - wireless configuration API
  ...
  [*]     enable powersave by default
  ...
  <*>   Generic IEEE 802.11 Networking Stack (mac80211)

Device Drivers  --->
 [*] Network device support  --->
  [*]   Wireless LAN  --->
   <*>   Atheros Wireless Cards  --->
    ...
    <M>   Atheros 802.11n wireless cards support
    ...

Using lspci again, you should be able to see whether or not the correct kernel driver or module has been loaded for the device.

Kernel driver in use: ath9k
Kernel modules: ath9k

If you are confident you have correct kernel configuration and driver, you can test the module by probing it. Replace ath9k with the name of the module for your wireless device.

$ sudo modprobe ath9k

If you don't see any error messages the module is configured correctly. If you haven't already, be sure to add the module to /etc/modules.autoload.d/kernel-2.6. Depending on the card, you may also have to emerge a software package for your card, in order to create an interface between the kernel driver and the software package you'll use to configure it. For most cards, this will be the net-wireless/wireless-tools package.

$ sudo emerge -s wireless-tools

Once the package has emerged, we'll also need to install a package to manage the connections between the card and the networks it connects to. Since most wireless access points use WPA or WPA2 for security, the best package for this is wpa_supplicant. Before emerging, be sure that you have set the qt4 USE flag for it in your /etc/portage/package.use so you can use a simple GUI to manage your network connections.

$ sudo nano -w /etc/portage/package.use

Make sure the file contains the following line:

net-wireless/wpa_supplicant qt4

Next, we emerge wpa_supplicant.

$ sudo emerge -av wpa_supplicant

Once the emerge has completed, we'll need to create our initial wpa_supplicant.conf file.

/etc/wpa_supplicant/wpa_supplicant.conf

# The below line not be changed otherwise we refuse to work
ctrl_interface=/var/run/wpa_supplicant

# Allow users can read the WPA configuration
ctrl_interface_group=users

# Let wpa_supplicant take care of scanning and AP selection
ap_scan=1

#allow users to change this file
update_config=1

network={
       ssid="any"
       key_mgmt=NONE
       priority=1
}

# Simple case: WPA-PSK, PSK as an ASCII passphrase, allow all valid ciphers
network={
        ssid="WPAnetworkID"
	scan_ssid=0
	key_mgmt=WPA-PSK
	pairwise=CCMP TKIP
	group=CCMP TKIP
	psk="secretwpapassphrase"
 	priority=1024  
}

# another case: WEP network with a SHARED key
network={
        ssid="WEPnetworkID"
        scan_ssid=1
        key_mgmt=NONE
        wep_key0="secretweppassphrase"
        auth_alg=SHARED
        priority=1023
}