raspberry pi ad-hoc wifi with a password, no router needed
I wanted to set up a Pi so that the wifi would work standalone, with no router. You would connect to it like it was an access point, and then be able to access its web server but no internet. It's rather easy to do this if you put it in ad-hoc mode, but then there's no security.
The alternative is to start setting it up like a full fledged router/access point but stop before the "routing and masquerading" is implemented in the this guide to setting up a pi as an access point. There were two hiccups in following the guide, however. First, if you are doing it over the network, some of the commands break the connection, stopping you mid-way thru setup. 2nd it didn't work until I rebooted. Here's my solution. skip all the commands shown in bold below as they appear in the guide, and make a shell script that you execute once all the configuration files have been nano'ed.
#!/bin/bash
systemctl daemon-reload
service dhcpcd restart
systemctl reload dnsmasq
systemctl unmask hostapd
systemctl enable hostapd
systemctl start hostapd
The alternative is to start setting it up like a full fledged router/access point but stop before the "routing and masquerading" is implemented in the this guide to setting up a pi as an access point. There were two hiccups in following the guide, however. First, if you are doing it over the network, some of the commands break the connection, stopping you mid-way thru setup. 2nd it didn't work until I rebooted. Here's my solution. skip all the commands shown in bold below as they appear in the guide, and make a shell script that you execute once all the configuration files have been nano'ed.
#!/bin/bash
systemctl daemon-reload
service dhcpcd restart
systemctl reload dnsmasq
systemctl unmask hostapd
systemctl enable hostapd
systemctl start hostapd
reboot
Comments