Networking Forums

Networking Forums > Computer Networking > Linux Networking > Internal port forwarding SuSE

Reply
Thread Tools Display Modes

Internal port forwarding SuSE

 
 
Vincent van Beveren
Guest
Posts: n/a

 
      07-25-2006, 07:31 AM
Hi everyone,

I have a Linux box which has mutliple IP's and I have the following two
IP table rules:

iptables -t nat -A PREROUTING -d 192.168.1.1
-p tcp --dport 80 -j REDIRECT --to-port 8080
iptables -t nat -A PREROUTING -d 192.168.1.2
-p tcp --dport 80 -j REDIRECT --to-port 8081

It has two separate DNS entries for these IPs. Now from the outside this
works perfectly, but locally it doesn't. How can I rewrite these rules
to also work locallly?

Thanks in advance,
Vincent
 
Reply With Quote
 
 
 
 
Steve Maddison
Guest
Posts: n/a

 
      07-25-2006, 10:10 AM
Vincent van Beveren wrote:
> I have a Linux box which has mutliple IP's and I have the following two
> IP table rules:
>
> iptables -t nat -A PREROUTING -d 192.168.1.1
> -p tcp --dport 80 -j REDIRECT --to-port 8080
> iptables -t nat -A PREROUTING -d 192.168.1.2
> -p tcp --dport 80 -j REDIRECT --to-port 8081
>
> It has two separate DNS entries for these IPs. Now from the outside this
> works perfectly, but locally it doesn't. How can I rewrite these rules
> to also work locallly?


Hi Vincent,

I may be oversimplifying things here, but wouldn't it be easier to just
have your daemon (I take it it's a web server) listen on port 80 of the
two IP addresses you listed?

Just a thought,

Steve
 
Reply With Quote
 
Vincent van Beveren
Guest
Posts: n/a

 
      07-25-2006, 10:32 AM
Steve Maddison wrote:
> Vincent van Beveren wrote:
>>
>> iptables -t nat -A PREROUTING -d 192.168.1.1
>> -p tcp --dport 80 -j REDIRECT --to-port 8080
>> iptables -t nat -A PREROUTING -d 192.168.1.2
>> -p tcp --dport 80 -j REDIRECT --to-port 8081
>>
>> It has two separate DNS entries for these IPs. Now from the outside this
>> works perfectly, but locally it doesn't. How can I rewrite these rules
>> to also work locallly?

> [...]
> I may be oversimplifying things here, but wouldn't it be easier to just
> have your daemon (I take it it's a web server) listen on port 80 of the
> two IP addresses you listed?
>


Hi Steve,

Thanks for your reply. It would possible if the webserver (as you
assumed correctly) was running as root. But as far as I know I can't run
a process as someone other than root when the port assignment is below
1024 and for security reasons we don't want the daemon to run as root.

Vincent
 
Reply With Quote
 
Steve Maddison
Guest
Posts: n/a

 
      07-25-2006, 10:56 AM
Vincent van Beveren wrote:
> Thanks for your reply. It would possible if the webserver (as you
> assumed correctly) was running as root. But as far as I know I can't run
> a process as someone other than root when the port assignment is below
> 1024 and for security reasons we don't want the daemon to run as root.


Most daemons these days start up as root then drop their priveleges and
run as a different user. This way the process is able to open the
priveleged port and yet does not (after initialisation) run as root. May
be something worth looking into before going any further with all that
NAT stuff.

--Steve
 
Reply With Quote
 
Vincent van Beveren
Guest
Posts: n/a

 
      07-25-2006, 11:23 AM
> Most daemons these days start up as root then drop their priveleges and
> run as a different user. This way the process is able to open the
> priveleged port and yet does not (after initialisation) run as root. May
> be something worth looking into before going any further with all that
> NAT stuff.
>
> --Steve


Hi Steve,

Is that a feature the deamon itself should support, or is there a
command I should execute after starting the deamon? I haven't been able
to find anything on this subject.

Thanks,
Vincent
 
Reply With Quote
 
Steve Maddison
Guest
Posts: n/a

 
      07-25-2006, 03:28 PM
Vincent van Beveren wrote:
> Is that a feature the deamon itself should support, or is there a
> command I should execute after starting the deamon? I haven't been able
> to find anything on this subject.


AFAIK it is something the daemon itself has to do. If it supports it,
you should find somthing in the docs. Otherwise browse through the
configuration file(s) and see if there's anything about users/groups in
there.

--Steve
 
Reply With Quote
 
Vincent van Beveren
Guest
Posts: n/a

 
      07-26-2006, 07:17 AM
>
> AFAIK it is something the daemon itself has to do. If it supports it,
> you should find somthing in the docs. Otherwise browse through the
> configuration file(s) and see if there's anything about users/groups in
> there.


I know this software almost inside out, and there is no such option.
Because its a java app, it'll be hard to invoke any native api to switch
the user. So, if nobody knows a command-line utility that might do the
the trick I'll have to use the port redirect which still doesn't
function locally.

Thanks for your input so far though!
Vincent
 
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
Netgear 834 port forwarding to different internal port? Ric Home Networking 8 12-07-2008 08:21 PM
Forwarding ports to internal server Mr. Smith Windows Networking 2 10-31-2008 01:37 PM
2Wire 1000HG - help using internal static address as port forwarding destintation google@dcbarry.com Network Routers 16 09-05-2006 11:12 PM
port tunneling over ssh (not port-forwarding in the traditional sense) C3 Linux Networking 1 07-26-2006 03:44 PM
Help with port forwarding to an internal NAS device? Bob_M Network Routers 0 06-24-2005 11:33 AM



1 2 3 4 5 6 7 8 9 10 11