Subject: Re: is this a job for ipnat?
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: None <erh@nimenees.com>
List: tech-net
Date: 12/04/1999 16:23:09
On Sat, Dec 04, 1999 at 04:03:07PM -0500, der Mouse wrote:
> Now, one of the things in the serial line netlink was code to rewrite a
> particular address/port to another address/port.  This is because I
> have a mud running on 132.206.78.1, on ports 5757 and 7575.  But we
> heard of cases where people could telnet but couldn't specify arbitrary
> port numbers.  So I made the mud listen on port 57575 as well, then
> added code to the serial-line encapsulation so that incoming packets to
> 132.206.78.38 port 23 (telnet) get rewritten to 132.206.78.1 port
> 57575, with the converse rewrite for outgoing packets.  (Of course,
> attempts from the world-at-large to connect to 132.206.78.1 port 57575
> will not work, since the return packets will get rewritten; this is why
> I used a third port.)
> 
> Now I want a similar rewriting effect for the DSL link.  I could, I
> suppose, hack some special-case code into the kernel of the gateway box
> (which is dedicated to the purpose), but I'd rather not.  I was
> considering alternatives and it occurred to me that the NAT code may be
> able to do this.

	This should work just fine with a ipnat rule like:

rdr ppp0 132.206.78.1/32 port=23 -> 132.206.78.1 port=7575 tcp

	This will allow you to connect to 132.206.78.1.23 as if you
were connecting to port 7575.  And, since ipnat keeps track of the
connections it is currectly redirecting you will still be able to connect
to port 7575 normally.

(or
rdr ppp0 132.206.78.38/32 port=23 -> 132.206.78.1 port=7575 tcp
	if you actually want connections to 132.206.78.38.23 to
get redirected.
)

eric