F
F
facha2011-06-27 13:07:32
iptables
facha, 2011-06-27 13:07:32

Question about transparent proxy and iptables (DNAT vs redirect)?

I'm trying to set up a transparent proxy with squid and iptables. For iptables in two different places, I found 2 different rules that will transparently redirect requests to the 80th port to my squid:

iptables -t nat -A PREROUTING -i eth0.20 -p tcp --dport 80 -j REDIRECT --to-port 3128

or
iptables -t nat -A PREROUTING -i eth0.20 -p tcp --dport 80 -j DNAT --to 192.168.125.1:3128

Both rules work. Actually the question is which method is more ideologically correct, DNAT or REDIRECT? Or is it the same thing?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2011-06-27
@facha

REDIRECT is only for the local machine (see, there is not even an ip-address in the rule, only a port), DNAT - anywhere.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question