Linux Netfilter discussions
 help / color / mirror / Atom feed
* FORWARD-ed packet doens't reach POSTROUTING
@ 2004-08-20 13:59 Fred Gansevles
  2004-08-23 18:45 ` Aleksandar Milivojevic
  0 siblings, 1 reply; 3+ messages in thread
From: Fred Gansevles @ 2004-08-20 13:59 UTC (permalink / raw)
  To: netfilter; +Cc: fred

Hello,

First: I'm not subscribed to this list so please make sure that any reply is 
also sent to: fred@gansevles.defamilie.nl

I have a weird problem trying to setup multiple routes on my NAT-box

I have the following setup:

 <local network>  <NAT-box>
 [192.168.0.0/24]  eth0: 192.168.0.1
     eth1: <adsl.static.ip>
     tunl1: <tunnel to remote NAT-box via eth1>

The remote NAT-box can reach a special subnet which I want to connect to.
The special subnet is also reachable thru eth1, but I want the packages that 
reach the special subnet to be NAT-ted by the remote NAT-box

On my NAT-box I add the following route:

 ip route add <special.sub.net> dev tunl1

the relevant iptables rules are:
 iptables -t nat -A POSTROUTING -s 192.168.0.0/255.255.255.0 -o eth1 \
  -j SNAT --to-source <adsl.static.ip>
 iptables -t nat -A POSTROUTING -o tunl1 \
  -j SNAT --to-source <adsl.static.ip>

All messages originating from my NAT-box for the special subnet are routed 
through tunl1 and SNAT-ted by the second iptables rule

All messages originating from my local subnet for the special subnet are 
routed through tunl1 and *NOT* SNAT-ted by the second iptables rule (the 
packages never reach the POSTROUTING chain)

If I remove the special subnet route with:

 ip route del <special.sub.net> dev tunl1

then all messages originating from my local subnet for the special subnet are 
routed through eth1 and SNAT-ted by the first iptables rule

All messages originating from my NAT-box for the special subnet are directely 
routed through eth1 and *NOT* SNAT-ted (no matching rule for 
SRC=<adsl.static.ip>)

Summarizing: When I want to reach the special subnet using the remote NAT-box 
I can only do this *ON* the NAT-box and all machines in my local subnet cat 
*NOT REACH THE special subnet AT ALL*



Can anybody shed some light on this problem?
Please send relies to: fred@gansevles.defamilie.nl


^ permalink raw reply	[flat|nested] 3+ messages in thread
* RE: FORWARD-ed packet doens't reach POSTROUTING
@ 2004-08-23 18:20 Jason Opperisano
  0 siblings, 0 replies; 3+ messages in thread
From: Jason Opperisano @ 2004-08-23 18:20 UTC (permalink / raw)
  To: Fred Gansevles, netfilter

> Hello,
>
> First: I'm not subscribed to this list so please make sure that any reply is
> also sent to: fred@gansevles.defamilie.nl
>
> I have a weird problem trying to setup multiple routes on my NAT-box
>
> I have the following setup:
>
>  <local network>  <NAT-box>
>  [192.168.0.0/24]  eth0: 192.168.0.1
>      eth1: <adsl.static.ip>
>      tunl1: <tunnel to remote NAT-box via eth1>
>
> The remote NAT-box can reach a special subnet which I want to connect to.
> The special subnet is also reachable thru eth1, but I want the packages that
> reach the special subnet to be NAT-ted by the remote NAT-box
>
> On my NAT-box I add the following route:
>
>  ip route add <special.sub.net> dev tunl1
>
> the relevant iptables rules are:
>  iptables -t nat -A POSTROUTING -s 192.168.0.0/255.255.255.0 -o eth1 \
>   -j SNAT --to-source <adsl.static.ip>
>  iptables -t nat -A POSTROUTING -o tunl1 \
>   -j SNAT --to-source <adsl.static.ip>

also of relevance would be your actual FORWARD rules.  as in--provide the output of "iptables -vnL FORWARD"

> All messages originating from my NAT-box for the special subnet are routed
> through tunl1 and SNAT-ted by the second iptables rule
>
> All messages originating from my local subnet for the special subnet are
> routed through tunl1 and *NOT* SNAT-ted by the second iptables rule (the
> packages never reach the POSTROUTING chain)
>
> If I remove the special subnet route with:
>
>  ip route del <special.sub.net> dev tunl1
>
> then all messages originating from my local subnet for the special subnet are
> routed through eth1 and SNAT-ted by the first iptables rule

something tells me that your FORWARD rules are specifying some combination of "-s 192.168.0.0/24" and "-o eth1"

if the packets are getting dropped in the FORWARD chain of the filter table; then no, they will never make it to the POSTROUTING chain of the nat table.

> All messages originating from my NAT-box for the special subnet are directely
> routed through eth1 and *NOT* SNAT-ted (no matching rule for
> SRC=<adsl.static.ip>)
>
> Summarizing: When I want to reach the special subnet using the remote NAT-box
> I can only do this *ON* the NAT-box and all machines in my local subnet cat
> *NOT REACH THE special subnet AT ALL*

the filter rules controlling packets from the NAT box itself are the OUTPUT rules; while the filter rules controlling the packets from your local subnet are FORWARD rules...something tells me there's a key difference between those sets of rules.  without posting your rules; it is very difficult to tell you what is wrong.  if you feel so inclined; provide the output of:  iptables -vnL && iptables -t nat -vnL && iptables -t mangle -vnL

-j


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

end of thread, other threads:[~2004-08-23 18:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-20 13:59 FORWARD-ed packet doens't reach POSTROUTING Fred Gansevles
2004-08-23 18:45 ` Aleksandar Milivojevic
  -- strict thread matches above, loose matches on Subject: below --
2004-08-23 18:20 Jason Opperisano

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