Sunday, September 05, 2010
Latest Content
Linux Tutorials Slackware Wireless Tutorial

Slackware Wireless Tutorial

In this tutorial I will give some guidelines to getting wireless up and running in Slackware (in my case, version 12.2).

I say "guidelines" because I don't entirely understand the Slackware system and are more familiar with Debian; but wanted to try something new!

My particular card is an Engenius EPI-3601S and it uses the Atheros 5001X+ chipset (chip number AR5211). A particularly nice feature of this card is its 600mW power rating, which is far beyond that of big-box store cards by manufacturers like Linksys, D-Link, etc.

The driver for this chipset is actively developed by the Mad-WiFi Project and is known as the 'ath5k' driver.

Okay, now for the good stuff:

Once your card is installed into the PCI or PCI-e bus, and the machine is booted, ensure the system can recognize your card. Take note that in all my output from commands I have just shown the relevant information.

# lspci

03:00.0 Ethernet controller: Atheros Communications Inc. Atheros AR5001X+ Wireless Network Adapter (rev 01)

 

The system *should* load the ath5k driver at boot, and you can verify this by performing "# lsmod | grep ath5k", however if it does not you can easily insert it yourself with the command "# modprobe ath5k". If the driver is not found, you will have to seek other online resources to compile it yourself, and then refer back to this tutorial once you've done so.

There are three primary configuration files that need to be configured before we can use our card, and they are:

/etc/rc.d/rc.inet1.conf

/etc/rc.d/rc.wireless.conf

/etc/wpa_supplicant.conf

 

First, I must mention that I find the rc.wireless.conf to not be of much value. It is more of a "global" wireless settings file that all wireless interfaces would inherit parameters from. While this might be useful in certain apps, I personally think it makes more sense to specify the wireless settings in rc.inet1.conf on a per-interface basis, just as you would for wired ethX connections. This allows you to specify unique settings for each wireless interface you may have on your system (useful if you have more than one). Thus, in my rc.wireless.conf I deleted all the provided examples and simply have the below.

# cat /etc/rc.d/rc.wireless.conf

VERBOSE=1

case "$HWADDR" in

# Generic example (decribe all possible settings)
*)
#INFO="Fill with your own settings..."
# ESSID (extended network name) : My Network, any
#ESSID=""
# NWID/Domain (cell identifier) : 89AB, 100, off
#NWID=""
# Operation mode : Ad-Hoc, Managed, Master, Repeater, Secondary, auto
#MODE=""
# Frequency or channel : 1, 2, 3 (channel) ; 2.422G, 2.46G (frequency)
#FREQ=""
#CHANNEL=""
# Sensitivity (cell size + roaming speed) : 1, 2, 3 ; -70 (dBm)
#SENS=""
# Bit rate : auto, 1M, 11M
#RATE=""
# Encryption key : 4567-89AB-CD, s:password
#KEY=""
# RTS threshold : off, 500
#RTS=""
# Fragmentation threshold : off, 1000
#FRAG=""
# Other iwconfig parameters : power off, ap 01:23:45:67:89:AB
#IWCONFIG=""
# iwspy parameters : + 01:23:45:67:89:AB
#IWSPY=""
# iwpriv parameters : set_port 2, set_histo 50 60
#IWPRIV=""
;;
esac

 

Everything is commented out in the case statement, but I left the parameter names just incase down the road I ever need to use rc.wireless.conf.

The next step is the configuration of rc.inet1.conf and wpa_supplicant.conf.

rc.inet1.conf will allow us to specify the settings of each wired/wireless interface that is recognized by the output of '# ip link'

The relevant (wireless) part of my rc.inet1.conf is as such:

# cat /etc/rc.d/rc.inet1.conf

IFNAME[4]="wlan0" <---- The name of the interface as it should be reported by ifconfig and iwconfig
IPADDR[4]="192.168.1.48" <--- I use static IP addressing, and this has been set-up in advance on my router (Will explain dhcp later)
NETMASK[4]="255.255.255.0" <--- The netmask my router uses... should be identical to that of your working wired connections
USE_DHCP[4]="no" <---- May not be required if IPADDR is specificied, but included anyways
WLAN_RATE[4]="54M auto" <--- May not be required on all cards, but mine defaulted to 12M without specifiying!
WLAN_WPA[4]="wpa_supplicant" <--- Tells rc.inet1 that it needs to refer to the WAP-PSK connection settings in etc/wpa_supplicant
WLAN_WPADRIVER[4]="wext" <--- The WPA-PSK driver to use when calling wpa_supplicant commands

 

The above should be sufficient for the majority of setups. If you don't use static IP addressing on your AP, then comment out the IPADDR line and set the USE_DHCP line to "yes". It also doesn't hurt to read through the other lines that are commented out in the example; there may be something that you find of value to adjust, but it is better to start with a minimal configuation and at least get somethign working first before piling on exotic options. Make sure that if you specify WLAN_RATE you put "54M auto" and not just "54M"! For me this seemed to crash the whole process of bringing up the interface and I spent considerable time pulling out my hair figuring out what the issue was.

My advice is to use wpa_supplicant even if your AP does not use a key for access. The default wpa_supplicant.conf provides two network examples. The top (first) one is for an AP that requires a key and the second one is for an AP that does not (free public APs). I will focus my attention on the one that requires a key. Assuming your AP requires a key (most likely WPA-PSK w/ TKIP encryption), you first need to run '# wpa_passphrase essid-of-your-AP passphrase-of-your-AP' to get a hexadecimal encryption key to be manually inserted into your wpa_supplicant.conf.

ASIDE: If you are clueless about some of the settings and capabilities of your AP, I suggest running '# iwlist wlan0 scan'. If you get a message that the network is down, first type '# ifconfig wlan0 up'. This will show you all the APs that your card has detected, along with the essids, the encryption (if any) that they use, and the supported bit rates of that AP.

 

An example output of my personal wpa_supplicant.conf (edit, of course, for security reasons):

# cat /etc/wpa_supplicant.conf

# This line enables the use of wpa_cli which is used by rc.wireless
# if possible (to check for successful association)
ctrl_interface=/var/run/wpa_supplicant
# By default, only root (group 0) may use wpa_cli
ctrl_interface_group=wheel
eapol_version=1
ap_scan=1
fast_reauth=1

# WPA protected network, supply your own ESSID and WPAPSK here:
network={
scan_ssid=1
ssid="your-ssid-goes-here"
proto=WPA
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
#group=CCMP TKIP WEP104 WEP40
#psk below was made with wpa_passphrase
psk=abcdef12345abcdef12345abcdef12345abcdef12345abcdef

}

 

That's about it! You can either do a full system reboot or run the rc.inet1 script as root. If you want to just run the script on the wlan0 interface, the proper command is 'rc.inet1 wlan0_start'.

 Supplemental Information

Assuming rc.inet1 threw no errors your way, run '# ifconfig wlan0'. You should see some assigned IP address (such as 192.168.1.55). If this is your only interface, all pings should go through it, so you can verify your connection by '# ping google.com'. If you do not recieve any packets back my suggestion is to ping your gateway (ping 192.168.1.1) and see if there is any connection to the AP present. If there is, your problems may lie in the permissions of the router itself. If rc.inet1 threw an error or if there doesn't seem to be an IP assigned to wlan0, ensure the netmask in rc.inet1.conf has been set properly. While mine is 255.255.255.0, yours may be different depending on how your router has been configured. You could also try leaving the netmask blank and leave it to the system to resolve. I will put more diagnosis hints in this part if they come to mind in the future.

If you still seem to be having trouble, my other piece of advice would be to invoke wpa_supplicant (the executable, not the conf file) yourself with the following line

# wpa_supplicant -c/exc/wpa_supplicant.conf -iwlan0 -Dwext -d

The "-d" option is debugging and may offer some clues as to where wpa_supplicant is failing. The lines WLAN_WPA[4]="wpa_supplicant", WLAN_WPADRIVER[4]="wext", and IFNAME[4]="wlan0" that were in rc.inet1.conf are the same parameters that are fed to the wpa_supplicant executable, so manually running the wpa_supplicant as above offers some good insight. Smile

Another way of checking if wpa_supplicant is properly bound to your AP is with '# wpa_cli status'

# wpa_cli status

bssid=mac-of-your-ap
ssid=some-ssid-name-here
id=0
pairwise_cipher=TKIP
group_cipher=TKIP
key_mgmt=WPA-PSK
wpa_state=COMPLETED
ip_address=192.168.1.55

 

Lastly, we all make dumb mistakes - Remember, if you are using static IP adressing, it must be setup on your AP first (read your firmware's docs); and of course if you are using DHCP ensure that dhcp leasing is enabled on your AP (again, read firmware docs). Maybe along time ago you disabled it for security reasons?

(Will write this section later).

 

 (To be extended upon)

http://slackbuilds.org/repository/12.2/network/ndiswrapper/

http://www.station-drivers.com/page/atheros.htm

Add the line /sbin/modprobe ndiswrapper to your /etc/rc.d/rc.modules so that it is loaded during the boot process.

# ls
athw.sys  netathw.cat  netathw.inf

The command below will install the win32 netathw.inf driver and set up a directory in /etc/ndiswrapper containing an copy of the drivers (.inf and .sys) and configuration files.

~/ndis5x# ndiswrapper -i netathw.inf

You can also verify the driver install was a success as shown below.  Note that ndiswrapper can recognize loaded alternate drivers.

~/ndis5x# ndiswrapper -l
netathw : driver installed
        device (168C:0013) present (alternate driver: ath5k)

Can confirm this is the right device with '# lspci -n'

You can blacklist the ath5k driver from loading by putting the line 'blacklist ath5k' in the file /etc/modprobe.d/blacklist.  Also, while your there, if you are frustrated that ndiswrapper is going to be taking up already limited room in your system, you may as well blacklist ipv6 as it probably isn't going to be used anywhere in the near future by ISPs.

 

 

 

 

 

 

 

 

 

 

 

 

Bottom Tab Content