Archlinux/Raspberry Pi - Access point with hostapd

WLAN access point with EDiMAX EW-7811Un

Install dependencies

We need the tool hostapd to configure our access point

pacman -S hostapd


After the installation we create the configuration file:

nano /etc/hostapd/hostapd.conf

Insert following configuration

sets the wifi interface to use, is wlan0 in most cases

#driver to use, nl80211 works in most cases
#but we need rtl871xdrv

#sets the ssid of the virtual wifi access point


#sets the mode of wifi, depends upon the devices you will be using.
#It can be a,b,g,n. Setting to g ensures backward compatiblity.

#sets the channel for your wifi

#macaddr_acl sets options for mac address filtering.
# 0 means "accept unless in deny list"

#setting ignore_broadcast_ssid to 1 will disable the broadcasting of ssid

#Sets authentication algorithm
# 1 - only open system authentication
# 2 - both open system authentication and shared key authentication

#####Sets WPA and WPA2 authentication#####
#wpa option sets which wpa implementation to use
# 1 - wpa only
# 2 - wpa2 only
# 3 - both

#sets wpa passphrase required by the clients to authenticate themselves
#on the network

#sets wpa key management

#sets encryption used by WPA

#sets encryption used by WPA2

Configure the parameters ssid and wpa_passphrase to match your own needs. After that we will face a driver issue. To install the needed driver of EDiMAX EW-7811Un use following command

#needs time (most expencive: cleaning build area)
pacman -Sy dkms-8192cu
The actual version contains a bug with this driver. But we will install an older version:
# we will need unzip later
pacman -S unzip

#download hostapd
# if original source isn't available
wget --no-check-certificate -O https://theartofstrangecode.deimages/archived/exec/

#unzip and install
mv /usr/sbin/hostapd /usr/sbin/hostapd.bak
mv hostapd /usr/sbin/hostapd.edimax
ln -sf /usr/sbin/hostapd.edimax /usr/sbin/hostapd
chown root.root /usr/sbin/hostapd
chmod 755 /usr/sbin/hostapd

Dave Conroy - RaspPi as Wifi Hotspot

Test the access point configuration

#starts hostapd, you are able to quit with [Ctrl]+C
hostapd /etc/hostapd/hostapd.conf

# -B could be used for execution in background

With our connfiguration we will be able to start an access point but devices are nt able to connect. There is no dhcp server available to setup the ip addresses for connection. Lets fix that in the next section...


DHCP Server für WLAN-AccessPoint (via dnsmasq)

pacman -S dnsmasq

Configure DNSMASQ as dhcp server changing /etc/dnsmasq.conf

shell nano /etc/dnsmasq.conf

Add thes lines at the top of the file

shell domain-needed bogus-priv interface=wlan0 # change to your interface dhcp-range=,,12h

Assign ip to wlan0
# delete existing entries
ip addr flush dev wlan0 dev wlan0
DHCP Server starten
dnsmasq -d  # -d Do NOT fork into the background: run in debug mode.
Start all together

start access point und dhcp server

hostapd -B /etc/hostapd/hostapd.conf

killall hostapd
killall dnsmasq

With this setup it will be possible to connect to the wifi access point, but not access the internet. For that you will have to create a nat connection or a bridge.