Question

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 ?

Was it helpful?

Solution

the reaseon why you get an error is either because :

  • your server is not setup for https request
  • if you request google.com/search?=whatever, /search doesn't exist on your server.

you need to:

  • configure your server for https (but it will show a security alert because of bad certificate)
  • tell your server to rewrite any "unknown" url to a specific virtual host showing your home page

OTHER TIPS

This tutorial for Ubuntu, is a good follow along for the Raspberry Pi if you are using Apache and php in your captive portal setup. http://aryo.info/labs/captive-portal-using-php-and-iptables.html (from archive)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top