Skip to main content
1 of 4

How to create a Mobile Captive Portal on Android adding a DHCP Option to thenative Soft AP (Access Point / Hotspot)?

Goal:

I want to create a Captive portal using an Android Device, the native Android Soft AP/Hotspot, Termux NodeJs, and the "new" way to detect captive portals using a DHCP option: RFC,.

Approach:

I want to add an option on the DHCP handshake of my Android Device Soft AP as specified in the RFC, Apple and Android official forums.

(the old way to create a captive portal was to intercept and controll all DNS or HTTP requests of each device conected to the AccessPoint, but in order to do it I need to ROOT my Device and install a DNS server or change the IP tables, and I dont want to do it becouse is very similar of what I already di that on a RaspberryPi)

Current State:

Im able to run a local Http Server running Nodejs in Termux app on an NOT ROOTED Android device,I want to know if it is posible to ADD THAT SIMPLE DHCP OPTION to the Android DHCP native handshake, maybe creating an AP and using the wifi-softap-tethering utilities or changing some kind of DHCP config file in some location like /etc/dhcp/dhcp.conf to add the option.

If adding a DHCP option is not posible Im gonna change the IP tables or run a DNS server and intercept the trafic to provide the Captive Portal Detection as the OLD fashion way.

Previous Attempts:

I was able to create a captive portal using DNSMASQ and HOSTAPD on a RaspberryPi, I suppose that I can do the same on MY Android device, but I want to USe the "modern Way" using DHCP captive portal options.

Unknowns

  1. Where is the configuration of the local Android DHCP?, is it hardcoded in the source code or it exists in a /system/{some-dhcp-func}/dhcp.conf file?
  2. Is it posible to add a DHCP option to the native Android Soft AP functionality?
  3. Can I use or extend some offical Class of Android apk and create my app to add the DHCP Option in the Handshake?
  4. Do I really need to root my device, install a DNS server and intercept all the DNS /HTTP trafic to provide the captive portal functionality?