Raspberry Pi Wireless Access Point

A Raspberry Pi wireless access point is a great way to extend the length of your Wi-Fi coverage and provide additional access into your network.

Raspberry Pi WiFi Access Point VPN v3

In this tutorial, we will show you how to set up a wireless access point, and how to configure the multiple packages that allow users to connect to your access point as if it was a router itself.

You will need to keep in mind that a Wi-Fi dongle most likely won’t be able to handle as much traffic as a regular router. Meaning you should avoid allowing too many connections to the device to stop it from becoming too overburdened and slow.

While you can use any Wifi dongle that supports being enabled as an access point our tutorial will directly focus on how to set this up for the Raspberry Pi 3’s Wi-Fi Module. If you are using an earlier model of the Raspberry Pi you can purchase a Wi-Fi adapter that supports being utilized as an access point from numerous websites, make sure you research before buying to make sure it works on the Raspberry Pi.

This tutorial can be combined well with our VPN Access Point tutorial. The VPN access point tutorial will show how to set up an OpenVPN client and redirect all traffic through that client.

Equipment List

Below are all the bits and pieces that I used for this Raspberry Pi Wireless Access Point tutorial, there is nothing super special that you will need to be able to complete this.



Setting up the Wireless Access Point

As with most tutorials I do, this one just uses a clean version of Raspbian that has been updated to the latest packages.

To set up the Raspberry Pi wireless access point we will be making the use of two packages. These two packages are hostapd and dnsmasq. hostapd is the package that allows us to utilize a Wi-Fi device as an access point, in our case, we will be utilizing this to turn the Raspberry Pi 3’s Wi-Fi into our access point.

dnsmasq acts as both a DHCP and DNS server so that we can assign IP addresses and process DNS requests through our Raspberry Pi itself.

Luckily dnsmasq is easy to set up and configure. It also has the advantage that it is somewhat lightweight in comparison to isc-dhcp-server and bind9 packages.

Remember for this you will need to be utilizing an ethernet network connection and not your Wi-Fi connection.

1. Before we get started installing and setting up our packages, we will first run an update on the Raspberry Pi by running the following two commands.

sudo apt update
sudo apt upgrade

2. With that done we can now install our two packages, run the following command to install hostapd, dnsmasq and iptables.

sudo apt install hostapd dnsmasq iptables

3. Now that we have the packages installed we don’t want them running yet as we haven’t configured them correctly.

Stop the packages from running by utilizing the following two commands in the terminal. These commands will tell the system manager to stop the dnsmasq and hostapd services.

sudo systemctl stop hostapd
sudo systemctl stop dnsmasq

4. With hostapd and dnsmasq now stopped we will want to modify our dhcpd configuration so that we can take control of the wlan0 interface.

With this file, we will be setting ourselves a static IP Address as well as telling it not to make use of the wpa_supplicant file so we can configure it purely as an access point to our device.

Run the following command on your Raspberry Pi to begin modifying the dhcpcd.conf file.

sudo nano /etc/dhcpcd.conf

5. Within this file we need to add the following line to the bottom, this will set up our wlan0 interface to the way we want it for our tutorial.

If you have upgraded to Raspbian Stretch then wlan0 may need to be changed, if you are using the Raspberry Pi 3 or the Pi Zero W’s inbuilt wifi you can continue using wlan0. Use the ifconfig command to see what the new names are, they’re likely quite long. You will need to update any reference to the new values throughout this tutorial.

interface wlan0
    static ip_address=
    nohook wpa_supplicant

Now we can save and quit out of the file by pressing Ctrl +X then pressing Y and then Enter.

6. Now we need to restart our dhcpd service so it will load in all our configuration changes. To do this run the following command to reload the dhcpd service.

sudo systemctl restart dhcpcd

7. Next, we need to adjust our hostapd configuration, to do this we need to begin editing the config file with the following command.

sudo nano /etc/hostapd/hostapd.conf

8. In this file we need to write out the following lines, these basically set up how we want to interact with the wlan device. The only real lines you should worry about in this file is the ssid= line and the wpa_passphrase= line.

As a general rule of thumb, you should try and make your WPA Passphrase longer than 6 characters to help keep your connection secure.

NOTE: If you are doing this tutorial with a different Wi-Fi device then the inbuilt Pi 3 one, you may have to also change the driver= line to the best driver for your device, Google will be your friend for working out what the best driver to use is.




# This is the name of the network
# The network passphrase

Remember to change wpa_passphrase to your own password, make sure you set it to something secure so random people can’t just connect into your Wi-Fi access point.

Now we can save and quit out of the file by pressing Ctrl +X then pressing Y and then Enter.

9. With that done we should now have our hostapd configuration, but before it can be used we need to edit two files. These files are what hostapd will read to find our new configuration file.

To begin editing the first of these two files run the following command.

sudo nano /etc/default/hostapd

10. In this file, we need to find the following line and replace it.



Replace with:


Now we can save and quit out of the file by pressing Ctrl +X then pressing Y and then Enter.

11. Now we need to edit the second configuration file, this file is located within the init.d folder. We can edit the file with the following command:

sudo nano /etc/init.d/hostapd

12. In this file, we need to find the following line and replace it.



Replace with:


Now we can save and quit out of the file by pressing Ctrl +X then pressing Y and then Enter.

13. With hostapd now set up, we need to move onto setting up dnsmasq. Before we begin editing its configuration file we will rename the current one as we don’t need any of its current configurations.

We can do this with the following mv command on our Raspberry Pi.

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

14. Now that the original configuration file has been renamed we can begin by creating our own new configuration file. We will create and edit the new file with the nano command.

sudo nano /etc/dnsmasq.conf

15. To this file add the following lines.

These lines tell the dnsmasq service how to handle all the connections coming through and what interface it should be handling them for.

interface=wlan0       # Use interface wlan0  
server=       # Use Cloudflare DNS  
dhcp-range=,,12h # IP range and lease time  

Now we can save and quit out of the file by pressing Ctrl + X then pressing Y and then Enter.

16. Next, we need to configure your Raspberry Pi so that it will forward all traffic from our wlan0 connection over to our ethernet connection.

First, we must enable it through the sysctl.conf configuration file, so let’s begin editing it with the following command.

sudo nano /etc/sysctl.conf

17. Within this file, you need to find the following line and remove the # from the beginning of it.



Replace with:


18. Now since we are impatient and don’t want to wait for it to enable on next boot we can run the following command to activate it immediately.

sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"

19. With IPv4 Forwarding now enabled we can configure a NAT between our wlan0 interface and our eth0 interface. Basically, this will forward all traffic from our access point over to our ethernet connection.

Run the following commands to add our new rules to the iptable.

sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

20. The iptable is flushed on every boot of the Raspberry Pi so we will need to save our new rules somewhere so they are loaded back in on every boot.

To save our new set of rules run the following command.

sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"

21. Now with our new rules safely saved somewhere we need to make this file be loaded back in on every reboot. The most simple way to handle this is to modify the rc.local file.

Run the following command to begin editing the file.

sudo nano /etc/rc.local

22. Now we are in this file, we need to add the line below. Make sure this line appears above exit 0. This line basically reads the settings out of our iptables.ipv4.nat file and loads them into the iptables.


exit 0

Add above “exit 0”:

sudo hostapd /etc/hostapd/hostapd.conf &
iptables-restore < /etc/iptables.ipv4.nat

Now we can save and quit out of the file by pressing CTRL + X then pressing Y and then ENTER.

23. Finally, all we need to do is start the two services and enable them in systemctl. Run the following two commands.

sudo systemctl unmask hostapd
sudo systemctl enable hostapd
sudo systemctl start hostapd
sudo service dnsmasq start

24. Now you should finally have a fully operational Raspberry Pi wireless access point, you can ensure this is working by using any of your wireless devices and connecting to your new access point using the SSID and WPA Passphrase that was set earlier on in the tutorial.

To ensure everything will run smoothly it’s best to try rebooting now. This will ensure that everything will successfully re-enable when the Raspberry Pi is started back up. Run the following command to reboot the Raspberry Pi.

sudo reboot

This is yet another great project for the Raspberry Pi that can be extended to make it an extremely useful utility. As I mentioned above you can make this a WiFi access node where you can route all the internet traffic through a VPN.

I hope this Raspberry Pi Wireless access point tutorial has helped you be able to expand your wireless network. If you come across any issues or have some feedback related to this tutorial, then please don’t hesitate to leave a comment below.


  1. Avatar for Dmitry
    Dmitry on

    I have tried your tutorial an many others.
    Sadly to say, but they are not working for me and I don’t know why.
    I have Raspberry Pi 3 with inbuild wi-fi, driver – brcmfmac.

    Any suggestions to locate and fix the problem?

  2. Avatar for Techguy
    Techguy on

    Hi this worked great for me literally opened this guid on raspbian browser then open up terminal copy and past everything reboot and bingo.. same as the vpn guide..

    One question. now have a USB to Ethernet adapter any tips on setting it up so I can connect a device to it through vpn? Didn’t want to tamper with anything in case I cause problems.


  3. Avatar for gashah143
    gashah143 on

    Hi, Based on your Tutorials I wanted to Set up OwnCloud & I also want to set up pi3 Access Point. can you tell me how to do port forwarding for owncloud so that I can connect Ethernet Cable to pi3 & enable wifi AP to use internet on other devices as well as to use pi3 for hosting owncloud server.

    It will be great help if you can provide step by step instructions for setting up OwnCloud & wifi AP in one tutorial.

    Basically i want to plug my ISP ethernet Cable directly to pi3 then want to use it as wifi AP & Server.

  4. Avatar for sabri
    sabri on

    Hi Gus
    Can you do a video explaining how to used the pi as a Hotspot provide wifi? And control the time and amount wifi?

  5. Avatar for Dmitriy
    Dmitriy on

    Really nice and useful tutorial! Thank you!
    I have created the wi-fi point and it really works well, also i have found a way to set a transmit power of wi-fi :
    iwconfig wlan0 txpower 10

    And my goal is to create a WiFi point for children via which they will be able to connect to a few sites only (the facebook and some training sites)
    I have played around with iptables (a few days) – but the only thing i have got, fully drop connection to any site or allow connection to all sites((

    If you may give an advice or help i would be very thankful!

  6. Avatar for Fred
    Fred on

    Awesome! Thank you for this.

  7. Avatar for Ryan
    Ryan on

    Hey there – when I get to step 10 I am running into a snag — there appears to be an empty file when is run *sudo nano /etc/default/hostapd* — is there something I’m missing? Can I just type in *DAEMON_CONF=”/etc/hostapd/hostapd.conf* even though there’s nothing else in the file? Thanks.

  8. Avatar for Joshua
    Joshua on

    Can you help me find the wifi driver for (broadcom 802.11 n wifi adapter)?.

    From Question 9. the driver=.

  9. Avatar for Evan Thompson
    Evan Thompson on

    Fantastic site, I’ve been looking for clear guides to these projects for what seems years.

    Unfortunately, I have an error when I get to
    sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

    I get the following response:
    modprobe: ERROR: ../libkmod/libkmod.c:557 kmod_search_moddep() could not open moddep file ‘/lib/modules/4.4.50-v7+/modules.dep.bin’
    iptables v1.4.21: can’t initialize iptables table `nat’: Table does not exist (do you need to insmod?)
    Perhaps iptables or your kernel needs to be upgraded.
    Does anyone has any idea of what I’m doing wrong?
    I’m running a Raspberry Pi v2 with an Edimax wifi adaptor.
    When it came to the driver under step 9 I left it at n180211 since I couldn’t find anything else suggested on the Internet to use.

    1. Avatar for jason
      jason on

      I amping the same problem, any ideas

    2. Avatar for Jason
      Jason on

      Solved with Reboot

    3. Avatar for Ryan
      Ryan on

      I’m having the exact same issue – have you managed to get it resolved yet??

    4. Avatar for Evan Thompson
      Evan Thompson on

      Yes, have now solved it thanks to Jason’s suggestion of a reboot.
      It seems may need to reboot between step 19 and 20.
      I have been able to log into the Pi access point using a Roku stick and play Netflix.

  10. Avatar for Jhonathan Chicas
    Jhonathan Chicas on

    Hi Gus as always your tutorials are on point but I was wondering if theres anything I can do to add QoS to the pi, see the problem is that when my Monster-inlaw comes home her ipad sucks all my bandwidth or even my kids with youtube and then if Im playing bf4 or any fps my connection gets dropped cuz of the high latency.

    Thank you.

  11. Avatar for Daniel
    Daniel on

    The rasp Is not giving me IP for some reason? any help

    1. Avatar for Axel
      Axel on

      I’m having the same problem, when i try to connect to the wifi, the raspberry seems not to be able to give me an IP adress. Any idea how to fix this?

    2. Avatar for Gus
      Gus on

      Hi Daniel,

      This appears to be a reoccurring issue at the moment. I will revisit this tutorial once I have the next book update out to see if I can reproduce the issue and will reply again if I manage to reproduce it and fix it.


    3. Avatar for Jason
      Jason on

      I had (have?) the same issue and so far stopping and then starting the `hostapd` and `dnsmasq` services has done the trick to have it pass out an IP.

      Hope that helps!

  12. Avatar for Michael
    Michael on

    How do I find my device= name (shown in step 9) for my Ethernet connected pi 3?

  13. Avatar for Lou
    Lou on

    Hey there!
    After trying two different Pis (RPi 1 model B and RPi 3) it seems I keep running into the same problem. For starters, I notice I do not have a /etc/hostapd/hostapd.conf file after installing hostapd. Consequently, the ssid is not being broadcast, and running ‘$ sudo system status dnsmasq’ shows ‘…> hostapd[1096]: Starting advanced IEEE 802.11 management: hostapd failed!’

    Gus, which version of raspbian are you running? I am using the Jessie Lite release on 2017-04-10, which may be the culprit. Any idea where I can find a stable previous release??
    A side note– i tried another tutorial that uses hostapd and the isc-dhcp-server, but requires the May 2016 release to work. Its been a week and I can’t seem to catch a break!

    Keep up the good work!

    1. Avatar for Bill
      Bill on

      Hi, I was wondering if you have solved not have having the follow: /etc/hostapd/hostapd.conf I have the same issue. I’m using RPi3

  14. Avatar for Ethan
    Ethan on

    Will this bog down my pi? Also, I have poor wifi connection where I want to use this and no ethernet connection. Will this work with no ethernet and 1-2 bars of wifi?

  15. Avatar for Brayden
    Brayden on


    Are you able to make a raspberry pi 3 both a wireless ap as well as a plex server? Essentially I want to be able to have my plex server mobile and able to stream to my mobile devices while on a road trip.

    If this is possible could you maybe make a streamlined tutorial on how to do this? Thanks

    1. Avatar for Gus
      Gus on

      This in theory should work just fine but something I haven’t been able to test. I will see if i can take a look at it sometime in the near future.

  16. Avatar for Ali
    Ali on

    HI Gus. Just a question. Can the pi be used as a Hotspot but still provide free wifi? Thanks, ali
    Can you also do a video?

  17. Avatar for malik
    malik on

    hi again, after typing the following lines as in step 6 :

    allow-hotplug wlan0
    iface wlan0 inet static
    # wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

    and when comming to step 7 , it said
    “ifdown: interface wlan0 not configured ” any help please ?

    1. Avatar for Sourabh
      Sourabh on

      I ran into the same problem too. Any help would be appreciated.

    2. Avatar for Magnus
      Magnus on

      I have the same problem.
      How did the rest of you fix this or did you not receive this error message:
      “ifdown: interface wlan0 not configured”?

    3. Avatar for cgenco
      cgenco on

      I had this because WiFi was off. I had turned it off when I plugged in the Ethernet cable.

    4. Avatar for Scott
      Scott on

      I had this issue with Raspian Jessie on RaPi3. If the interface wlan0 isn’t present when doing an ifconfig -a run sudo rpi-update

      It downloaded a firmware update and for me after a reboot wlan0 was present.

  18. Avatar for P. Lyons
    P. Lyons on

    Can this tutorial be done using only the wifi connection of the Pi? I see that the ethernet connection is used at the beginning, but is that only to download the packages?

  19. Avatar for Joshua
    Joshua on

    Can I replace the Ethernet cable with another Wifi dongle?
    And if so do you know how?

    1. Avatar for Gus
      Gus on

      This is possible, however WiFi to Wifi can be incredibly slow. I will need to look into it and test it. Once I have done that I will provide you with the steps. (I think it’s pretty easy)

    2. Avatar for Picard
      Picard on

      I just tried it and the speed is not too bad. Used logiLink wl0084a und just replaced the eth0 with wlan1

  20. Avatar for malik
    malik on

    hi , thanks for this post. I would like to ask if o could build the same project using a raspberry Pi 1 i have ?

    1. Avatar for Gus
      Gus on

      Yes it should work fine but make sure your WiFi dongle can act as a wireless access point. Keep in mind I haven’t tested this on any version other than the Raspberry Pi 3 so you might (but shouldn’t) run into problems.

Leave a Reply

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