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

I know that it is not possible to configure DNS so that different subdomains get pointed to the same IP, but with different ports. I.e.:

alfa.example.com 10.10.10.1 :550
beta.example.com 10.10.10.1 :560

Because DNS only provides names and addresses - no port numbers.

I have several subdomains, though they are not all for web applications. For example, some of them are been used for terminal servers, other are for mail servers etc.

For this reason, I need different port and I dont want to make the port fixed in the local machine .

Maybe the solution is by setting up proxy servers for those addresses. They can proxy requests or setting up server for the ports that can provide them to the client.

Can you please help me find the best solution?

share|improve this question

closed as not a real question by Sirex, Khaled, Sven, Ward, Iain Dec 24 '11 at 9:06

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

2  
It is not clear what you are trying to do! If I access alfa.example.com without any port, what does this mean? I should be connected to port 550? –  Khaled Dec 22 '11 at 13:30
    
-1; question is /completely/ unreadable and sounds like gibberish even after @Khaled 's attempt at editing. I'm not even going to try giving an answer until I have some idea what the question actually is... –  Shadur Dec 22 '11 at 13:36
    
if i the server dont give any port , the client dont have any permission to enter the service that i provide. so the server must provide an ip with port so the client access it . –  steevoo Dec 22 '11 at 13:39
    
You need to provide more clarity on what you're trying to achieve. It helps if you work 'backwards' and tell us what you want to end up with, rather than what solution you're trying to engineer to get there. –  Dan Dec 22 '11 at 13:40
3  
@steevoo I'm afraid that makes zero sense. Ports are application dependent. If I put an IP address into an FTP client, it'll try and connect on port 21 by default. Internet Explorer will try and connect on Port 80 and so on. If you've written some custom service listening on a non-standard port then your client application will have to type that manually. There MAY be ways around that, but we'd need more detail. –  Dan Dec 22 '11 at 13:41

2 Answers 2

The question is unclear, but there are knowledge bits that may help you :

  • DNS has nothing to do with ports. It returns IP adresses.
  • Unlike what you say, It's perfectly licit to have two names/domain/subdomain pointing on the same IP address.
  • It's perfectly possible to host several websites (with different names) on the same web server. it's called "multi homing" and it works with the server recognizing which site the client is trying to access because it's in the web query. See "apache multi homing" on google on how it works.
  • If you need to access other services (like mail) with different names, just use different ports. It's easy to decide that smtp.toto.com is on port 1001 and smtp.titi.com is on port 1002. What confuses you is that those services use default ports which are not expressed. But when explicitely deciding the port to use, there is no more confusion.
  • for terminal service, well, it's the same machine so who care about using different ports for different names ?

P.S. not sure about how smtp (mail) works. Maybe it's possible to do multi-homing for it, too.

share|improve this answer
    
so there is no way to provide the port to the client ????? –  steevoo Dec 22 '11 at 14:22
    
@steevoo well, you just give it manually. Look at this page : support.google.com/mail/bin/answer.py?hl=fr&answer=180189 google gives us the ports on which we should access its mail servers. And we put them in our software. Can you be more explicit on your requirements ? Concrete example ? –  Offirmo Dec 22 '11 at 14:49

I think the answer you're looking for is "No".

There are ways to redirect ports and so on, but ultimately, your client software has to make a request on a port, whether that be entered by the user or written into code or whatever. Either way, it's a client-side issue and you can't solve it server side. They aren't able to just make a request to an IP address in general.

As an example, when you type serverfault.com to in your address bar, Internet Explorer is really going to serverfault.com:80

There's no magic here, it just makes the assumption that a website is going to be on port 80 as that's the official port. The developers could just have easily forced us to choose each time, but they opted to be nice.

If the website was on port 81 for some reason the request would simply fail and you'd have to manually type serverfault.com:81

share|improve this answer

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