1

I created an access point (on a raspberrypi3, jessie), which I can properly connect to. Now I want to let devices open up automatically a splash page (hosted on localhost) after connecting to my hotspot. The access point will never forward any traffic in the future, so I'm Ok with blocking all traffic in the rules.

From Redirecting Request on Device in Access Point Mode & diff. tutorials I believe that this can be done with iptables. The devices open up the splash page, if they cannot access some page they originally want to open (I'm not sure with this).

iptables

*nat
:PREROUTING ACCEPT [3:522]
:INPUT ACCEPT [3:522]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A PREROUTING -p tcp -m tcp --dport 80 -j DNAT --to-destination 127.0.0.1:80
-A PREROUTING -p tcp -m tcp --dport 443 -j DNAT --to-destination 127.0.0.1:80
COMMIT
*filter
:INPUT ACCEPT [1176:83156]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [1114:81204]
COMMIT

iptables -t nat -nvL :

Chain PREROUTING (policy ACCEPT 19 packets, 2156 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 DNAT       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:80 to:127.0.0.1:80
    0     0 DNAT       tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:443 to:127.0.0.1:80

Chain INPUT (policy ACCEPT 19 packets, 2156 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 1 packets, 48 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain POSTROUTING (policy ACCEPT 1 packets, 48 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Question

How can I configure the iptables (what else is required) to have a splash page popping up by devices, after connecting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.