I want to access certain websites via a public proxy and I can't seem to get it right using iptables. Let's say I want to access example.com having ip address 1.2.3.4 via a public proxy at 5.6.7.8:8080. What I do is:
iptables -t nat -A PREROUTING --dst 1.2.3.0/24 -p tcp --dport 80 -j DNAT --to-destination 5.6.7.8:8080
iptables -t nat -A POSTROUTING --dst 5.6.7.8 -p tcp --dport 8080 -j SNAT --to-source 1.2.3.4:80
iptables -t nat -A OUTPUT --dst 1.2.3.0/24 -p tcp --dport 80 -j DNAT --to-destination 5.6.7.8:8080
But then I can't load the webpage at all (as if the proxy is not reachable, but it is, because I test it by setting it in the browser's proxy settings when no routing rules are set). What am I doing wrong?
Aucun commentaire:
Enregistrer un commentaire