Chapter 8:

CAPTIVE PORTAL

Enhance your customer experience while managing internet usage with a captive portal on your network. This solution is perfect if your mobile internet is metered or if you wish to provide specific information to customers without giving them full internet access. Meanwhile, you and your employees can still enjoy unrestricted internet access. A captive portal is an efficient way to directly present information to customers without the need for browser instructions.

However, there are certain limitations. A connection to the internet, or at least an active Ethernet port, is required. The captive portal typically serves a static HTML page, which can include links to other web pages and external JavaScript functions, but it's limited to displaying non-interactive content.

For Raspberry Pi users, Nodogsplash is a compatible, free service for creating a captive portal. Here’s how to install it:

  1. Install the necessary library:

    sudo apt-get install libmicrohttpd-dev

  2. Clone and install Nodogsplash:

    git clone https://github.com/nodogsplash/nodogsplash.git

    cd nodogsplash

    make

    sudo make install

  3. Configure Nodogsplash:

    • Edit the configuration file:

      sudo nano /etc/nodogsplash/nodogsplash.conf

    • Set the GatewayInterface (e.g., wlan0 for wireless LAN) and GatewayAddress, just like this:

      # GatewayInterface is not autodetected, has no default, and must be set here.

      # Set GatewayInterface to the interface on your router

      # that is to be managed by Nodogsplash.

      # Typically br-lan for the wired and wireless lan.

      #

      GatewayInterface wlan0

      #

      # Parameter: GatewayAddress

      # Default: Discovered from GatewayInterface

      #

      # This should be autodetected on an OpenWRT system, but if not:

      # Set GatewayAddress to the IP address of the router on

      # the GatewayInterface. This is the address that the Nodogsplash

      # server listens on.

      GatewayAddress 10.3.141.1

  4. Set up the service:

    sudo cp ~/nodogsplash/debian/nodogsplash.service /lib/systemd/system/

    sudo systemctl enable nodogsplash.service

    sudo systemctl start nodogsplash.service

    sudo systemctl status nodogsplash.service

Customize your captive portal's splash page (splash.html) to display the desired information and control internet access. The access point's configuration can be easily modified through the web interface at the default IP address (10.3.141.1). The Lighttpd web server delivers the webpage, ensuring a smooth user experience.