Frustrated with Wi-Fi repeaters that introduce latency and unreliable connections? Transform your Raspberry Pi into a dedicated wireless access point to create seamless hotspots throughout your home, office, or café. This proven step-by-step tutorial, tested on Raspberry Pi 3 and 4 models, draws from years of hands-on networking projects to deliver rock-solid results.
Once set up, your Pi acts like a mini router—perfect for café owners offering guest Wi-Fi, businesses creating secure employee networks, or homeowners managing multiple SSIDs without compromising speed.
To follow this guide, gather these essentials:
With your hardware ready, let's build your hotspot.
Connect all peripherals, including Ethernet, to your Pi.
Enable hostapd and set it to autostart:
sudo systemctl unmask hostapd sudo systemctl enable hostapd
Install dnsmasq for DNS caching and DHCP on small networks:
sudo apt install dnsmasq
Install netfilter-persistent and iptables-persistent to manage firewall rules across reboots:
sudo DEBIAN_FRONTEND=noninteractive apt install -y netfilter-persistent iptables-persistent
DHCP requires a static IP. Edit dhcpcd.conf:
sudo nano /etc/dhcpcd.conf
Add at the end:
interface wlan0 static ip_address=192.168.4.1/24 nohook wpa_supplicant
Save with Ctrl+O, then Ctrl+X.
For internet access via your Ethernet network, enable IP forwarding:
sudo nano /etc/sysctl.d/routed-ap.conf
Add:
net.ipv4.ip_forward=1
Save and exit. Add NAT rule:
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Persist the rule:
sudo netfilter-persistent save
Customize dnsmasq by backing up the default and creating a lean config:
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig sudo nano /etc/dnsmasq.conf
Add:
interface=wlan0 dhcp-range=192.168.4.2,192.168.4.20,255.255.255.0,24h domain=wlan address=/gw.wlan/192.168.4.1
Save and exit.
Edit hostapd config:
sudo nano /etc/hostapd/hostapd.conf
Add (use a strong, unique passphrase):
interface=wlan0 ssid=NetworkName hw_mode=g channel=7 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=PassphrasePassphrase wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP rsn_pairwise=CCMP
Save and exit. Pro tip: Choose 8+ characters mixing letters, numbers, symbols for security.
Reboot your Pi. Scan for networks on a Wi-Fi device—you'll see your SSID.
Connect with your passphrase:
Surf freely—your device routes through the Pi's Ethernet uplink.
This setup lets you share Wi-Fi without exposing your main router password. Explore more: use your Pi as a Chromecast receiver or Spotify streamer. Check our Raspberry Pi projects for ideas.