iptables redirect single website traffic to port 8080
Posted
by
Luke John Southard
on Server Fault
See other posts from Server Fault
or by Luke John Southard
Published on 2012-07-09T15:23:39Z
Indexed on
2012/09/08
9:40 UTC
Read the original article
Hit count: 197
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!
© Server Fault or respective owner