0

I have a private hotspot running on the raspberry based on RASPAP, which is working perfectly.

Now I wish to automatically direct all the users who connect to this wifi towards a locally hosted website on the pi.

Have followed many guides on the internet regarding this. But still can't get this to work.

Here is all the configuration I have done in the iptables: enter image description here

UPDATE: I found out the lighttpd web server I'm using is working on port 80, not 8080. So I switched the rules to point towards port 80 now.

Also ran commands suggested in the comments. See screenshot below: enter image description here

  • Ok... If I understand correctly, all tcp traffic to ports 80 and 443 that is moving through the network (even locally generated traffic) is meant to go to Port 8080 of your raspberry. I assume that there is some process listening on that Port, right? Can you make sure by adding the output of this command to your question? sudo netstat -lntp | grep 8080. Then the other thing that should happen is that when traffic is traversing the network stack, the nat rules should increase their counters. Can you make sure with sudo iptables -t nat -L -nv – eftshift0 May 26 '18 at 21:47
  • @eftshift0 see the updates in the question – Mohsin Anees May 27 '18 at 12:25
  • You can see that the counter for DNAT of traffic of port 80 has increased. Is it working now? – eftshift0 May 27 '18 at 14:02
  • Sorry it still isn't working. I have tried changing the destination address to the physical ip address of the pi. It does not redirect when I open www.google.com in my browser. – Mohsin Anees May 27 '18 at 14:37
  • On the other hand, if I manually enter the same ip address in the browser, it opens perfectly. – Mohsin Anees May 27 '18 at 14:38

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.