Access Point - hostapd

Howto create a WLAN Access-point with the hostapd software

Check, if your wifi card is supported

Find kernel driver:

lspci -k | grep -A 3 -i "network"

Look for the driver in the output: “Kernel driver in use: ath9k”

Check, if the output contains a driver supported by hostapd

modinfo ath9k | grep 'depend'

“depends: ath9k_hw,mac80211,ath9k_common,ath,cfg80211”

..in this case, “mac80211” is supported

Install hostapd and dnsmasq dhcp server

apt-get update
apt-get install hostapd dnsmasq rcconf

Configure hostapd

Edit /etc/hostapd/hostapd.conf

First test:

#change wlan0 to your wireless device
interface=wlan0
driver=nl80211
ssid=test
channel=1 

Scan for wlans and check, if the SSID “test” is visible.

Complete config

Change SSID, wpa_passphrase and channel:

interface=wlan0
driver=nl80211
ssid=NAME-OF-ACCESS-POINT
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=PASSWORD-HERE
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

Configure network interfaces

Edit /etc/network/interfaces:

auto lo
# configure LAN for DHCP autoconf:
iface lo inet loopback
iface eth0 inet dhcp

# set a static IP for the WLAN card:
iface wlan0 inet static
address 10.0.0.1
netmask 255.255.255.0

# address of the uplink-router 
gateway 192.168.1.1

Configure dnsmasq

dnsmasq is used, because it is easier to configure than dhcpd

Edit /etc/dnsmasq.conf and add:

# disables dnsmasq reading any other files like /etc/resolv.conf for nameservers
no-resolv
# Interface to bind to
interface=wlan0
# Specify starting_range,end_range,lease_time
dhcp-range=10.0.0.3,10.0.0.20,12h

# dns addresses to send to the clients
# GOOGLE DNS-SERVERS are used here for testing! - you can set this to DNS servers of your provider or use your gateway
server=8.8.8.8
server=8.8.4.4

Init script to start hostapd on boot

Download this init script: hostapinit.txt and save it to /etc/init.d/hostapdinit

Run the rcconf runlevel init script configuration tool and enable “hostapdinit”

rcconf

reboot & good luck

Source

 
Back to top
linux/network/access_point_-_hostapd.txt · Last modified: 2013/09/11 23:56 by tkilla