humitos / pyfispot

Hotspot running with Python 2.7 + Flask + nginx + uWSGI + dnsmasq + hostapd
GNU General Public License v2.0
60 stars 23 forks source link

Automatically connect known WiFi #13

Closed humitos closed 8 years ago

humitos commented 8 years ago

We have some known wifi connection under /etc/wpa_supplicant/ directory with all the password and stuffs. So, I want to auto-connect at startup if there is a known wifi connection where the RaspberryPi is at the moment.

For example, if there is a file for SSID la costanera and there is a network called la costanera, I want the RasPi to auto-connect at boot time.

humitos commented 8 years ago

http://raspberrypi.stackexchange.com/a/9750

humitos commented 8 years ago

WPA roam mode

zcat /usr/share/doc/wpasupplicant/README.Debian.gz | less

humitos commented 8 years ago

http://ubuntuforums.org/showthread.php?t=1259003

humitos commented 8 years ago

Done in 88d5048d2148221ac25195d793dfb19cbb51deeb

humitos commented 8 years ago

We need to implement this in ARM Arch Linux also.

And, actually, I want to automatically connect to a known WiFi and enable de Captive Portal (or another thing) depending on the network. We can use the netctl file to do this.

humitos commented 8 years ago

This should be enough in the profile files: /etc/netctl/wlan1-MIRAFLORES_4to_5to

ExecUpPost='/home/alarm/bin/run_iptables.sh wlan1 wlan0 ; /home/alarm/bin/enable_us.sh'
ExecDownPre='/home/alarm/bin/reset_iptables.sh || true'

I added || true because if it tries to remove the internet chain and it doesn't exist, it fails