Hostap

From SaruWiki
Jump to navigation Jump to search

We want to build a wireless access point (AP) on a debian based server. You can use any wireless pci adapter as long as it supports iwconfig ath0 mode master If you get a error try another driver. I use the madwifi driver for my atheros based card.


Hardware

Requirements

wireless-tools (for iwconfig)
Bridge-utils
Hostapd
Hostap-utils ??

I used an old netgear wireless pci card. To see wich chipset it has type

lspci
00:0e.0 Ethernet controller: Atheros Communications Inc. AR5212/AR5213 Multiprotocol MAC/baseband processor (rev 01)

The atheros chip uses the madwifi driver http://sourceforge.net Download the driver and compile the module. Or use the 2.6.27.2 kernel where the atheros chip is supported as a module. Use modprobe ath9k

make install
modprobe ath_pci

To enable ath9k, you must first enable mac80211:

Networking  --->
 Wireless  --->
   <M> Improved wireless configuration API
   <M> Generic IEEE 802.11 Networking Stack (mac80211)

You can then enable ath9k in the kernel configuration under

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

Now you should see the card

thinner:/# iwconfig
lo        no wireless extensions.

eth0      no wireless extensions. 

eth1      no wireless extensions.

wifi0     no wireless extensions.

ath0      IEEE 802.11g  ESSID:""  Nickname:""
         Mode:Managed  Frequency:2.437 GHz  Access Point: Not-Associated
         Bit Rate:0 kb/s   Tx-Power:14 dBm   Sensitivity=1/1
         Retry:off   RTS thr:off   Fragment thr:off
         Encryption key:off
         Power Management:off
         Link Quality=0/70  Signal level=-96 dBm  Noise level=-96 dBm
         Rx invalid nwid:4378  Rx invalid crypt:0  Rx invalid frag:0
         Tx excessive retries:0  Invalid misc:0   Missed beacon:0

To bring the card up

#ifconfig ath0 up

And to scan for networks

#wlanconfig ath0 list scan

And for more info

#iwlist ath0 scan
#wlanconfig ath0 destroy
#wlanconfig ath0 create wlandev wifi0 wlanmode ap
ath0      IEEE 802.11g  ESSID:""  Nickname:""
         Mode:Master  Frequency:2.412 GHz  Access Point: 00:09:5B:C3:97:3E

Now create a new text file named /etc/hostapd/wpa_psk and paste your pass phrase as:

00:00:00:00:00:00 PASSPHRASE

Turn on the routing engine

echo 1 > /proc/sys/net/ipv4/ip_forward

Create the routing rule

route add -net 192.168.70.0 netmask 255.255.255.0 gateway 192.168.70.7 dev eth0

Firmware update

Prism2/2.5/3 cards and Host AP driver support two different mechanism of upgrading the card firmware. Firmware images (primary and station) can be downloaded either into volatile memory (RAM download) or non-volatile memory (flash upgrade). Firmware images downloaded into volatile memory are lost when the card is resetted, so they are quite safe. Flash upgrade with incorrect images may cause permanent problems (i.e., render the card useless), so certain amount of caution is always recommended for this.

Check your existing firmware

hostap_diag wlan0

I downloaded the softmac firmware and placed it in

mv 2.13.12.0.arm /usr/lib/hotplug/firmware/isl3890