Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Joel Newkirk <netfilter@newkirk.us>
To: - = k o l i s k o = - <kolisko@penguin.cz>,
	netfilter@lists.netfilter.org
Subject: Re: iptables question - NAT/Masq
Date: Tue, 21 Jan 2003 01:59:01 -0500	[thread overview]
Message-ID: <200301210159.01621.netfilter@newkirk.us> (raw)
In-Reply-To: <1043079320.14910.73.camel@kolisko>

On Monday 20 January 2003 11:15 am, - = k o l i s k o = - wrote:
> Hi all,
>
> i have the following situation:
>
>
> nntp clients -- [internet] --+-- server1:119
>
>                              +-> server2:119
>
> we manage the server1. It is a server with more services (web, ftp,
> pop3, ...). The new service will be nntp(119) but we dont want to
> install there a news SW. We only need forward all nntp/news traffic to
> another server - server2.
>
> server2 is not our server, but this server accept all the traffic from
> source IP address of server1. There is not possible to accept directly
> the traffic from all clients becouse they dont have the same address
> like server1 of course.
>
> What we need is to configure a server1 to accept all connections from
> clients to port 119(news) and forward it to destination server2 but
> with source address of server1.
>
> Note that server1 have only one NIC interface.
>
> I have this on the server1 and it dont work:
>
> /sbin/iptables -t nat -A PREROUTING -i eth0+ --protocol tcp
> --destination-port 119 -j DNAT --to-destination server2:119

First, you should probably be using "-i eth+", since I presume you are 
trying to tell it to match ALL ethernet devices.

Second, all this does it change the destination of the traffic to 
server2.  You still need to change the sourceIP of that traffic so that 
it appears to come from server1.  Try adding this:

/sbin/iptables -t nat -A POSTROUTING -d server2 --dport 119        \
-j SNAT --to server1

where of course 'server1' and 'server2' are both replaced with their 
corresponding IPs.

j



      reply	other threads:[~2003-01-21  6:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-20 16:15 iptables question - NAT/Masq - = k o l i s k o = -
2003-01-21  6:59 ` Joel Newkirk [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=200301210159.01621.netfilter@newkirk.us \
    --to=netfilter@newkirk.us \
    --cc=kolisko@penguin.cz \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox