Answer the question
In order to leave comments, you need to log in
How to redirect all sites to localhost?
There is an open wifi hotspot with debian (on raspberry pi).
It is required that when devices are connected, requests for port 80 are redirected to the local web server.
Something like how it is done when connecting to public access points, only easier - without authorization and without the ability to access the Internet.
Answer the question
In order to leave comments, you need to log in
Replace foo_serverip with internal address
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -m conntrack --ctstate NEW -j DNAT --to foo_serverip:80
iptables -t nat -A PREROUTING -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
iptables -A POSTROUTING -t nat -j MASQUERADE
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question