1

I am trying to setup a captive portal on my raspbian stretch access point connecting to my node server.

Currently using systemd to set up my network so I can ssh into my pi and use it as a access point. I am using this tutorial Raspberry Pi Zero W as a WiFi repeater . This is necessary for me to have wifi client and AP on my pi.

I have tried a number of methods setting iptables and dnsmasq with no luck

my iptables I was trying are : iptables -t nat -A PREROUTING -d 0/0 -p tcp --dport 8001 -j DNAT --to-destination 192.168.1.96:8001 One thing I am uncertain of is the --dport. Do I need to set any destonation ports or source ports? If I dont know the client's port then can DHCP just handle this? It makes sense to me that any web traffic once connected to my AP would just be sent to my --to-destination 192.168.1.96.8001

The other method I have tried is to set the address with DNSMasq using sudo nano /etc/dnsmasq.conf

interface=wlan0      
dhcp-range=192.168.1.2,192.168.1.30,255.255.255.0,24h

address=/192.168.1.96:8001

I am uncertain if the systemd does any network configuration or iptables at a different time so the AP captive portal is lost.

Let me know if anyone has tried this or had any successes with captive portals using systemd networking on Stretch.

Colin Rosati
  • 209
  • 1
  • 9

0 Answers0