Networking Subdomains – How to Host Different Machines with Different Subdomains

ddnsdnsdomainnetworkingsubdomain

this is a newbie question and may have been asked in some variation previously which I read but didn't quite understand.

So my scenario is the following:

Currently I am running e.g. a TS3Server und the domain myname.ddns.net . I have to tell my friends/newcomers every time "Hey please connect to myname.ddns.net:12321". .ddns.net is a free domain hosted by no-ip without any further features. I am planning to switch to another provider to get a paid, more serious domain like myname.net and have full control over all DNS records.
My plan then is, instead of saying "Connect to myname.ddns.net:12321" I can say "Hey connect to ts3.myname.net". The same would be with a mail server, cloud server, game server. E.g cloud.myname.net, mail.myname.net etc.

Why is it that regarding how DNS works, I as an individual can't tell the .myname-DNS-Server to ask my OWN private DNS-Server where e.g cloud.myname.net is located?!

I want my own DNS server because many providers limit the amount of sub-domains available and I don't if it's possible to have sub-sub-domains.
Because with Teamspeak I could imagine having my friends connect via ts3.myname.net and have them control e.g. a music bot via musicbot.ts3.myname.net. That's why I want to have full control over how many sub-domains I have.

PS: The comments mention myname.tk which is another domain I registered because I didn't want that .ddns. in the middle of the domain and Freenom which is the company that provides me with myname.tk allows for more sophisticated control over DNS records.

Best Answer

I have what I regard as a fairly straightforward solution, though I'm the first to admit that it is not a high-performance one. Since I am on ADSL, information from my home server is down-loaded at my up-load speeds, so performance is not a primary concern.

  • Because I already had it, I used a small web-site on a public host (equivalent to myname.Public.Host in your example).
  • My domain registrar offers a minimal package of domain registration and web-site / e-mail forwarding.
  • I forward my primary domain to the public web-site (myname.Public.Host).
  • I use web-site folders, rather than subdomains to address my home servers, so that (using your example) I would address the cloud server with www.myname.tk/cloud, though I see no reason that a CNAME record for cloud.myname.tk can't point to the same address (myname.public.host/cloud/), though I haven't tried it.
  • I create myname.public.host/cloud/index.htm containing the following code (I'm sorry, I can't acknowledge the source of this code, as I've lost the reference):
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>AFH - Web Server Home</title>
<META HTTP-EQUIV="Refresh" CONTENT="1; URL=http://myname.Dynamic.DNS/cloud">
</head>
<html>
  • This is how I use it, but for my WebCam I use URL=http://myname.Dynamic.DNS:WebCamPort: my router is able to map WebCamPort to 80 on the WebCam's IP, and this seems to work well: although I'm using ports, this is completely transparent when the site is accessed as www.myname.tk/WebCam.
  • In principle, you can use the same technique, so myname.public.host/cloud/index.htm would transfer you to URL=http://myname.Dynamic.DNS:CloudPort, etc, and the different ports provide you with a simple way to address the different servers on your intranet.

In summary, cloud.myname.tk would be forwarded to myname.Public.Host/cloud/index.htm and from there transferred to http://myname.Dynamic.DNS:CloudPort and then through the router to your cloud server.

As a final note, I at one time had difficulty in finding a reliable dynamic DNS server, so I implemented my own, by running a script every five minutes which checks my home's public IP and, whenever this changes, calls an FTP script to update the index.htm files in each of the folders, replacing URL=http://myname.Dynamic.DNS ... by URL=http://my.pub.IP.addr ... (this is easy in Linux, but more of a challenge on Windows, where my web server resides).

From the length of this answer, you may question its straightforwardness, but each of the stages is pretty simple, and I gradually arrived at this solution step-by-step, and it now works reliably. You should check that you can create the appropriate CNAME record before you do any more work on implementing it.

Related Question