-2

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?

Dan
  • 15,430
  • 1
  • 36
  • 67
steevoo
  • 131
  • 1
  • 1
  • 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
  • i dont want to use standart port i want to provide different port and those ports should not be fixed at the client machine, i want a way to provide the port to the client as i provide the ip by the dns – steevoo Dec 22 '11 at 13:48
  • DNS doesn't work that way, if you want a client to connect to a service on a non standard port, you need to somehow tell the client to use the non standard port, e.g. in a web browser you'd use `www.example.com:1234` to use port 1234 instead of 80, but there isn't a way of doing this automatically. – Bryan Dec 22 '11 at 14:04
  • yeh i want to know this somehow u talk about, i want a way to provide the client by the port not necessary by dns, did u have any solution that can solve this? – steevoo Dec 22 '11 at 14:13

2 Answers2

3

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.

Offirmo
  • 141
  • 3
  • 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 : http://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
0

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

Dan
  • 15,430
  • 1
  • 36
  • 67