B. Easy URL's using a local DNS

This section helps you set up a local DNS server which can be used by ChilliSpot.

B.1. Why a local DNS

Wouldn't it be nice to tell your 802.11 hotspot users if they want to do a certain action, they can just type this cation in the address bar of their browser and they will be redirected to this action's page.

Example, to login, type 'login', to exit type 'exit', to check your account type 'info'.

A local DNS server used by ChilliSpot will empower you to do just that. Lets start.

  1. Install BIND on the server running Hotcakes.

    Tip

    You are not limited to have it on this server, in fact it can be on any server, you can even modify an existing DNS server.

    sudo apt-get install bind9 dnsutils

  2. Add the following to '/etc/bind/named.conf.local'.

      # This is the zone definition. replace hotcakes.com with your domain name
      
      zone "hotcakes.com" {
      type master;
      file "/etc/bind/zones/hotcakes.com.db";
      };

  3. Edit the '/etc/bind/named.conf.options' file to contain the DNS servers of your ISP under the 'forwarders' section.

    forwarders {
      # Replace the address below with the address of your provider's DNS server
      123.123.123.123;
    };

  4. Add the zone definition files.

    sudo mkdir /etc/bind/zones
    touch /etc/bind/zones/hotcakes.com.db
    Add content to hotcakes.com.db. You can 'localize' it so the users do not have to enter the English words for the actions.

    Replace hotcakes.com with your domain name. Do not forget the '.' after the domain name! Also, replace ns1 with the name of your DNS server

    hotcakes.com. IN SOA ns1.hotcakes.com. admin.hotcakes.com. (
    2007031001
    28800
    3600
    604800
    38400
    )
      
    hotcakes.com. IN NS ns1.hotcakes.com.
      
    ns1 IN A 192.168.182.1
    login     IN A 192.168.182.1
    info      IN A 192.168.182.1
    exit      IN A 192.168.182.1

  5. Restart the BIND server.

    sudo /etc/init.d/bind9 restart

  6. Just point your ChilliSpot machines to this DNS server. If the machine you run ChilliSpot on are using THIS DNS server as THEIR DNS server, you may not need to change the 'chilli.conf' file. If not you can either change it so the machine self uses this DNS server as its DNS server, or you can specify it in 'chilli.conf' as the value for 'dns1' and 'dns2'.

    Tip

    Remember the 'uamallowed' value also may have to change.

  7. You also need to modify the value of 'domain' in 'chilli.conf' to be the same as the domain you created the DNS zone for.

      # TAG: domain
      # Domain name
      # Will be suggested to the client.
      # Normally you do not need to uncomment this tag.
      domain hotcakes.com

  8. Finally you need to create an intelligent 'landing page'. This page will see how it was called and redirect the client according to how it was called.

    If the page was called by 'info', the client will be redirected to login to their info page.

    If the page was called by 'exit' they will be logged off the 802.11 hotspot

    A sample landing page is in '/var/www/cake/hotcakes/db/index.php'. Copy this to the '/var/www' directory of the server specified in your DNS zone file.

    You may have to fine tune it to suit your configuration.

B.1.1. How it works

When a client gets an IP address from ChilliSpot it also gets a default domain specified by the 'domain' entry in 'chilli.conf'.

Lets assume we specified it as 'hotcakes.com'

When a client asks to browse to 'exit', in the background, the operating system asks the DNS server to resolve 'exit.hotcakes.com'.

We created a zone for hotcakes.com in the local DNS server, and can thus resolve the request. (EG 192.168.182.1)

Our client gets redirected to the index page of the web server. The web server's index page check what was requested and redirects accordingly.

Note

If you have system which makes use of a transparent proxy you must also ensure it can also resolve a name like 'exit' to an IP address. I had to manually add this to the '/etc/hosts' file on a OpenWRT Access Point. I also had to fine tune the '/etc/tinyprox/tinyproxy.conf' file. YMMV!