Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I run a small software company. What I want to do is provide external access to our developers when on-the-go, say labs.company.com, with company.com being hosted elsewhere.

Here's what happens today:

  1. When a user enters labs.company.com a CNAME records tells to look for our_company.office-on-the.net
  2. our_company.office-on-the.net has an A Record which points to my changing IP Address (DynDNS)
  3. My router forwards petitions for services 80, 21, 22, 2222, 4444 to our only server.
  4. The server has virtual hosts to handle different ports.

With the arrival of new servers, I would like store different tools on different servers. Something like:

  • company.com our hosting provider
  • labs.company.com server0
  • svn.labs.company.com server1
  • frameworks.labs.company.com server2

I'd like to use the same ports for the distinct servers, like ssh -p 222 me@frameworks.labs.company.com and ssh -p 222 me@svn.labs.company.com

How can I create an internal DNS server to send the petition to distinct servers on my LAN based on the URL regardless of what port is it ?

What would the port forwarding be like in my router ?

share|improve this question
    
this is not possible, you would need seperate IPs to designate the traffic, your router will not work on domain level but on packet level for IP address. A VPN would solve your isssue of internal vs. external. –  Jakub Nov 26 '10 at 7:53
add comment

2 Answers

Unless you use different ports for different servers you will not be able to do the port forwarding on your router.

share|improve this answer
    
So the answer would be... getting a new, better router which allows port forwarding based on URL ? –  alanboy Jul 28 '10 at 11:34
    
No, you could get a better router, such as a Cisco ASA 5505, which allows you to set up a VPN. Wherever you are, just log into your VPN, and you're as connected as if you're on-site. –  Martijn Heemels Jul 28 '10 at 12:26
    
@alanboy : using a better router would not help since the router only deals with IP addresses and never sees or knows URLs. May be using a HTTP proxy? On the router, redirect port 80 to the proxy and the proxy will dispatch to the actual HTTP servers (quite easy to do with Apache). –  bortzmeyer Oct 11 '10 at 9:16
add comment

I see that you have to option to accomplish the above.

Setup port forwarding for example:
Server A - hosted websites on Port 80
Server B - hosted websites on Port 80
You can use incoming traffic on port 80 and direct it to Server A on port 80
AND
use port 81 for incoming traffic and direct it to Server B on port 80 (This is the most simple and cheapest way to do this!)

Depending on the capability of your Router and how much you can spend, you could obtain multiple external IP address' and assign each IP address port forwards. ie xxx.xxx.xxx.1 points to Server A and xxx.xxx.xxx.2 points to Server B.
The obvious benefit to the second option is that ports can remain the same and depending on which IP address the domain/subdomain is requested your router can handle the request and Route/NAT to the correct server on the correct port.

I hope that makes as much sense on text as it does in my head. If you have any questions let me know and I'll do my best to explain it better!

share|improve this answer
1  
Obtaining multiple external IP address' isnt an option right now :P So what you are saying is use different ports instead of different subdomains? Like, instead of svn.labs.company.com use labs.company.com:81 which would redirect to port 80 on server X ? Exactly what I thought before, but I wanted to know if it was possible using URLs instead of ports, I thought an internal DNS server would save my life. Thanks for answering :D –  alanboy Jul 28 '10 at 11:42
    
Yup - sounds like option 1 is the best plan at the moment for you! DNS would save you if you had multiple external IP's! :P It may be worth checking with your provider i seem to remember them not being too expensive to rent! –  JamesK Jul 28 '10 at 11:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.