From: Pascal Hambourg <pascal.mail@plouf.fr.eu.org>
To: netfilter@lists.netfilter.org
Subject: Re: is it possible to nat to the routed IP?
Date: Tue, 19 Dec 2006 00:06:23 +0100 [thread overview]
Message-ID: <45871EEF.3070008@plouf.fr.eu.org> (raw)
In-Reply-To: <ad41208c0612170208h70c43da2ldb684d1ccbf76767@mail.gmail.com>
Zhen Zhou a écrit :
> On 12/16/06, Pascal Hambourg <pascal.mail@plouf.fr.eu.org> wrote:
>>
>> Insert this kind of rule before the generic SNAT rule :
>>
>> $ipt -t nat -A POSTROUTING -o <interface> -s 192.168.2.208 -p <proto> \
>> [--dport <port>] -j SNAT --to 210.153.22.y
>
> Thanks for your help, but the issue is still there, so I post what I
> add iptables rules in the system then we could analyze where is the
> issue:
>
> iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
> iptables -A FORWARD -m state --state NEW -d 192.168.3.208 -p tcp
> --dport 80 -j ACCEPT
> iptables -t nat -A PREROUTING -d 210.153.22.y -p tcp --dport 80 -j
> DNAT --to 192.168.3.208
So far so good.
> iptables -t nat -A POSTROUTING -o 210.153.22.y -s 192.168.3.208 -p tcp
> --sport 80 -j SNAT --to 210.153.22.y
The -o (output interface) option takes a network interface name, not an
IP address. Also, why do you match on source port 80 ? NAT rules can
match only packets in the NEW state opening a new connection, but TCP
packets with source port 80 are usually return packets (thus in
ESTABLISHED state) from a web server.
> I assign:
> ip addr add 210.153.22.y dev eth1 label eth1:1
>
> in the another hand, I want to track the network link when I access
> web to some sites, nothing show me via:
> netstat -ant | grep 192.168.3.208
> nothing .....
netstat shows only the state of local sockets, not forwarded
connections. To see the the state of all tracked connections (incoming,
outgoing and forwarded), use :
cat /proc/net/ip_conntrack
prev parent reply other threads:[~2006-12-18 23:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-12 6:34 is it possible to nat to the routed IP? Zhen Zhou
2006-12-12 8:23 ` Rob Sterenborg
2006-12-12 15:18 ` Zhen Zhou
2006-12-12 17:54 ` Rob Sterenborg
2006-12-16 5:47 ` Zhen Zhou
2006-12-16 8:05 ` Rob Sterenborg
2006-12-16 11:02 ` Pascal Hambourg
2006-12-17 10:08 ` Zhen Zhou
2006-12-18 23:06 ` Pascal Hambourg [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=45871EEF.3070008@plouf.fr.eu.org \
--to=pascal.mail@plouf.fr.eu.org \
--cc=netfilter@lists.netfilter.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.