Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a [game] server (CentOS) that has about 10 used ports. For one game in particular, I have 2 servers: a private one and a public one.

The IP for them is the same, so to differentiate between them the user must use mydomain.com:[portnumber].

Is there a way that I can configure CentOS to automatically take something like subdomain.mydomain.com and transform it to mydomain.com:[portnumber] or simple localhost:[portnumber]?

Is this what a DNS is for?

share|improve this question

migrated from stackoverflow.com Sep 11 '11 at 2:56

This question came from our site for professional and enthusiast programmers.

2 Answers 2

If it is completely your application and you have control over your DNS, you can define a SRV record for your game. Your clients have to understand then that you have defined a _gamename._tcp.example.com SRV record in order to give the user a way to use example.com to access the server at the right port.

Sounds complicated and nearly unfeasible if you just use an existing game server and host it, but it is the only way to include a port number in DNS.

If this is not possile, just take the "normal" port for the public server (so that the user does not have to worry about), and the "other" port for the private server (where you have to specify the port, but the user base is limited s the "total sum of worries" is smaller.)

share|improve this answer
    
The important takeaway here is that the client would need to understand it must request an SRV record, meaning generally this type of setup must be accounted for when the client is designed. –  Bacon Bits Sep 11 '11 at 4:23

Is this what a DNS is for?

No, not really. DNS is for resolving domain names to IP addresses. Port numbers are determined by the application.

If you need to run multiple instances of a service on the same port, typically you need to employ a server that understands multiple instances (such as Apache with VirtualHosts), a superserver of some kind, multiple IP addresses, or a firewall capable of deep packet inspection which can determine the correct Port Address Translation to use (but in that case the firewall must understand the application protocol being used).

share|improve this answer

Your Answer

 
discard

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