Once your wireless access point is up and running, anyone who has the password will be able to connect to your Raspberry Pi as though it’s a “mini router,” ideal for everyone from cafe owners who want to offer their customers complimentary Wi-Fi, to employers who need to create a private network for their employees, or even someone who just likes the idea of having multiple Wi-Fi networks at home!

What you’ll need

To complete this tutorial, you’ll need:

Raspberry Pi 3/4 that’s running Raspbian. If you don’t already have Raspbian, you can grab the latest version and flash it using Etcher. Power cable that’s compatible with your Raspberry PiExternal keyboard and a way to attach it to your Raspberry PiHDMI or micro HDMI cable, depending on model of Raspberry PiExternal monitorEthernet cable. Since you’re turning your Raspberry Pi into a wireless access point, you’ll need to connect over Ethernet rather than Wi-Fi. This also means it won’t work with Raspberry Pi 2 or Raspberry Pi Zero since they are missing either the Ethernet port or wireless card.

Once you’ve assembled your tools, it’s time to create your own Wi-Fi hotspot.

Getting Started: Set Up Your Raspberry Pi

To start, connect all the peripherals to your Raspberry Pi, including the Ethernet cable. Once your Raspberry Pi has booted, it’s a good idea to check that you’re running the latest version of Raspbian, so launch a Terminal by clicking the little “Terminal” icon in the toolbar. Type the following command: Press Enter on your keyboard and wait for the command to execute. Type the next command and press Enter once again: After the upgrade, it is best to reboot your Raspberry Pi for any system changes to take effect. Run the following command:

Install hostapd, dnsmasq and Firewall Plugins

Install the hostapd (host access point daemon), which is a software package that can transform network interface cards into access points. To install hostapd on your Raspberry Pi, open a Terminal and run the following command: Enable the wireless access point and set it to launch automatically at startup: Next, install dnsmasq, which provides Domain Name System (DNS) caching and a Dynamic Host Configuration Protocol (DHCP) server that’s designed for small networks. To install this software package, run the following command in the Terminal: Finally, install netfilter-persistent and the iptables-persistent plugin, which will be responsible for saving and loading the firewall rules on your Raspberry Pi:

Assign a Static IP Address

The Dynamic Host Configuration Protocol server requires a static IP address, so in this section you’ll configure a static IP for your Raspberry Pi. To start, run the following command in the Terminal: Raspbian will open the configuration file for dhcpcd. Scroll to the bottom of this file and add the following lines: Save your changes by pressing Ctrl + O followed by Ctrl + x.

Enable routing

Your Raspberry Pi access point is now running its own standalone wireless network. However, if you want to allow clients to access computers on your Ethernet network, then you’ll need to enable routing. To enable routing, create a “routed-ap.conf” file using the following command: This creates a “routed-ap.conf” file and opens it for editing in the Nano text editor. In the text editor, type the following: Save your changes by pressing Ctrl + O followed by Ctrl + X. Add a new firewall rule to your Raspberry Pi by running the following command: Finally, use netfilter-persistent to ensure your new rule gets loaded at startup:

Configure Your DHCP and DNS Services

The dnsmasq package provides a default configuration file, but we don’t need all the options included in this file. To make things easier, rename dnsmasq’s default configuration file and create a replacement file that’s completely empty. Then open this new “dnsmasq.conf” file in the Nano text editor and add only the configuration options that we actually need. To start, run the following Terminal commands: Add the following configuration options: Save your changes by pressing Ctrl + O followed by Ctrl + X.

Create a Network Name and Password

Configure your wireless access point by editing the hostapd configuration file. To open this file for editing, run the following command:
Add some information about your wireless access point, including giving it a name and securing it with a password. To help protect your access point, your password should be eight characters or more and feature a mix of letters, numbers and symbols. This tutorial creates an access point called “NetworkName” with the password “PassphrasePassphrase” – make sure you use something more secure for your own network! Save your changes by pressing Ctrl + O followed by Ctrl + X.

Connect to Your Wireless Access Point

Congratulations, you have successfully turned your Raspberry Pi into a wireless access point. To verify that everything is working correctly, it’s a good idea to restart your Raspberry Pi and check that you can connect to your access point following this reboot. Once your Raspberry Pi has rebooted, grab any Wi-Fi enabled device and scan for nearby wireless networks. You should see a network that has the name you specified in your Raspberry Pi’s “hostapd.conf” file. Try to connect to this network, and you’ll be prompted for a password. Enter the passphrase from your “hostapd.conf” file, and after a few moments you should be successfully connected to your wireless access point. You can now surf the Internet on your Wi-Fi enabled device as though it was directly connected to your router. In this tutorial, you learned how to turn a Raspberry Pi into a wireless access point. You can now connect to this access point using any Wi-Fi enabled device and can give third parties access to your network without sharing your router’s password. In addition, you can also turn your Raspberry Pi into a Chromecast or stream Spotify from it. Don’t forget to check out our Raspberry Pi page for more interesting projects.