Skip to contentSkip to conversation

REDIRECT question

DISCUSSION Ruslan Spivak 2 participants 3 messages Jul 2, 2003

lore
Share & tools
lore
#0 lore raw

Hello, netfilter users.

i want make transaparent proxy on localhost and want to disabe access after redirecting to port 3128 if destination address in net other then 193.108.240.0/22. Does REDIRECT target send packet to INPUT chain and i should disable access in INPUT chain or should i disable access in '-t nat -A POSTROUTING' chain?

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

Thanks in advance. Your help is very, very appreciated.

Best regards,
Ruslan

#1 lore raw

Hi Ruslan,

Quoted 6 lines

i want make transaparent proxy on localhost and want to disabe access after redirecting to port 3128 if destination address in net other then 193.108.240.0/22.
Does REDIRECT target send packet to INPUT chain and i should disable access in INPUT chain or should i disable access in '-t nat -A POSTROUTING' chain?

You will not be able to disable access in the POSTROUTING chain, since after reading the REDIRECT rule, no further rules in that chain are processed. In any case, it is not recommended to filter in the nat table. The best place to put your filtering rule is in the INPUT chain.

Cheers, Chris.

Signature · 4 lines
   ___ __     _
 / __// / ,__(_)_  | Chris Wilson -- UNIX Firewall Lead Developer |
/ (_ / ,\/ _/ /_ \ | NetServers.co.uk http://www.netservers.co.uk |
\ _//_/_/_//_/___/ | 21 Signet Court, Cambridge, UK. 01223 576516 |
#2 lore raw
Quoted 4 lines · Chris Wilson

Hi Ruslan,

Quoted 9 lines
Quoted 4 lines

i want make transaparent proxy on localhost and want to disabe access after redirecting to port 3128 if destination address in net other then 193.108.240.0/22. Does REDIRECT target send packet to INPUT chain and i should disable access in INPUT chain or should i disable access in '-t nat -A POSTROUTING' chain?

You will not be able to disable access in the POSTROUTING chain, since after reading the REDIRECT rule, no further rules in that chain are processed. In any case, it is not recommended to filter in the nat table. The best place to put your filtering rule is in the INPUT chain.

Cheers, Chris.

Hello, Chris.

I just want to be sure that after redirecting, the packet is going to input chain where i can filter it. (am i right?)

Thanks for your reply.

Best regards,
Ruslan