Create Wireless Access Point - The Raspberry Pi Guide
Create Wireless Access Point - The Raspberry Pi Guide
TA B L E OF CONTE N T S
1 Getting started
2 Configure a static IP
3 Configure the DHCP server
4 Configure the access point host software
5 Start up the wireless access point
6 Enable routing and IP masquerading
7 Stop the access point
Getting started
In order to work as an access point, the Raspberry Pi will need to have access point software installed,
along with DHCP server software to provide connecting devices with a network address.
To create an access point, we’ll need DNSMasq and HostAPD. Install all the required software in one
go with this command:
Since the configuration files are not ready yet, we need to stop the new software from running:
Configure a static IP
https://raspberrypi-guide.github.io/networking/create-wireless-access-point 1/7
11/2/23, 14:37 g Create wireless access point | The Raspberry Pi Guide
We are configuring a standalone network to act as a server, so the Raspberry Pi needs to have a static
IP address assigned to the wireless port. Here I assume we are using the standard 192.168.x.x IP
addresses for our wireless network, so we will assign the server the IP address 192.168.4.1.
To configure the static IP address, edit the dhcpcd configuration file with:
Go to the end of the file and edit it so that it looks like the following:
interface wlan0
static ip_address=192.168.4.1/24
nohook wpa_supplicant
Now restart the dhcpcd daemon and set up the new wlan0 configuration:
Type the following information into the dnsmasq configuration file and save it:
interface=wlan0
dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h
This will provide IP-addresses between 192.168.4.2 and 192.168.4.20 with a lease time of 24 hours.
Now start dnsmasq to use the updated configuration:
https://raspberrypi-guide.github.io/networking/create-wireless-access-point 2/7
11/2/23, 14:37 Create wireless access point | The Raspberry Pi Guide
country_code=DE
interface=wlan0
ssid=YOURSSID
channel=9
auth_algs=1
wpa=2
wpa_passphrase=YOURPWD
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP
Make sure to change the ssid and wpa_passphrase . We now need to tell the system where to find this
configuration file. Open the hostapd file:
DAEMON_CONF="/etc/hostapd/hostapd.conf"
https://raspberrypi-guide.github.io/networking/create-wireless-access-point 3/7
11/2/23, 14:37 Create wireless access point | The Raspberry Pi Guide
net.ipv4.ip_forward=1
Next we need a “masquerade” firewall rule such that the IP-addresses of the wireless clients
connected to the Raspberry Pi can be substituted by their own IP address on the local area network.
To do so enter:
Now to save these firewall rules and automatically use them upon boot, we will use the netfilter-
persistent service:
Once rebooted, if you go to another device that has wireless and search for wireless networks you
should be able to see your wireless access point and be able to connect to it using the credentials
that you configured.
and comment out the lines related to the static IP address. Now reboot
sudo reboot
Comments
Although this is the first guide to show, it doesn't apply to Bulldog. Perhaps a mention? No
iptables in Bulldog.
https://raspberrypi-guide.github.io/networking/create-wireless-access-point 4/7
11/2/23, 14:37 Create wireless access point | The Raspberry Pi Guide
Hi David, I don't understand your comment. You mean you are struggling to use the guide
to set up a wireless access point with Raspberry pi Bullseye? If so I will look into it.
From Bullseye iptables have been replaced by nftables so your instructions do not work.
These instructions:
https://tinyurl.com/mrf8mz93
worked for me. Note the use of nftables at the end.
I cannot start dnsmasq. it says bad option at line 2 of the config file when I run status.
all I have on the second line is the scope of ips.
I don't know if I did something wrong or if that's the expected case, but I think that should
be covered by this tutorial.
Yes, I have the same issue as ¨Erick GF¨ internet for the RPi itself is gone after this.
I run into the issue once I get to the point of running sudo systemctl enable hostapd,
where I am getting an error. it says that it failed to start access point and authentication
server for Wifi an dEthernet because it finished with an exit-code failure. I am getting
status 1/failure, but it doesn't give me very much information. the process is: "2103
ExecStart=/usr/sbin/hostapd -B -P /ruyn/hostapd.pid -B ${DAEMON_CONF}
Connected, no internet
Apologies if this is answered above, but I haven't spotted it yet... as part of registering a Pi
Zero as a SmartThings IOT device, the Pi wants to run as an access point. Unfortunately, I
don't have a physical display and keyboard, or wired Ethernet, hooked to the pi -- I'm
working on it via SSH. Switching to AP mode breaks my existing SSH connection, and so
far I've been unable to reestablish one while in that mode.
I've seem rumors that an "always-on AP" configuration is possible, with hints that it may
be able to run the access point while keeping the other services live. But I haven't found
details of how to set that up. Pointer or hints would be greatly appreciated!
Add a Comment
Please leave your comment below. If you'd like to be notified of my reply, please leave your comment
here for others but also send your comment as an email to me. I will try to reply as soon as I can.
Thanks!
Name
https://raspberrypi-guide.github.io/networking/create-wireless-access-point 6/7
11/2/23, 14:37 Create wireless access point | The Raspberry Pi Guide
Comment
POST
If you use find any of the information provided on this website useful it would be great to hear from you and please consider citing the paper! All rights
reserved © 2021 Jolle Jolles. Website built using Jekyll and the Just the Docs theme.
https://raspberrypi-guide.github.io/networking/create-wireless-access-point 7/7