A Raspberry Pi wireless access point is a great way to extend the length of your Wi-Fi coverage and provide additional access to your network.
This tutorial will show you how to set up a Wi-Fi access point using your Raspberry Pi. A wireless access point sometimes goes by “hotspot”, but it is essentially the same thing.
The process of setting up your Pi as a Wi-Fi hotspot has been made simple thanks to the Pi’s usage of the Network Manager. Older methods used to require you to configure several pieces of software that could prove quite unstable.
One crucial thing to remember is that your Raspberry Pi’s inbuilt Wi-Fi or a Wi-Fi dongle will most likely not be able to handle as much traffic as a regular router. This means you should avoid allowing too many connections to the device to prevent it from becoming overburdened and slow.
While you can use any Wi-Fi dongle that supports being enabled as an access point, our tutorial will directly focus on how to set this up for the Raspberry Pi’s built-in Wi-Fi module. If you are using an early 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 Pi.
Additionally, the newer the Raspberry Pi, the better experience you will have with setting up an access point. Newer Pi’s have better processing power and have had improvements to how it’s networking works at a hardware level.
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 we used for this Raspberry Pi Wireless Access Point tutorial. You will not need anything super special to complete this guide.
Recommended
- Raspberry Pi ( Amazon | SunFounder )
- Micro SD Card ( Amazon | SunFounder )
- Power Supply ( Amazon | SunFounder )
- Wi-Fi ( Amazon | SunFounder )
- Ethernet Cable ( Amazon )
Optional
- Raspberry Pi Case ( Amazon | SunFounder )
This tutorial was last tested on a Raspberry Pi 5, running the latest version of Raspberry Pi OS Bookworm.
Setting up a Wi-Fi Access Point using your Raspberry Pi
In this section, we will walk you through the super simple method of setting up your Raspberry Pi’s Wi-Fi as an access point.
Thanks to the new versions of Raspberry Pi OS using Network Manager to manage the network stack, setting up a hotspot from your Raspberry Pi is as simple as running a couple of commands. If you are running a version of Pi OS without Network Manager, follow our instructions for installing it.
Before proceeding, you will want to have your Pi plugged into an ethernet connection. This will offer you the best performance, and we expect you to have your Pi set up this way for the following steps.
If you want to extend an existing Wi-Fi network using your Pi, we recommend checking out our Raspberry Pi Wi-Fi extender guide.
Preparing your Pi
1. Before we set up the Raspberry Pi as a Wi-Fi access point, you will want to ensure that you are running an updated operating system. This ensures that we have the latest version of Network Manager.
Use the following two commands to update the package list cache and upgrade any out-of-date packages.
sudo apt update
sudo apt upgrade -y
The first command updates the package list cache. This cache contains a list of the packages you can install, their version, and where apt can download them.
The second command uses the updated package list cache to find and update any out-of-date packages.
Getting the Wi-Fi Device to Hotspot from on your Raspberry Pi
2. With your Raspberry Pi now up to date, you will need to get the name of your Wi-Fi device so you can hotspot from it.
Your Wi-Fi adapter will need to support access point mode, which luckily for us, all the Pi’s built-in Wi-Fi supports.
Use the following command to get a list of Wi-Fi capable devices available on your Raspberry Pi. Typically, on most setups your wireless device will use the name “wlan0
“.
iwconfig
Below you can see a list of network devices this tool found on our Pi. We only have one Wi-Fi adapter available to us which is “wlan0
“. There is a chance your adapter might use a different name.
lo no wireless extensions.
eth0 no wireless extensions.
wlan0 IEEE 802.11 ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=31 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:on
Configuring a Wi-Fi Access Point on your Raspberry Pi
4. Once you know the device name for your Wi-Fi adapter, we can configure your Raspberry Pi to act as a wireless access point.
Luckily, the Network Manager tool, which was discussed earlier in this guide, will handle most of the hard work.
To change your Raspberry Pi’s Wi-Fi into hotspot/access point mode, use the following command.
While typing out this command, there are a few details that you must replace with your own.
<DEVICE>
: This is the device name assigned to your Raspberry Pi’s Wi-Fi adapter. In the vast majority of cases, this should be “wlan0
“.<SSID>
: Replace this placeholder with the name you want broadcast by your access point. It is the ID that will be used by others when connecting to your hotspot.<PASSWORD>
: The last value you must replace is the password that will be used to secure your Raspberry Pi’s Wi-Fi access point.
sudo nmcli d wifi hotspot ifname <DEVICE> ssid <SSID> password <PASSWORD>
5. We can verify that the Wi-Fi hotspot has been created using the “nmcli
” tool to output all connections.
nmcli con show
Below is a list of connections that exist on our Pi. At the top, you can see that we now have a connection called “Hotspot
” with the device set to “wlan0
“.
NAME UUID TYPE DEVICE
Hotspot 59f9160c-b49f-47a2-ac54-87987f743df2 wifi wlan0
Wired connection 1 9d27eb3e-7657-3a54-ad8a-344cb4bb56e3 ethernet eth0
lo a54edcc4-0ffa-4090-a2b3-081905aee1c5 loopback lo
preconfigured 6e07c33c-9764-4145-af3f-49875c8a9342 wifi --
6. Another cool feature of the Network Manager tool is that it can generate QR codes that you can use to access your Wi-Fi hotspot easily.
All you need to do to get the “nmcli
” tool to generate this code is to use the following command.
nmcli dev wifi show-password
Troubleshooting your Wireless Access Point
7. You should now have a Wi-Fi hotspot broadcasting from your Raspberry Pi. Hopefully, everything is working correctly, but you should test the internet connection before proceeding.
If you need help connecting to this access point, move on to the next section.
8. If you have issues connecting to your access point despite entering the correct password, you may have to disable the network stack’s protected management frames functionality.
While this functionality helps with security, it can cause issues with certain Wi-Fi adapters and clients.
Disabling this functionality is as simple as using the following command within the terminal.
sudo nmcli con modify Hotspot wifi-sec.pmf disable
Hopefully, you can now access your new Raspberry Pi Wireless Access Point without any more issues.
Conclusion
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 Wi-Fi hotspot where you can route all the internet traffic through a VPN.
Hopefully, you will now have your Raspberry Pi set up as a Wireless access point, and you have successfully expanded the reach of your Wi-Fi network.
If you encounter any issues or have feedback related to this tutorial, please don’t hesitate to leave a comment below.
Whereas I had used this guide and others successfully for quite some time, I have not been able to establish a successful AP (and subsequently VPN AP) since the last major OS update. Issues with setting consistently the wifi country, wpa_supplicant, etc. As of 9-6-22, Rasp supports NetworkManager, and using that to set up the AP has been successful and MUCH easier. Even routing the AP through a VPN is basically handled automatically through nftables. Perhaps consider the NetworkManager method instead of the dhcpcd method?
Hi Adam,
Sorry to hear that you have been having issues with this guide and the current version of Raspberry Pi OS.
Thank you for your suggestion, I will look into writing a guide that uses NetworkManager instead and offer is as an alternative to this one.
Cheers,
Emmet
It’s not an issue with the guide – my understanding is its a glitch with the newest OS. Supposedly raspi-config in that the newest version cannot pull the wifi country code from the wpa_supplicant if there is a nohook set on an interface, which then renders wifi unusable. It’s inconsistent though, as some people experience it and others apparently don’t. NetworkManager appears not to experience the issue, at least for now.
On RPi 4 B with Bullseye-arm64:
I had to add:
sudo apt install iptables
at the beginning of 19.
then added not on but two lines above exit 0 in 22.
sudo hostapd /etc/hostapd/hostapd.conf&
iptables-restore < /etc/iptables.ipv4.nat
Now it works!!
Thanks!
Just setting up Raspi 4 B with Bullsey 64bit – I confirm Ravindra’s observation – recommend inserting that suggestion to the original article ! T
After following to the letter everything works until I reboot. If I add to /etc/rc.local
sudo systemctl stop hostapd
sudo systemctl start hostapd
it will work. This is a back method I am sure. How should I make it clean?
Hi,
Can you try getting the status of hostapd while it is broken (Before you run the two commands to stop and start the service).
You can retrieve the status of the hostapd service by running the following command.
Cheers,
Emmet
without the reset –
Hmm there isn’t anything super obvious as to why hostapd won’t be working correctly.
Unless for some reason hostapd is starting up before the network stack is fully up. Will try and find time to find a better workaround, but for now what you are using should work fine.
Cheers,
Emmet
I can also confirm the same issue as prairiedog. AP does not broadcast after reboot. Successful broadcast after restarting hostapd, but furthermore I cannot connect to the AP – won’t assign IP address.
Hi!
I did this to my old raspberry Pi 1 B+ last week and just now I took an old EeePc 4G, installed debian with console only and did the exact same thing 🙂 Working pretty solid!
I’ve had it running for over a year, backed up my SD card and put it away so as not to loose it. It’s better than the version on raspberrypi.org, something in the setup is more clear. I’ve downloaded hundreds of gigabytes through it.
Great article. I’ve tried a different version of this on another site that didn’t work – but this one worked first time.
A couple notes to consider:
1 – Setup the DNS Server to be a VPN/Secure DNS server to help guard against DNS leaks (this would be in place of 1.1.1.1).
2 – Limit the DHCP to, say, 10 (192.168.220.20 throught .30) as the Pi can only do so much (unless you have a better/newer pi).
Works better than the one on the Pi site. I’ve had it up and running off EasyTether for 5 days. Now I’m looking for a way to impose a daily bandwidth quota on a specific MAC address whose excessive use got me into this mess. I guess I should poke around the iptables site.
Hi,
Thanks for the tutorial but i’m running into a problem when i input:
sudo service hostapd start
I receive:
Failed to start hostapd.service: Unit hostapd.service is masked.
Thanks.
Hi,
So I found this and it is now working:
sudo systemctl unmask hostapd
sudo systemctl enable hostapd
sudo systemctl start hostapd
Thanks!
This did not work for me. I got the same error message, but some digging told me that the driver was wrong. Made no sense as that IS the driver. I ended up just commenting out the driver line in hostapd.conf to see if that would work (since wlan0 was functioning without hostapd started). Lo and behold, it’s working now as I’m typing this from a computer connected to my Pi.
In step 5 you say:
“If you have upgraded to Raspbian Stretch then wlan0 may need to be changed”
I do have Raspbian stretch, but I’m unsure what to do in this step. Change wlan0 into what?
Hi Tomas,
When Raspbian Stretch first released they had predictable network names switched on which caused the network names to be different. As stated in the step, ifconfig can be used to find the new name.
However, they have since reverted the change so you can continue using wlan0.
I hope this helps.
Worked like charm
Thank you
Raspberry Pi2 + TP-Link Wifi Adapter
i have a problem when doning sudo service hostapd start to start the AP it start for 20 Second then it stop ?? any solotion
Hey ko0oke,
When it stops does it report any issues?
Cheers
Hello,
What is the second command to be run in step 5?
Hey Alistair,
That was a leftover from the guide as we have been updating this to work better with newer versions of Raspbian. There is no second command to run.
Cheers
I had an issue with dnsmasq not running at startup, here’s how i fixed it:
Step 1, edit the file /lib/systemd/system/dnsmasq.service:
sudo nano /lib/systemd/system/dnsmasq.service
Add the following line before “ExecStartPre=/sur/sbin/dnsmasq –test”:
ExecStartPre=/bin/sleep 30
Save and exit
Step 2, enable automatic startup
sudo systemctl enable dnsmasq.service
Reboot and it should be working.
sudo systemctl enable dnsmasq.service
Hi, love this project! Made it work on Jessie, but now I have to try it again on Stretch and it’s a bit tough, particularly at step 6 where configuring the static IP address is not accomplished in the same way anymore.
Help would be really appreciated! Thanks for all the cool stuff you do to keep our Pis an active and productive project.
The whole stretch static IP thing drove me bonkers. Eventually I found out enough to understand that the debian network guys don’t expect the new dhcpcd stuff to work for everyone, just people who want things to be mostly automatic.
If you want to continue to do things the old way, using the /etc/network/interfaces file, just disable dhcpcd and enable traditional debian networking.
sudo systemctl disable dhcpcd
sudo systemctl enable networking
Then pretend you are on Jessie or before.
Great tutorial. I had to remove “[DSSS_CCK-40]” from the ht_capab list in order for it to work…I’m not sure why.
I’m also seeing speeds that are pretty reduced from my home wifi. (20mbs vs+50mbs) anyone have a good answer to why?
hello, I get to the part where it shows up under connections under wifi on my phone, but when i connect it says “no internet connection” but ethernet is set up and its connected to my home wifi network any suggestions?
I am also having the same problem.
Hi,
I have the problem that my Huawei Smartphone and other devices lost the Pi Wifi after a few hours and i can not connect to them.
I restart the Pi2 with the Wifi Dongle Edimax and after a few Moment i can connect to the Pi.
Any reason why this?
Wonderful tutorial, thank you for helping me with something a new user can start off with.
I’d love to run through this, but I’m concerned that if I turn my RPI into a WiFi hotspot that I’ll lose the pi’s regular WiFi functionality when I want to switch back to using my pi through the home router (not supplying a connection to my other devices through the pi). Is this so?
Thanks
Hi,
First off I’d like to thank you for the tutorial, I’ve managed get the AP and VPN setup but I’m having trouble with DNS leak. When I test for DNS leak I see both google and my ISP (BT), I’ve added the lines:
script-security 2
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf
at the bottom of the xxxxxxx.ovpn file and this now gives me just my ISP during DNS leak test.
My question is can I change to my own specified DNS setting rather than the ones provided by my router?
Thanks
Not sure if this will be any help but it sounds similar to the problem I’ve had.
Run the following commands
sudo apt-get install bind9
sudo nano /etc/bind/named.conf.options
Add the following lines to named.conf.options
forwarders {
8.8.8.8;
8.8.4.4;
};
This will ensure that Google DNS are used.
Then run the following commands:
sudo service bind9 restart
sudo update-rc.d bind9 enable
I found that the DNS leak test only found Google DNS (reported as Belgium).
This seems to allow me to access NowTV, but unfortunately Amazon Prime is still not working.
I have completed the above set up without too much issue.
However despite running the hostapd and dnsmasq service the Pi3-AP is not sowing up in my list of available connections?
Please advise
I have the same problem. I completed the tutorial without issue but it is not showing up as an available connection on any of my devices
Same here, all seemed to install fine. But access point doesn’t seem to be broadcasting. Any ideas?
Before running
sudo service hostapd start
you should run
sudo service hostapd stop
and then run
sudo service hostapd start
It starts working this way.
I am running in to the same issue. Tutorial runs perfect. AP not showing up. sudo service hostapd stop and sudo service hostapd start don’t seem to fix it. Any suggestions?