I spent many hours struggling with the official access point tutorial (see https://www.raspberrypi.org/documentati ... s-point.md), trying to install it on Raspbian Stretch to no avail. I tried other tutorials on various websites, but none of them worked. I think I spent a total of 12 hours on it, until I found success.
The website that had the tutorial that worked: https://pimylifeup.com/raspberry-pi-wir ... ess-point/
I cannot take credit for this, but I wanted to share it here, to hopefully save others the headache. As a side note, when I couldn't access my Pi Zero W directly due to a glitch in Windows and the host name, I completed the setup with the SD in my RPI3B+, then just moved it to my Pi Zero W.
There were a couple of important things missing from the tutorial, which I'm adding here.
Prep: Enable SSH using raspi-config or add an "SSH" text file in the root folder. Enable VNC if you want to use that for remote desktop. Config the system localization, etc.
Access Point Setup
Update and upgrade first.
Code: Select all
sudo apt-get update
sudo apt-get upgradeInstall hostapd and dnsmasq.
Code: Select all
sudo apt-get install hostapd dnsmasqStop the packages.
Code: Select all
sudo systemctl stop hostapd
sudo systemctl stop dnsmasqEdit the dhcpcd config and add settings.
Code: Select all
sudo nano /etc/dhcpcd.conf- NOTE: You can customize the IP.
Code: Select all
interface wlan0
static ip_address=192.168.220.1/24
nohook wpa_supplicantRestart dhcpcd.
Code: Select all
sudo systemctl restart dhcpcdEdit the hostapd config and add settings.
Code: Select all
sudo nano /etc/hostapd/hostapd.conf- NOTE: Leave out anything starting with "wpa" to remove the passphrase requirement for the access point.
Code: Select all
interface=wlan0
driver=nl80211
hw_mode=g
channel=6
ieee80211n=1
wmm_enabled=0
macaddr_acl=0
ignore_broadcast_ssid=0
auth_algs=1
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
# This is the name of the network
ssid=Pi3-AP
# The network passphrase
wpa_passphrase=pimylifeupEdit hostapd file in /etc/default.
Code: Select all
sudo nano /etc/default/hostapdUncomment it (remove the # at the beginning) and add the path.
Code: Select all
DAEMON_CONF="/etc/hostapd/hostapd.conf"Edit the hostapd file in /etc/init.d.
Code: Select all
sudo nano /etc/init.d/hostapdAdd the path to the hostapd.conf here as well, but without quotes.
Code: Select all
DAEMON_CONF=/etc/hostapd/hostapd.confBack up the dnsmasq.conf file.
Code: Select all
sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.origCreate a new and blank dnsmasq.conf in place of the one we just moved.
Code: Select all
sudo nano /etc/dnsmasq.conf- NOTE: server=8.8.8.8 can be used for Google DNS and IP range can be customized.
Code: Select all
interface=wlan0 # Use interface wlan0
server=1.1.1.1 # Use Cloudflare DNS
dhcp-range=192.168.220.50,192.168.220.150,12h # IP range and lease time Edit the systctl.conf file.
Code: Select all
sudo nano /etc/sysctl.confRemove the comment character (#) to activate this line.
CTRL-X,Y,Enter to save.
Activate the setting above immediately.
Code: Select all
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"Configure a NAT between wlan0 and eth0.
Code: Select all
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADECode: Select all
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"Edit rc.local.
Code: Select all
sudo nano /etc/rc.localAdd this line above it.
Code: Select all
iptables-restore < /etc/iptables.ipv4.natIf all has gone well and there are no mistakes, you should be able to start hostapd and dnsmasq without errors.
Code: Select all
sudo service hostapd start
sudo service dnsmasq startThis part was missing from the website tutorial:
Enable hostapd and dnsmasq, so they start at boot.
Code: Select all
sudo update-rc.d hostapd defaults
sudo update-rc.d hostapd enable
sudo update-rc.d dnsmasq defaults
sudo update-rc.d dnsmasq enableNext, I would reboot.
Code: Select all
sudo rebootConnect to your access point, then SSH into it (using your IP, of course).
Code: Select all
ssh 192.168.220.1Regards.