Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access different services using the same port

Status
Not open for further replies.

ducey

Programmer
Apr 2, 2003
8
GB
Hi,

I was wondering if anyone could help me to solve a problem I'm having.

I want to run two services on port 80 using my ADSL account domain name that points at my static IP.

My current setup is as follows:

Internet -> Netgear ADSL Modem/Router -> Server1/server2/PC/PC


Server1 runs Linux (RedHat8), server2 (WinXP), PCs both run WinXP

My Netgear router is only capable of port forwarding, so I can only specify one server to receives requests on port 80.

Is there a way I can filter the incoming requests on port 80 and direct them to the correct server using my current setup?

Or would it be possible to run a check on my server that accepts all port 80 requests and then that forwards onto my other server depending upon the headers?

I've had a look into this and have read different things covering VHosts, Reverse DNS and NAT setups. However, those all confused me a bit.

Does anyone know if what I want is possible or how to go about doing it?

Any help is much appreciated.

Thanks, Nathan
 
There is no way to use port forwarding to route incoming requests to multiple hosts. So you would need some other way to accomplish this.

The only way that I can think of off-hand, would be to have all initial incoming requests handled by a single machine, and then use a "redirect" based on Java, Javascript or ASP for the connections that you would like redirected.

You would have to run the second server on a different port (for port forwarding), say 81 or 8000 or 8080. You have the redirect go to <ip address>:81.


pansophic
 
Thanks very much pansophic. I've just implemented what you suggest, running the services on different ports and it seems to be working fine :)
Thanks for the help :)
 
What language did you end up using and how are you determining which connections to redirect?


pansophic
 
I cheated and setup my router to direct port 8080 to my web server and port 80 to my other server. So I didn't have to program anything really.
Thanks for your help :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top