Creating an WLAN access point with your Raspberry Pi


Content Contributer
Install required packages:

sudo apt-get install hostapd dnsmasqSet static ip to your wlan interface:

nano /etc/network/interfacescontent: (check for a single wlan0 entry!)

iface wlan0 inet static
netmask a configuration to hostap:

nano /etc/default/hostapdcontent: (add config file line):

# Defaults for hostapd initscript
# See /usr/share/doc/hostapd/README.Debian for information about alternative
# methods of managing hostapd.
# Uncomment and set DAEMON_CONF to the absolute path of a hostapd configuration
# file and hostapd will be started during system boot. An example configuration
# file can be found at /usr/share/doc/hostapd/examples/hostapd.conf.gz
DAEMON_CONF="/etc/hostapd/hostapd.conf"If you are not sure what driver is needed check your usb devices (driver name will be disbplayed)

lsusb -t
lsusb -t
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
|__ Port 1: Dev 2, If 0, Class=vend., Driver=smsc95xx, 480M
|__ Port 5: Dev 3, If 0, Class=vend., Driver=rtl8192cu, 480M
Create hostapd.conf:

nano /etc/hostapd/hostapd.confcontent:

# interface for ap
# driver of wlan stick


# wlan ap configuration

# wlan security

# country code
Add dnsmasq configuration:

nano /etc/dnsmasq.confContent: (two important lines)

# Configuration file for dnsmasq.

# If you want dnsmasq to listen for DHCP and DNS requests only on
# specified interfaces (and the loopback) give the name of the
# interface (eg eth0) here.
# Repeat the line for more than one interface.

# Uncomment this to enable the integrated DHCP server, you need
# to supply the range of addresses available for lease and optionally
# a lease time. If you have more than one network, you will need to
# repeat this for each network on which you want to supply DHCP
# service.
#set default gateway (if wanted)

Restart services:

sudo service hostapd restart
sudo service dnsmasq restart
Enable IP forwarding:

nano /etc/sysctl.confUncomment:

# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1Activate settings:

sudo sysctl -p
Setup forwarding rules:

nano /etc/network/if-up.d/apforwarding && chmod +x /etc/network/if-up.d/apforwarding content:

# !/bin/sh
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables --append FORWARD --in-interface wlan0 -j ACCEPT
Reboot your Raspberry Pi.


Just a dude
vpsBoard Founder
Oh snap.... how did I never catch this before? Gosh, I've been so busy lately. I've been looking for a good tutorial on this, as everyone I've ever found, for one reason or another, has failed me in the past.

When I get some free time I plan on reorganizing some things at home and one of the things on my 'to do' list is get one of my Pi's back up. I'll report back!


100% Tier-1 Gogent
This is a good tutorial I need to bookmark already.

Been doing more and more with ARM platform.  Nothing mega exciting, but more.  Using them more than VPS / dedis these days.


As a directly-related inquiry: Are there any USB based wireless adapters that have better features than, say, this weeks' RealTek? Any that let you bond multiple MAC addresses to? How about throughput? I have some ~150/300/600 and AC plausible devices, but even under x86 Linux, they tend to fall flat due to software fifo issues and unreliable binary blob resources. I've had very good results with Atheros based- but those have mostly been used on my MIPS projects, not ARM.