Linking Domain Names to Port Numbers

0

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?

alecwhardy

Posted 2011-09-10T06:07:55.613

Reputation:

Answers

0

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.)

glglgl

Posted 2011-09-10T06:07:55.613

Reputation: 1 327

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 – 2011-09-11T04:23:20.367

0

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).

Bacon Bits

Posted 2011-09-10T06:07:55.613

Reputation: 6 125