Hostap

From SaruWiki
Revision as of 23:30, 26 October 2008 by Insomnia (talk | contribs)
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

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