transparent squid & iptables
Hello, All.
We tried to make transparent squid on 127.0.0.1 and REDIRECT (or DNAT) in iptables but iptables redirect pakets to the received interface IP.
In the iptables:
iptables -t nat -A PREROUTING -p TCP --dport 80 -j REDIRECT 3128
For example:
packet from user (IP: 10.0.0.5) to www.ru:80 received on eth0 (IP: 10.0.0.1). Packet redirected to the 10.0.0.1:3128 but squid listen on 127.0.0.1:3128 so nothing work ;-(
How we can redirect packet to the 127.0.0.1 port 3128 in iptables ?!
wbr, Abylai
NetUP Systems
Moscow, Russia
iptables -A PREROUTING -t nat -p 6 --dport 80 -j REDIRECT --to-port 3128
Quoted 15 lines · Abylai Ospan
Hello, All.
We tried to make transparent squid on 127.0.0.1 and REDIRECT (or DNAT) in iptables but iptables redirect pakets to the received interface IP.
In the iptables:
iptables -t nat -A PREROUTING -p TCP --dport 80 -j REDIRECT 3128For example:
packet from user (IP: 10.0.0.5) to <http://www.ru>www.ru <http://www.ru>:80 received on eth0 (IP: 10.0.0.1). Packet redirected to the 10.0.0.1:3128 but squid listen on 127.0.0.1:3128 so nothing work ;-(How we can redirect packet to the 127.0.0.1 port 3128 in iptables ?!
wbr, Abylai
NetUP Systems
Moscow, Russia
Hi,
Here is how I am doing it and it works nicely:
iptables -t nat -A PREROUTING -i $LOCAL -p tcp --dport 80 -j REDIRECT \
--to-port 3128
echo "PREROUTING: enableling transparent http proxy"
Have fun!
Andy
Quoted 18 lines · Abylai Ospan
Hello, All.
We tried to make transparent squid on 127.0.0.1 and REDIRECT (or DNAT) in iptables but iptables redirect pakets to the received interface IP.
In the iptables:
iptables -t nat -A PREROUTING -p TCP --dport 80 -j REDIRECT 3128For example:
packet from user (IP: 10.0.0.5) to www.ru <http://www.ru>:80 received on eth0 (IP: 10.0.0.1). Packet redirected to the 10.0.0.1:3128 but squid listen on 127.0.0.1:3128 so nothing work ;-(How we can redirect packet to the 127.0.0.1 port 3128 in iptables ?!
wbr, Abylai
NetUP Systems
Moscow, Russia