Linux Netfilter discussions
 help / color / mirror / Atom feed
* iptables port redirect question
@ 2012-09-17  5:33 joydeep
  2012-09-17  6:12 ` Michal Kubeček
  0 siblings, 1 reply; 4+ messages in thread
From: joydeep @ 2012-09-17  5:33 UTC (permalink / raw)
  To: netfilter

Hello,

How can I redirect all packets exclude the packets for lan ( 192.168.0.0 ) and
all packets to/from lo (localhost) ?

I have done something like

[.......]

    # Traffic on the loopback interface is accepted.
    iptables -A INPUT -i lo -j ACCEPT

   # Internal network connections are accepted. 
    iptables -A OUTPUT -d 192.168.0.0/255.255.0.0 -j ACCEPT


 iptables -t nat -A OUTPUT ! -o lo -p tcp -m tcp -j REDIRECT --to-ports 8080
 iptables -t filter -A OUTPUT -p tcp -m tcp --dport 8080 -j ACCEPT
 iptables -t filter -A OUTPUT ! -o lo -j DROP

[...............]

But this also redirect all local lan packets naturally, as it compares with lo . How can I combined both lo and local lan ?
Can a customized chain help ?

Thanks

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-09-17  7:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-17  5:33 iptables port redirect question joydeep
2012-09-17  6:12 ` Michal Kubeček
2012-09-17  7:17   ` joydeep.bakshi
2012-09-17  7:31     ` Jan Engelhardt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox