iptables redirect single website traffic to port 8080
- by Luke John Southard
My goal is to be able to make a connection to one, and only one, website through a proxy. Everything else should be dropped.
I have been able to do this successfully without a proxy with this code:
./iptables -I INPUT 1 -i lo -j ACCEPT
./iptabels -A OUTPUT -p udp --dport 53 -j ACCEPT
./iptables -A OUTPUT -p tcp -d www.website.com --dport 80 -j ACCEPT
./iptables -A INPUT -m conntrack --cstate ESTABLISHED,RELATED -j ACCEPT
./iptables -P INPUT DROP
./iptables -P OUTPUT DROP
How could I do the same thing except redirect the traffic to port 8080 somewhere?
I've been trying to redirect in the PREROUTING chain in the nat table. I'm unsure if this is the proper place to do that tho.
Thanks for your help!