/ Raspberry Pi

Access Point on Raspberry Pi

RPI3 has build-in WiFi, RPI2 can be easily extended with WiFi adapter. Such adapter can be configured to connect to access point or act as access point itself.

There is the good instruction on the Raspberry Pi website[1] on how to create access point. Just in case it would not work, there is an extended version with troubleshooting.

Before configuring the device, make sure that you have latest software and packages:

$ sudo apt-get update
$ sudo apt-get dist-upgrade

Install required software packages:

  • dnsmasq - package that provides DHCP server and DNS cache
  • hostapd - authenticates wireless clients
$ sudo apt-get install dnsmasq hostapd

The packages are started automatically, but as they are not configured yet, it is better to turn them off:

sudo systemctl stop dnsmasq
sudo systemctl stop hostapd

The wireless interface is need to be configured. By convention, there are a few networks devoted to private use[2], among them 192.168.x.x. In fixed networks, where the assumption can be made about the network structure, the network addresses can be specified statically. For that make sure that corresponding wlan interface settings are configured in the file /etc/network/interfaces:

allow-hotplug wlan1
iface wlan1 inet static
  metric 100

where wlan1 is the wireless interface (second adapter) I would like to connect. In case of only one adapter installed, the interface name is wlan0. is the address and defines the address space of the network.

Now rename the existing dnsmasq configuration:

$ sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig  

and create the new one that specifies the interface and the IP address range:


Normally, DHCP client gets the settings and reconfigures the interface IP address and other properties. This is need to be avoided (as DHCP serviec will be provided by the interface itself) by adding to the file /etc/dhcpcd.conf instruction:

denyinterfaces wlan1

Preparation is done so now the access point itself can be configured. For this create the file /etc/hostapd/hostapd.conf with the following configuration settings:


Set the option DAEMON_CONF in the file /etc/default/hostapd. Uncomment it if necessary. Strangely enough, it does not with quoted path, as set in the official guide.


Now start the services:

$ sudo service hostapd start
$ sudo service dnsmasq start

The access point should appear in the list of available WiFi networks and connecting to it with the specified password should be successful.

  1. SETTING UP A RASPBERRY PI AS AN ACCESS POINT IN A STANDALONE NETWORK, https://www.raspberrypi.org/documentation/configuration/wireless/access-point.md ↩︎

  2. IPV4 PRIVATE ADDRESS SPACE AND FILTERING, https://www.arin.net/knowledge/address_filters.html ↩︎

Alex Netkachov

Alex Netkachov

Alex Netkachov is a Senior Software Developer, currently working in Central London on new generation of energy trading solutions for brokers, traders and exchanges.

Read More

Why not to chat about this post? Join Telegram group Alex@Net or message on Twitter to alex_at_net. Alternatively, use the comments form below.