I am currently setting up a Linux server for a WIFI access-point. When ever someone who is connected to the hotspot/access-point? tries to reload a page they get forced onto the one page. Note: this wont have internet access!

ie: user tries accessing www.google.com => it returns or example.domain

I've read that "dnsmasq" can be used to redirect any external addresses to an internal address. but haven't had any luck. Anyone have an example of a config for "dnsmasq"?

I have also read that this can be done through a proxy?

  • 1
    I can't help with specifics but you're attempting to create a "Captive Portal" as used in many hotels, wi-fi hotspots etc. This may help you Google for relevant information. It's not just a case of redirecting DNS, because that would mean typing in an IP would simply bypass it. Or, indeed, using a different DNS server. – Dan Nov 7 '12 at 13:08
  • Because.......? – Dan Nov 7 '12 at 13:14
  • In this instance i think redirecting dns would work because... 1. it doesn't matter if someone types an IP address directly 2. and the DNS server is supplied with DHCP this would be just like a hotel WIFI but it will be 100% closed i have also tried using "address=/#/" in the dnsmasq config – Darian Nov 7 '12 at 13:17

When you say "this wont have internet access!" I am reminded of a deployment I did a few years ago.

I did this for a kiosk deployment once. The kiosks were connected to LAN that had no Internet connectivity. The kisos were used to access a single webapp, hosted by a beefier "server" kiosk machine. Any attempts to access other web sites needed to be redirected to a single "error" page.

I deployed a DNS server with a wildcard root record (in this case, bind, but I'm sure other DNS servers would support wildcard roots). That wildcard root record resolved to the IP address of Apache server which used mod_rewrite to rewrite all incoming requests to the URL of a single "You're not connected to the Internet..." page.

If your statement "this wont have internet access!" isn't true, and there is Internet access involved, then you're moving more into a captive portal scenario, and would probably be better served by any one of a number of open source and commercial products that could do this. (Personally, I like the Coova Chilli product, but that's just me...)

Not the answer you're looking for? Browse other questions tagged or ask your own question.