# Turn On Raspberry Pi Hotspot If Not Online If you follow these steps there's no need to follow [[Turning Raspberry Pi Wi-Fi Off If Connected Over Ethernet]]. 1. Run ```shell sudo apt install hostapd dnsmasq sudo systemctl unmask hostapd sudo systemctl disable hostapd sudo systemctl disable dnsmasq ``` 2. Add `/etc/hostapd/hostapd.conf` (listed below). This file includes the SSID and the password of the hotspot 3. Set the following in `/etc/default/hostapd`: ```ini DAEMON_CONF="/etc/hostapd/hostapd.conf" #DAEMON_OPTS="" ```` 4. Modify the `/etc/dnsmasq.conf` file by adding the following lines to the bottom ```ini #AutoHotspot Config #stop DNSmasq from using resolv.conf interface=wlan0 no-resolv bind-interfaces dhcp-range=10.0.0.50,10.0.0.100,12h ```` 5. Modify the` /etc/dhcpcd.conf` file by adding the following line to the bottom: `nohook wpa_supplicant` 6. Create `/etc/systemd/system/autohotspot.service` with the contents listed below 7. Run `sudo systemctl enable autohotspot.service` 8. Copy the following to `/usr/bin/autohotspot` ![[autohotspot]] 9. Run `sudo chmod +x /usr/bin/autohotspot` ## `/etc/hostapd/hostapd.conf` ```ini #2.4GHz setup wifi 80211 b,g,n interface=wlan0 driver=nl80211 ssid=RPiHotspot hw_mode=g channel=8 wmm_enabled=0 macaddr_acl=0 auth_algs=1 ignore_broadcast_ssid=0 wpa=2 wpa_passphrase=1234567890 wpa_key_mgmt=WPA-PSK wpa_pairwise=CCMP TKIP rsn_pairwise=CCMP #80211n - Change GB to your WiFi country code country_code=GB ieee80211n=1 ieee80211d=1 ``` ## `/etc/systemd/system/autohotspot.service` ```ini [Unit] Description=Automatically generates a Hotspot when a valid SSID is in range After=multi-user.target [Service] Type=oneshot RemainAfterExit=yes ExecStart=/usr/bin/autohotspot [Install] WantedBy=multi-user.target ```