Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "james.Q.L" <shijialeeee@yahoo.ca>
To: netfilter@newkirk.us, netfilter@lists.netfilter.org
Subject: Re: another iptables question
Date: Thu, 28 Nov 2002 03:50:25 -0500 (EST)	[thread overview]
Message-ID: <20021128085025.92538.qmail@web14505.mail.yahoo.com> (raw)
In-Reply-To: <200211272111.26736.netfilter@newkirk.us>

[snip]

> > 3.the packet gets DNAT'ed,and all other requierd action are
> > taken,however,the packet is not SNAT'ed. so the same source
> IP
> > address is used on the packet.
> > # my question: what does it have to do with SNAT here?
> shouldn't
> > it see the source come from $INET_IP ?
> 
> This is where it gets more complicated.  If $LAN_BOX sends a
> packet to 
> $INET_IP that gets DNATted and forwarded to the local server,
> the reply from 
> that server will go DIRECTLY to $LAN_BOX since it recongnizes
> the client as 
> an IP that is local to it,

why it see the client from an local IP ? hasn't it been SNAT'ed
to the $INET_IP ?

I am bit confused how the internal machine request the
firewall's $INET_IP. i think the internal request gets SNAT'ed
so it has the $INET_IP after it goes out of the firewall(does
it?), then it finds the $INET_IP via DNS resolve, and come back.
am i right at this point? 
 
> through the 
> gateway.  The solution to this is to SNAT the DNAT.  What you
> do is DNAT the 
> packet as it enters the firewall so that it will be forwarded
> to the server 
> that handles it, even though it came in addressed to the
> firewall/gateway at 
> $INET_IP.  THEN you SNAT that same packet as it leaves the
> firewall, so that 
> the reply from the server will come BACK to the
> gateway/firewall.  On the 
> return trip the SNAT is reversed (so that the packet gets
> forwarded back to 
> the original requesting client) and then the DNAT is reversed
> (so that the 
> client sees it as returning from $INET_IP instead of the
> 'private' IP of the 
> actual server)
> > then later the author has the solution like this:
> > iptables -t nat -A POSTROUTING -p tcp --dst $HTTP_IP --dport
> 80
> > -j SNAT  --to-source $LAN_IP


i was thinking of the $LAN_IP as the ip of $LAN_BOX....

i have read your words couple times and it's still hard to
grasp. it's complicated as you mentioned. &^%*(

=====
/James.Q.L

______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca


      reply	other threads:[~2002-11-28  8:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-27 18:41 another iptables question james.Q.L
2002-11-28  2:11 ` Joel Newkirk
2002-11-28  8:50   ` james.Q.L [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021128085025.92538.qmail@web14505.mail.yahoo.com \
    --to=shijialeeee@yahoo.ca \
    --cc=netfilter@lists.netfilter.org \
    --cc=netfilter@newkirk.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox