NetFilter
[Top] [All Lists]

Re: is it possible to nat to the routed IP?

To: netfilter@lists.netfilter.org
Subject: Re: is it possible to nat to the routed IP?
From: "Zhen Zhou" <zhouzhenzj@gmail.com>
Date: Tue, 12 Dec 2006 23:18:42 +0800
Delivered-to: sp-com-lists@consult.net
Delivered-to: netfilter-list1@securepoint.com
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=rL/hTHjhEzPD7Uh4LfVciiLsI2PRamCVSqWQeZheq7KbXHB847Fn2TtMTQJxahk+ePCssH+jiNyeoEGZtoMuvoun2pda75dUPCOnstsh0YmZ5yIq6VZrYSqDX8LpJGP7JDKGFpHZG2D7N3GexNsb98g1uqJTTuM+tbz//RMb95g=
In-reply-to: <1148.193.173.119.247.1165911824.squirrel@webmail.sterenborg.info>
List-archive: </pipermail/netfilter>
List-help: <mailto:netfilter-request@lists.netfilter.org?subject=help>
List-id: General discussion and user questions <netfilter.lists.netfilter.org>
List-post: <mailto:netfilter@lists.netfilter.org>
List-subscribe: <https://lists.netfilter.org/mailman/listinfo/netfilter>, <mailto:netfilter-request@lists.netfilter.org?subject=subscribe>
List-unsubscribe: <https://lists.netfilter.org/mailman/listinfo/netfilter>, <mailto:netfilter-request@lists.netfilter.org?subject=unsubscribe>
References: <ad41208c0612112234m5f2e564fm217faff87955641a@mail.gmail.com> <1148.193.173.119.247.1165911824.squirrel@webmail.sterenborg.info>
Sender: netfilter-bounces@lists.netfilter.org
On 12/12/06, Rob Sterenborg <rob@sterenborg.info> wrote:

On Tue, December 12, 2006 07:34, Zhen Zhou wrote:
> Hi all,
>
>
> one example network looks like:

[ASCII image skipped)

> So is it possible to nat from 210.153.22.y to 192.168.2.208?
> If possible, how to do it

The gateway must have a route for 192.168.2.x set to 192.168.5.202.
The default gateway for the router must be 192.168.5.201.
The default gateway for 192.168.2.208 must be 192.168.3.254.

Packet arrives at 210.153.22.y.
Packet is DNAT-ed to 192.168.2.208.
Gateway sends packet to 192.168.5.202.
Router at 192.168.5.202 routes packet to 192.168.2.208.

Example, http:

$ipt -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
$ipt -A FORWARD -m state --state NEW -d 192.168.2.208 \
  -p tcp --dport 80 -j ACCEPT

$ipt -t nat -A PREROUTING -d 210.153.22.y -p tcp --dport 80 \
  -j DNAT --to 192.168.2.208


Grts,
Rob


Thanks a lot, now it works perfect.

Now the another issue is coming:

before we monitor the gateway network traffic via snmp, because I
assign 210.153.22.y to eth1, so I get snmp figure from eth1, and then
draw the network traffic, but  I am lazy to IP alias, so I use:
ip addr add 210.153.22.y dev eth1

Ofcs, the result is that I couldn't monitor it via snmp, at this kind
status, how could I monitor network traffic?

any tips, thanks a lot,

Zhou


<Prev in Thread] Current Thread [Next in Thread>