Networking Forums

Networking Forums > Computer Networking > Linux Networking > Routing a port through another machine

Reply
Thread Tools Display Modes

Routing a port through another machine

 
 
Newth
Guest
Posts: n/a

 
      08-26-2004, 11:43 AM
Hello everybody.

I have a machine (WinNT) on my local LAN that runs a specific service
on port 8001. On the same LAN, there is a WWW server running a recent
RedHat. Now, I'd like to have the service on my WinNT machines port
8001 to run trough the WWW's 8001, so that it seems to be running the
service.
Route it trough in other words, but hopefully without changing any
settings on the NT machine...

So, I'd like people to see www.foo.no:8001 work like I do on my lan by
connecting to winnt.localnet:8001... Gettit?

Is this possible? I'm thinking iptables and NAT, but I can't make it
work... /=

Please help. Thanks in advance!

- K -

 
Reply With Quote
 
 
 
 
Jeroen Geilman
Guest
Posts: n/a

 
      08-26-2004, 03:45 PM
Newth wrote:

> Hello everybody.
>
> I have a machine (WinNT) on my local LAN that runs a specific service
> on port 8001. On the same LAN, there is a WWW server running a recent
> RedHat. Now, I'd like to have the service on my WinNT machines port
> 8001 to run trough the WWW's 8001, so that it seems to be running the
> service.
> Route it trough in other words, but hopefully without changing any
> settings on the NT machine...
>
> So, I'd like people to see www.foo.no:8001 work like I do on my lan by
> connecting to winnt.localnet:8001... Gettit?
>
> Is this possible? I'm thinking iptables and NAT, but I can't make it
> work... /=


Yes you can ;-)

iptables -t nat -A PREROUTING -i out.si.de.ip -p tcp --dport 8001 \
-j DNAT --to ip.of.nt.box

That's it - really!

The return packets will be taken care of automagically.

--
J

All your bits are belong to us - again.
 
Reply With Quote
 
Vic Hargrave
Guest
Posts: n/a

 
      08-26-2004, 07:49 PM
What if I wanted to do what the original inquirer suggested but also
expose the IP address of the NT box to the outside Internet, because
it has a valid static IP address, and just use the Linux box has a
router. How does that change the command you gave? Thanks in advance.

-- vic

Jeroen Geilman wrote:
> Newth wrote:
>
>> Hello everybody.
>>
>> I have a machine (WinNT) on my local LAN that runs a specific service
>> on port 8001. On the same LAN, there is a WWW server running a recent
>> RedHat. Now, I'd like to have the service on my WinNT machines port
>> 8001 to run trough the WWW's 8001, so that it seems to be running the
>> service.
>> Route it trough in other words, but hopefully without changing any
>> settings on the NT machine...
>>
>> So, I'd like people to see www.foo.no:8001 work like I do on my lan by
>> connecting to winnt.localnet:8001... Gettit?
>>
>> Is this possible? I'm thinking iptables and NAT, but I can't make it
>> work... /=

>
>
> Yes you can ;-)
>
> iptables -t nat -A PREROUTING -i out.si.de.ip -p tcp --dport 8001 \
> -j DNAT --to ip.of.nt.box
>
> That's it - really!
>
> The return packets will be taken care of automagically.
>


 
Reply With Quote
 
Jeroen Geilman
Guest
Posts: n/a

 
      08-27-2004, 05:32 PM
Vic Hargrave wrote:

> What if I wanted to do what the original inquirer suggested but also
> expose the IP address of the NT box to the outside Internet, because it
> has a valid static IP address, and just use the Linux box has a router.
> How does that change the command you gave? Thanks in advance.


If the NT box has an *additional* public address then you can use a
normal route to reach it, and use iptables solely as a means of
controlling what kind of traffic you want to allow.

This does mean that your iptables rules will have to be constructed with
a little more care, since you cannot arbitrarily filter traffic coming
through an interface anymore - you have to filter on addresses.

Essentially - good if you want to keep things simple - it means writing
two sets of rules, with none of them deciding on interface, but solely
on src/dst addresses on whether to route and where.

--
J

All your bits are belong to us - again.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
port 80 blocked from single machine after VPN client install ? scott Windows Networking 0 04-26-2006 11:26 AM
Port Mapping through a Win 2003 Server to a client machine John F Windows Networking 4 11-22-2005 11:51 PM
Routing with a multihomed machine Carolina On-Site Windows Networking 4 06-10-2005 04:50 PM
Request on Local Port 1433 should be redirected to Remote Server/Machine Rubal Jain Windows Networking 1 07-28-2004 01:18 PM
Redirecting a port too another machine using iptables... Victor Cappuccio Linux Networking 1 06-07-2004 09:21 PM



1 2 3 4 5 6 7 8 9 10 11