hamedsh Asked: 2011-02-15 15:23:27 +0800 CST2011-02-15 15:23:27 +0800 CST 2011-02-15 15:23:27 +0800 CST redirect internet request to specific url 772 in gateway base on linux how can redirect all internet accesses to port 80 in gateway. (any internet request redirect to port 80 in gateway). can do this by iptables? or any other idea? linux redirect iptables 1 Answers Voted hobodave 2011-02-15T15:33:20+08:002011-02-15T15:33:20+08:00 Why do you want to do this? It seems like a fundamentally bad idea. It would go against every known standard of expected operation that exists. That said, you could do this using the PREROUTING chain in iptables. These rules will work for the following assumptions: eth0 is your public interface You only need TCP redirected Your public IP address is 192.1.1.1 You only want to redirect ports 1 through 65535 Rule: iptables -t nat -A PREROUTING -i eth0 -p tcp --dst 192.1.1.1 --dport 1:65535 -j REDIRECT --to-port 80
Why do you want to do this? It seems like a fundamentally bad idea. It would go against every known standard of expected operation that exists.
That said, you could do this using the
PREROUTING
chain in iptables. These rules will work for the following assumptions:Rule: