wifiraspberry-piportalcaptivenetwork

Create captive portal on Raspbian


I've got some issues with my captive portal.

I want to open a pop-up when anyone try to connect to my Raspberry wifi access point. In order to, I have turn my Rpi into a wifi access point and I have put a LAMP server on my Rpi.

Actually I use DNSMASQ and i change the conf file to :

address=/#/10.0.0.1
listen-address=10.0.0.1
dhcp-range=10.0.0.10,10.0.0.50,12h

And I change the iptables in order to capture all the connexion :

iptables -t nat -A PREROUTING -i wlan0 -p tcp --dport 443 -j DNAT --to-destination 10.0.0.1:443
iptables -t nat -A PREROUTING -i wlan0 -p tcp --dport 80 -j DNAT --to-destination 10.0.0.1:80

So when I connect and go on the browser with my phone I'm redirected to the home page of the server => This is what I want, so it's good :) But my problem is I want a trigger to open the home page automatically when i connect to the network.

Anyone knows how to do this ?

Another question, when I call "google.fr" in my browser, I'm redirected to my Apache home page, but when I launch a search request in the browser, I've got an error. Anyone knows why ?


Solution

  • the reaseon why you get an error is either because :

    you need to: