Create a Nodogsplash captive portal with Raspberry Pi and OpenWrt

In this article, I will show you how to configure your Rapberry Pi into a nodogsplash captive portal. The prerequisite for this configuration is to configure the Rapberry Pi as a routed Access Point as described in my previous post available under this link.

Schema

 

Install Nodogsplash

 

From your management workstation, open a browser and access to the IP address of the Raspi (192.168.0.30)

Navigate to System – Software and search for "nodogsplash" (you may have to update)

 

Install the current version (in my case 3.2.1-1)

Configure Nodogsplash

 

Open a SSH session to your Raspi using Putty

Verify the status or nodogsplash

 

ndsctl status

Output:

Install nano

 

opkg install nano

Edit /etc/config/nodogsplash

 

nano /etc/config/nodogsplash

Change the option gatewayinterface to wlan0

 

# The options available here are an adaptation of the settings used in nodogsplash.conf.
# See https://github.com/nodogsplash/nodogsplash/blob/master/resources/nodogsplash.conf

config nodogsplash
# Set to 0 to disable nodogsplash
option enabled 1

# Set to 0 to disable hook that makes nodogsplash restart when the firewall restarts.
# This hook is needed as a restart of Firewall overwrites nodogsplash iptables entries.
option fwhook_enabled '1'

# Serve the file splash.html from this directory
option webroot '/etc/nodogsplash/htdocs'

# Use plain configuration file
#option config '/etc/nodogsplash/nodogsplash.conf'

# Use this option to set the device nogogsplash will bind to.
# The value may be an interface section in /etc/config/network or a device name such as br-lan.
option gatewayinterface 'wlan0'

option gatewayname 'OpenWrt Nodogsplash'
option maxclients '250'

# Enables debug output (0-7)
#option debuglevel '7'

# Client timeouts in minutes
option preauthidletimeout '30'
option authidletimeout '120'
# Session Timeout is the interval after which clients are forced out (a value of 0 means never)
option sessiontimeout '1200'

Restart nodogsplash

 

service nodogsplash restart

Check if it works with a smartphone

 

You are done !

Leave a Reply

Close Menu