Installation von WLan-Karten mit Atheros-Chipsatz unter Debian Linux und NetBSD

:home:

Holger Amann    <keeney@fehu.org>


English Version

This document is outdated! Go to http://www.fehu.org/index.php/Linux/AtherosCardsWithDebian for newer details!



1. Allgemeines

1.1 Unterstützte Hardware

1.2 Unterstützte Modi

2. Installation unter Debian Linux

2.1 Benötigte Pakete

2.2 Installationsablauf

2.3 Inbetriebnahme der Karte

3. Konfiguration unter NetBSD

4. Konfiguration von wpa_supplicant mit WPA-PSK

5. Weitere Informationen

5.1 Wireless Applications

5.2 Links

5.3 Manpages



1. Allgemeines


1.1 Unterstützte Hardware

Im Grunde kann man davon ausgehen, dass alle Karten unterstützt werden, die einen Atheros-Chipsatz Typ ar5210/ar5211/ar5212 besitzen. Wer sich aber ganz sicher sein möchte, kann einen Blick auf http://madwifi.org/wiki/Compatibility werfen. Dortige Liste wird durch Erfahrungen und Tests von Usern stetig erweitert. Eine gute Informationsquelle über Karten, deren Chipsätze und Besonderheiten ist auch http://www.wifi.com.ar/doc/wifi/wlan_adapters.html


1.2 Unterstützte Modi

Sowohl der Linux MadWifi-Treiber, als auch der NetBSD-Treiber basieren auf einer binären HAL (Atheros Hardware Abstraction Layer) und dessen Kernelmodul ath_hal, welche Zugriff auf die Firmware der Karte erlaubt. Diese HAL ist "closed source" und wird zusammen mit einem Object File von Sam Leffler, Mitarbeiter bei Atheros, entwickelt, für diverse Architekturen kompiliert und der OpenSource-Gemeinde zur Verwendung zur Verfügung gestellt. Welche Modi unterstützt werden und welche nicht, ist zum Grossteil von der Arbeit dieses Mannes abhängig.

Die Dokumentation, Foren und Mailinglisten geben Aufschluss darüber, welche Modi bisher möglich sind:



2. Installation unter Debian Linux

Die Installation der Kerneltreiber sind sowohl unter Linux 2.4, als auch 2.6 möglich.


2.1 Benötigte Pakete

Als System liegt hier ein Debian Sarge mit Kernel 2.6.7-1-386 zugrunde. Bitte passen Sie die Versionen Ihrem System entsprechend an. Folgende Pakete müssen installiert sein:

cvs
wireless-tools 
kernel-headers-2.6.7-1-386 
sharutils 
uudecode 
libc6-dev

2.2 Installationsablauf

Nun werden die Madwifi-Treiber aus dem CVS-Repository ausgecheckt und installiert:

$ cd /usr/src
$ cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/madwifi login
$ cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/madwifi co madwifi
$ cd madwifi
$ make 
$ make install
$ make clean

Die installierten Module befinden sich nun in /lib/modules/2.6.7-1-386/net


2.3 Inbetriebnahme der Karte

Zur Konfiguration von WLan-Karten allgemein werden Programme aus dem Paket "wireless-tools" benötigt. Im Folgenden werden diese kurz angesprochen:

Bevor die Module geladen werden, sollte noch überprüft werden, in welchem Frequenzbereich, Unterband und Channel der Accesspoint betrieben wird.
Mit der Default-Konfiguration des Treibers unterstützt die Karte 802.11a/b/g im 5 GHz-Unterband 1+3:

$ iwlist ath0 chan 
          Channel 01 : 2.412 GHz
          Channel 02 : 2.417 GHz
          Channel 03 : 2.422 GHz
          Channel 04 : 2.427 GHz
          Channel 05 : 2.432 GHz
          Channel 06 : 2.437 GHz
          Channel 07 : 2.442 GHz
          Channel 08 : 2.447 GHz
          Channel 09 : 2.452 GHz
          Channel 10 : 2.457 GHz
          Channel 11 : 2.462 GHz
          Channel 36 : 5.18 GHz
          Channel 40 : 5.2 GHz
          Channel 42 : 5.21 GHz
          Channel 44 : 5.22 GHz
          Channel 48 : 5.24 GHz
          Channel 50 : 5.25 GHz
          Channel 52 : 5.26 GHz
          Channel 56 : 5.28 GHz
          Channel 58 : 5.29 GHz
          Channel 60 : 5.3 GHz
          Channel 64 : 5.32 GHz
          Channel 149 : 5.745 GHz
          Channel 152 : 5.76 GHz
          Channel 153 : 5.765 GHz
          Channel 157 : 5.785 GHz
          Channel 160 : 5.8 GHz
          Channel 161 : 5.805 GHz
          Channel 165 : 5.825 GHz

Soll die Karte mit dieser Einstellung betrieben werden, reicht ein einfaches

$ modprobe ath_pci

Um eine Unterstützung für bestimmte, länderspezifische Frequenzen zu erhalten, ist das Setzen des Parameters "countrycode" beim Laden der Module notwendig.
Als Beispiel gilt für Deutschland, 5 Ghz-Unterband 1+2

$ modprobe ath_pci countrycode=276
$ iwlist ath0 chan
 ath0      255 channels in total; available frequencies :
          Channel 01 : 2.412 GHz
          Channel 02 : 2.417 GHz
          Channel 03 : 2.422 GHz
          Channel 04 : 2.427 GHz
          Channel 05 : 2.432 GHz
          Channel 06 : 2.437 GHz
          Channel 07 : 2.442 GHz
          Channel 08 : 2.447 GHz
          Channel 09 : 2.452 GHz
          Channel 10 : 2.457 GHz
          Channel 11 : 2.462 GHz
          Channel 12 : 2.467 GHz
          Channel 13 : 2.472 GHz
          Channel 36 : 5.18 GHz
          Channel 40 : 5.2 GHz
          Channel 44 : 5.22 GHz
          Channel 48 : 5.24 GHz
          Channel 52 : 5.26 GHz
          Channel 56 : 5.28 GHz
          Channel 60 : 5.3 GHz
          Channel 64 : 5.32 GHz
          Channel 100 : 5.5 GHz
          Channel 104 : 5.52 GHz
          Channel 108 : 5.54 GHz
          Channel 112 : 5.56 GHz
          Channel 116 : 5.58 GHz
          Channel 120 : 5.6 GHz
          Channel 124 : 5.62 GHz
          Channel 128 : 5.64 GHz
          Channel 132 : 5.66 GHz
          Channel 136 : 5.68 GHz
          Channel 140 : 5.7 GHz
          Current Frequency:2.412GHz (channel 01)

Diese "countrycodes" können bei http://www.unicode.org/onlinedat/countries.html eingesehen werden. Sie sind im EEPROM der Karte gespeichert und können nicht überschrieben werden.

Sollten die Module einmal mit den falschen Einstellungen geladen worden sein

$ modprobe -r ath_pci

Damit werden die Module wieder entladen, und es kann weiter experimentiert werden.

Möchte man die Karte an 802.11a, b oder g binden, ist dies durch

$ iwpriv ath0 mode X

möglich, wobei X für 0=802.11a/b/g, 1=802.11a, 2=802.11b, oder 3=802.11g steht.

Der Turbo-Mode ist nur im 5 Ghz Bereich möglich, und dort auf ein paar wenige Channels im Unterband 1+3 begrenzt. Der "countrycode" darf nicht gesetzt sein!

$ modprobe ath_pci
$ iwpriv ath0 mode 1
$ iwpriv ath0 turbo 1
$ iwlist ath0 chan
ath0      255 channels in total; available frequencies :
          Channel 42 : 5.21 GHz
          Channel 50 : 5.25 GHz
          Channel 58 : 5.29 GHz
          Channel 152 : 5.76 GHz
          Channel 160 : 5.8 GHz
          Current Frequency:5.21GHz (channel 42)

Mit den neusten Versionen war es allerdings nicht möglich, unter Linux den Turbo-Mode zu aktivieren. Nach Vergabe einer IP erhält man die Fehlermeldung "ath0: unable to reset hardware; hal status 12"

Ein Beispiel aus der Praxis, um eine Verbindung zu einem Accesspoint mit WEP aufzubauen

$ modprobe ath_pci countrycode=276
$ iwconfig ath0 essid blabla
$ iwconfig ath0 key 14929429325878194789834632
$ ifconfig ath0 192.168.1.66

Möchte man die Einstellungen anschliessend speichern, damit diese nach einem Reboot automatisch geladen werden, muss dazu /etc/modprobe.d/aliases fuer 2.6 bzw. /etc/modutils/aliases fuer 2.4 und /etc/network/interfaces angepasst werden.

$ echo "alias ath0 ath_pci"  >> /etc/modprobe.d/aliases
$ echo "options ath_pci countrycode=276" >> /etc/modprobe.d/aliases
$ update-modules 
$ cat /etc/network/interface
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

# Wireless 
auto ath0

# static
#iface ath0 inet static
#    address 192.168.1.66
#    netmask 255.255.255.0
#    broadcast 192.168.1.255
#    up /sbin/iwpriv ath0 mode 3
#    up /sbin/iwconfig ath0 essid "blabla" rate 54M key 14929429325878194789834632

# dhcp
iface ath0 inet dhcp
    pre-up /sbin/iwpriv ath0 mode 3
    pre-up /sbin/iwconfig ath0 essid "blabla" rate 54M key 14929429325878194789834632

3. Konfiguration unter NetBSD

Getestet und dokumentiert: Hubert Feyrer hubertf@NetBSD.org


Bei NetBSD gestalltet es sich um einiges einfacher, da der Treiber im Kernel bereits integriert ist. Vorausgesetzt, man besitzt NetBSD 2.0 oder höher.

Die Standardeinstellungen des Treibers, verschiedene Modi, Einschränkungen etc. entsprechen aufgrund der identischen HAL denen des Linux MadWifi-Treiber.

Man kann sich die einzelnen Modi mit

$ ifconfig -m ath0

anzeigen lassen. Möchte man die Karte zb. im 5 Ghz-Band einsetzen

$ ifconfig ath0 ssid blabla media autoselect mode 11a

Akivieren des Turbo-Modes

$ ifconfig ath0 ssid blabla chan 58 media autoselect mode 11a mediaopt turbo"

Der "countrycode" lässt sich mit

sysctl -w hw.ath.countrycode=276

einstellen.

Um die Karte automatisch vom System nach einem Reboot konfigurieren zu lassen, ist die /etc/rc.conf z.B. um folgende Angaben zu ergäzen:
...

#
# WaveLAN+Internet Config
#
# static
#ifconfig_ath0="10.0.0.1 netmask 255.255.0.0 ssid blabla chan 58 media autoselect mode 11a mediaopt turbo"

# dhcp
ifconfig_ath0="mode 11a nwkey 0x14929429325878194789834632 ssid fehu.org"
dhclient=YES
dhclient_flags="ath0"

...

Weiter Infos:
* ath(4) Manpage
* http://www.netbsd.org/Documentation/network/wavelan.html



4. Konfiguration von wpa_supplicant mit WPA-PSK


Momentan ist WPA leider nur mit Linux möglich.
Die nächsten Schritte erklären, wie man mittels wpa_supplicant-0.3.8 WPA-PSK (WPA-Personal) Authentifizierung ermöglicht.

Vorerst muss libssl-dev installiert sein, anschliessend wird wpa_supplicant runtergeladen

cd /usr/scr
$ wget http://hostap.epitest.fi/releases/wpa_supplicant-0.3.8.tar.gz

Jetzt werden die Treiber installiert. Um diese kompilieren zu können, muss eine .config im gleichen Verzeichnis erstellt werden. Entweder editiert man defconfig und kopiert diese nach .config, oder man legt wie ich eine neue Datei an. Ich werde den Inhalt dieser mittels "cat" darstellen

$ tar xvzf wpa_supplicant-0.3.8.tar.gz
$ cd wpa_supplicant-0.3.8
$ cat .config

CONFIG_DRIVER_MADWIFI=y
CFLAGS += -I/usr/src/madwifi
CONFIG_DRIVER_WEXT=y
CONFIG_IEEE8021X_EAPOL=y
CONFIG_EAP_MD5=y
CONFIG_EAP_MSCHAPV2=y
CONFIG_EAP_TLS=y
CONFIG_EAP_PEAP=y
CONFIG_EAP_TTLS=y
CONFIG_EAP_GTC=y
CONFIG_EAP_OTP=y
CONFIG_EAP_LEAP=y
CONFIG_PKCS12=y
CONFIG_CTRL_IFACE=y

$ make && make install

Anschliessend muss eine Konfigurationsdatei für wpa_supplicant erstellt werden. Wiederum entweder wpa_supplicant.conf editiern und irgendwohin kopieren oder eine neue Datei erstellen. Ich benannte diese wpa-fehu.conf und kopierte sie nach /etc. Der Inhalt ist

ctrl_interface=/var/run/wpa_supplicant
eapol_version=1
network={
ssid="fehu.org"
scan_ssid=1
priority=5
proto=WPA
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
group=CCMP TKIP WEP104 WEP40
    #psk="mysecretpassword"
    psk=283fe364eb0ce1352c1831dee1ed08481eda8ba62583d6c6589a386cbd6957af
    }

In "psk=" muss man den Pre-Shared-Key einfügen. Um diesen zu erhalten, liefert wpa_supplicant ein Tool mit "wpa_passphrase"

 $ wpa_passphrase fehu.org mysecretpassword
network={
    ssid="fehu.org"
    #psk="mysecretpassword"
    psk=283fe364eb0ce1352c1831dee1ed08481eda8ba62583d6c6589a386cbd6957af
    }

Jetzt startet man wpa_supplicant. Nach wenigen Sekunden sollte die Karte sich mit dem AP verbinden. Die Option "-d" ist nur für Debugging notwendig.

$ wpa_supplicant -w -i ath0 -c /etc/wpa-fehu.conf -D madwifi -d

Automatische Konfiguration während des Bootens geschieht mittels Anpassen der /etc/network/interfaces

$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

# Wireless 
auto ath0

# static
#iface ath0 inet static
#    address 192.168.1.66
#    netmask 255.255.255.0
#    broadcast 192.168.1.255
#    up /sbin/iwconfig ath0 rate 54M
#    up /usr/local/sbin/wpa_supplicant -B -w -i ath0 -Dmadwifi -c /etc/wpa-fehu.conf

# dhcp
iface ath0 inet dhcp
pre-up /usr/local/sbin/wpa_supplicant -B -w -i ath0 -Dmadwifi -c /etc/wpa-fehu.conf
pre-up /sbin/iwconfig ath0 rate 54M


5. Weitere Informationen


5.1 Wireless Applications

* http://apradar.sourceforge.net/ ApRadar
* http://www.janmorgenstern.de/projects-software.html Wavemon
* http://www.open1x.org/ Open Source Implementation of IEEE 802.1X
* http://www.simandl.cz/stranky/linux/wifimon/wifimon_a.htm wifimon
* http://airsnort.shmoo.com/ Airsnort
* http://www.kismetwireless.net/ Kismet
* http://sourceforge.net/projects/wmwave/ wmwave

5.2 Links

* http://www.mattfoster.clara.co.uk./madwifi-faq.htm Unofficial MadWifi-Faq
* http://sourceforge.net/projects/madwifi MadWifi Project Page
* http://sourceforge.net/mail/?group_id=82936 MadWifi Mailinglisten
* http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html Wireless Tools

5.3 Manpages

Linux:

NetBSD:

Valid HTML 4.01!


Visits:
Holger Amann <keeney@fehu.org>