This setup was used as a demo unit at a conference to provide insight into the cybersecurity concerns around public Wi‑Fi networks. The project emulates a captive portal‑based Wi‑Fi network, such as ones found in Hotels, Airports, and Coffee shops. The setup is completely air‑gapped and does not require any form of internet connection to function.
FortiGate has a built‑in captive portal that we will be using. The issue is that FortiGate will not proceed with the captive portal unless it is connected to the internet. Hence, this won’t work for an air‑gapped system. This is where the Raspberry Pi comes in. It acts as a gateway and essentially fakes a network connection to allow the FortiGate to pass the mobile device “Captive Network Assistant” (CNA) check and display the captive portal.
$ sudo apt update
$ sudo apt upgrade
$ sudo nmtui # access the built‑in network utility
# Use the arrow keys and Enter to navigate.
# Choose the wired connection (usually “eth0”).
# Set IPv4 Configuration → Manual.
# Add address 192.168.100.1/24.
# Use the same address as DNS.
# Save and quit.
$ sudo apt install dnsmasq
$ sudo systemctl stop dnsmasq
$ sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.bak
$ sudo nano /etc/dnsmasq.conf
# Add at the bottom:
interface=eth0
dhcp-range=192.168.100.10,192.168.100.50,12h
dhcp-option=3,192.168.100.1
dhcp-option=6,192.168.100.1
$ sudo systemctl start dnsmasq
$ sudo nano /etc/sysctl.conf
# Uncomment: net.ipv4.ip_forward=1
$ sudo sysctl -p
$ sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
$ sudo apt install iptables-persistent # persist across reboots
$ sudo nano /etc/dnsmasq.conf
# Append:
address=/#/192.168.100.1
After completing the steps above, a Wi‑Fi network will appear that any mobile device can join. The device will be redirected to the captive‑portal page; if credentials are entered, the user is taken to the “Login Failed” page.
Note on Samsung devices: Samsung’s Knox suite uses a hard‑coded CNA address, so the standard captive‑portal flow does not trigger. To support those devices, add a DNS override for the Samsung CNA host:
$ sudo nano /etc/dnsmasq.conf
# Add:
address=/www.samsung.com/192.168.10.1
$ sudo systemctl restart dnsmasq
This forces Samsung phones to resolve the CNA check to the Pi, allowing the captive‑portal to appear.