Third party cookies may be stored when visiting this site. Please see the cookie information.

Setting up the Raspberry Pi as a host wireless hotspot

This guide is how to turn a Raspberry Pi into a host Wireless WiFi hotspot. First what does that mean?

This will not turn your Pi into a wireless router (although you'd be half-way there), but instead provides a way to connect and control a Raspberry Pi using a dedicated wireless network. The reason I wanted this was to control my Raspberry Pi powered robot. Originally the Raspberry Pi robot was configured to connect to my existing home WiFi network, which worked great at home, but meant that if I took the robot out to show at a Raspberry Jam (such as PyCON UK Raspberry Jam in Coventry) then I would either need to take my wireless network with me, or find a wireless network at the event and reconfigure Raspbian to use the wireless network provided. This is similar to how the GoPro Hero 3 camcorders work.

Raspberry Pi Wireless Robot

This is based on the Raspbian image on the NOOBs SD card. This is easiest using a serial connector connecting to the GPIO ports, but can be done by switching between the keyboard and USB WiFi dongle when required or by using a USB hub.

In my case I used a USB serial connector on Linux and connected using

screen /dev/ttyUSB0 115200

First make sure your Raspbian distribution is up-to-date.

sudo apt-get update

sudo apt-get dist-upgrade

Check your wireless dongle supports AP mode (Access Point)

It's a good idea to check that the wireless dongle is able to support Access Point mode (WAP). Most do, but there are some dongles around that do not. This is not actually required if you know your dongle definitely supports this, but there is no harm in doing it anyway.

First install the iw utility which is used to query the wireless adapter.

sudo apt-get install iw

List the features of the wireless dongle

iw list

And check for an entry relating to AP mode:

        Supported interface modes:

                 * IBSS

                 * managed

                 * AP

                 * AP/VLAN

                 * WDS

                 * monitor

                 * mesh point

If this scrolls off the screen too fast you can view it through less using

iw list | less

use the cursors to move around and press q when complete.

Set Raspberry Pi to use static P address

We are going to use one of the reserved IP address ranges, but avoiding the more common ranges so that it is possible to control the robot from a computer with two interfaces. We will therefore use the network and set the IP address of the Raspberry Pi to

Edit the interfaces file

sudo nano /etc/network/interfaces

Remove the dhcp entry

iface default inet dhcp

and instead add the lines below

iface wlan0 inet static



This configures the Raspberry Pi with a static IP address.

Add access point and DHCP server software

Assuming the dongle supports wireless mode we can proceed to adding the relevant software. We will be using hostapd to provide the access point function and adding a DHCP server isc-dhcp-server which will give out IP addresses to devices that connect.

sudo apt-get install hostapd isc-dhcp-server

You will get an error saying unable to start the dhcp server. This is because we have not yet configured the server, don't worry once it is all configured you shouldn't get that message any more.

Configuring the DHCP server

Now we will configure the dhcp server so it is ready when we configure the access point.

Edit the /etc/dhcp/dhcpd.conf file - eg.

sudo nano /etc/dhcp/dhcpd.conf

Comment out the domain name servers as we don't need them for this set-up. They can be commented out by adding a hash character at the start of each line.

#option domain-name "";

#option domain-name-servers,;

Make the authoritative by un-commenting (removing the # character) entry:

# If this DHCP server is the official DHCP server for the local

# network, the authoritative directive should be uncommented.


Edit the section titled

# A slightly different configuration for an internal subnet.

I have created a large subnet (254 addresses, but set it so it can give out 50 entries) this is far more than we need for this.

# A slightly different configuration for an internal subnet.

subnet netmask {


  option routers;

  option broadcast-address;

  default-lease-time 600;

  max-lease-time 7200;


Now edit the default start script

sudo nano /etc/default/isc-dhcp-server

Change interfaces to


The dhcp server is configured.

Configure the Raspberry Pi as a Wifi Access Point (WAP)

Now to configure the access point.

Create and edit a new file: /etc/hostapd/hostapd.conf

add the following, replacing <ssidname> and <passphrase> as appropriate

# Host access point config file 

# device name 


# Driver interface


# SSID for the network


# set appropriate country parameters (maybe required for regulatory reasons)


# Operation mode - for 802.11n still use g to indicate using same band as g devices


# set channel - channel=0 for Automatic Channel Select


# mac address access list - 0 = accept unless in deny


## add deny rules here if required


# Use shared key authentication


# Enable WPA2


# set passphrase




# Pairwise cipher for WPA (v1) 


# Pairwise cipher for RSN/WPA2 


Finally edit the default startup file for hostapd

sudo nano /etc/default/hostapd

Add entry



Now reboot the Raspberry Pi and you should be able to see the new wireless network on another device (eg. Mobile phone / tablet) and connect to it. You should then be able to ssh to the Raspberry Pi @ If there is a problem then look at the appropriate section. For example if you cannot see the wireless network check the WAP settings, if you see the wireless network, but you don't get an IP address then check the DHCP settings etc.

» PenguinTutor Facebook page