ip masquerading/port forwarding

1999-06-27 Thread Paul Miller

I'm using Debian/unstable and kernel v2.2.10.  I have a ip masquerading
Linux box setup and working.  I'd like to configure ports 137 to 139 of an
internal machine to act as ports 20137 to 20139 on the external interface of
the Linux box.  I.e., the internal ip address sent from the internal machine
is replaced with the external interface's address and anything sent to the
external interface on ports 20137 to 20139, the external interface ip
address is replaced with the internal machines ip addressed and forwarded to
the internal machine on ports 137 to 139.

(I'm trying to get samba/windows networking to work over a linux ip
masquerading box.)

Any ideas?

Thanks
-Paul

BTW- anyone know the ipmasq mailing list?  I tried to subscribe to one of
them and now I'm only getting the digest and can't post messages... (?).



Re: ip masquerading/port forwarding

1999-06-27 Thread Matthew Gregan
On Sun, Jun 27, 1999 at 12:24:03AM -0400, Paul Miller wrote:

 I'm using Debian/unstable and kernel v2.2.10.  I have a ip masquerading
 Linux box setup and working.  I'd like to configure ports 137 to 139 of an
 internal machine to act as ports 20137 to 20139 on the external interface of
 the Linux box.  I.e., the internal ip address sent from the internal machine
 is replaced with the external interface's address and anything sent to the
 external interface on ports 20137 to 20139, the external interface ip
 address is replaced with the internal machines ip addressed and forwarded to
 the internal machine on ports 137 to 139.

Okay, I'm assuming here that you have portfw compiled into the kernel, or 
available as a module, and that you have ipmasqadm installed.

ipmasqadm portfw -a -P tcp -L external.ip 20137 -R internal.ip 137
ipmasqadm portfw -a -P tcp -L external.ip 20139 -R internal.ip 139

...replacing external.ip and internal.ip with the obvious things :-)

Now this works for requests coming in -  requests to port 20137 are rewritten 
to port 137 and forwarded to the internal machine... I think you also want 
something to rewrite the outgoing stuff from the internal machine using port 
137 to 20137 as well, right?

This should do it:

ipmasqadm portfw -a -P tcp -L internal.ip 137 -R external.ip 20137
ipmasqadm portfw -a -P tcp -L internal.ip 139 -R external.ip 20139

...again replacing internal.ip and external.ip with the obvious. However, this 
time you want to use the internal.ip of the masquerading machine (I think, try 
it both ways).

If Samba needs UDP as well (I don't think it does...) then double up the 
entries, replacing 'tcp' with 'udp' for the second ones.

I haven't actually tried this, but it should work fine. Let me know...
-- 
Matthew Gregan  [EMAIL PROTECTED]