Skip to content

Set up Raspberry Pi as Wireless Access Point

Being able to connect to your Raspberry Pi through WiFi and either extend your home network or have a direct connection with your Pi is a pretty simple, but powerful use case for any Pi model. You can use it as WiFi Hotspot, which means the Raspberry Pi acts as a bridge between your (mobile) device and the Internet connection at home.


What you need:

  • A Raspberry Pi with [tooltip tip=”Operating System”]OS[/tooltip] (any model)
  • A USB WiFi connector which support AP mode
  • An Internet connection (via Ethernet)

Note: You should select a central position for the Pi to have a good WiFi coverage of the area.

Installation and Setup

You need to operate either directly on the Pi or have an SSH connection. Once you can access the console, you should update the packages and the OS with

sudo apt-get update
sudo apt-get dist-upgrade
sudo rpi-update
sudo reboot

Now that you have an updated system, we check if the WiFi connector gets detected by the system by entering lsusb.


For me, it is this entry:

Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]

Next, let’s install the required software.

sudo apt-get install hostapd dnsmasq

Setup Access Point

The next step is to assign a static IP to our WiFi connector. You need to edit the file
(needs root). The content should look like this:

auto lo
iface lo inet loopback

# ...
iface wlan0 inet static

Make sure you use wlan0 only once in the file.

Next, we set up hostapd. Edit the file /etc/default/hostapd

# 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

# Additional daemon options to be appended to hostapd command:-
#    -d show more debug messages (-dd for even more)
#    -K include key data in debug messages
#    -t include timestamps in some debug messages
# Note that -B (daemon mode) and -P (pidfile) options are automatically
# configured by the init.d script and must not be added to DAEMON_OPTS.

Edit the first line which does not start with # (which is a comment). Set DAEMON_CONF to “/etc/hostapd/hostapd.conf”. This will be our configuration file for hostapd, which we will create next.

You can create your own configuration or just copy mine below:

# The used interface
# Important! This is the driver used. This one is for Realtek only.

# Daemon settings

# WiFi configuration
ssid=My Pi

# Security setting
# Change the password here!!!

# set this to US or whatever country you are in

Important: Hold in mind that you are not allowed to put spaces before or after the equal signs.

DHCP settings

Next we need to assign an IP to all devices which connect to the access point. So edit the dnsmasq configuration file located in


# 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.
# Connected devices get an ip from the given range which is valid for 12 hours.
# ...

Now you only need to restart both services and you should be able to connect to the Pi.

sudo service hostapd restart
sudo service dnsmasq restart

There you are. Now you can access the Raspberry Pi by connecting to the WiFi and using the Pi’s static address to ssh into it. For Internet access, you need to use iptables and configure them to forward any packages from wlan0 to eth0.

Published inTechnology


  1. lalit

    Hi I am using Pi 3 but unable to hide the SSID even I have set following parameter in /etc/hostapd/hostapd.conf


Leave a Reply

Your email address will not be published. Required fields are marked *