33

I got virtual machine on some server and my URL is something like this.

111.11.11.111:8002

Can I get DNS who will point to specific port ?

One more thing. If I cant do that, can my virtual machine on server be sub-domain of that server DNS ?

4 Answers 4

35

DNS has no concept of ports for older protocols such as HTTP, HTTPS, and SSL. DNS only points to the IP address.

The port to connect to for a particular service is determined by convention. For example the default port for HTTP is 80, the default port for HTTPS is 443, and the default port for SSH is 22.

The only way to override the default port is to specify it in the URL (or on the command line for something like SSH). There is no way to specify port numbers in DNS. If you are running a website, your server must respond to HTTP requests on port 80 if you don't want to have an ugly port number in the URL.


It is not clear to me exactly what you are trying to accomplish.

If you want to run multiple sites on the same server, that is usually possible. You can run multiple sites from different domains or different subdomains all in the same server. You need to configure virtual hosts for that to work.

You may need to run a second server that runs a different technology (for example Tomcat to run Java or a Rails server to run Ruby). In that case, it is common to connect your additional server to your main server using a reverse proxy to remove the port number from the URL.

If you are trying to host your site at home and your ISP is blocking port 80, then you are out of luck. Your only options are to find different hosting or have a port number in the URL.


There is a newer innovation that allows port numbers to be specified by DNS: SRV Records. However, SRV records only work with new protocols that say to use SRV lookups in their specification. Older protocols such as HTTP and HTTPS will continue to use their current port numbers and won't support SRV.

2
  • I have virtual machine on some host who have address www.example.com , but can i get mypage.example.com? That server have about 10 virtual machines and one DNS, can our virtual machines be sub-domains Commented Nov 13, 2013 at 13:54
  • According to this article each virtual machine must have its own IP address. If that is the case, then yes, you can assign a subdomain to a virtual machine by putting the IP address in as a DNS A record. Commented Nov 13, 2013 at 14:54
5

PORT settings is a hosting server side setting and has nothing to do with the DNS. When pointing a domain or sub domain to an IP the hosting server will control the port element via a virtual host file.

So in other words, simply put the A record to IP address and then have the virtual host file control what port the server operates on.

4

What you are looking for is Dynamic DNS (DDNS) with port forwarding and a majority of DDNS service providers are offering port forwarding as well. You can then set up your domain something.something.com to 111.11.11.111:8002

You can get a router with DDNS support and if you configure it properly, the subdomain will be pointing to your home router and from there you can re-direct ports as well.

0

It's possible in apache to have a virtualhost forward to another server, on another port and/or another ip.

So apache acts as a proxy.

It is also possible to run a small virtualhost, that sends a 301 redirect to the other port

Note the first method hides the new port, while the second show it in the url

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