Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a subdomain and how do they work?

Tags:

I would like to create a subdomain off of my main domain for accessing my raspberry pi at home. My domain register company charges £10 for every subdomain so I thought there might be an easier (and cheaper) way of creating one. It would also help if I knew a little more about them and how they are created.

like image 651
Marmstrong Avatar asked Aug 03 '13 11:08

Marmstrong


People also ask

How does a subdomain work?

A subdomain name is a piece of additional information added to the beginning of a website's domain name. It allows websites to separate and organize content for a specific function — such as a blog or an online store — from the rest of your website.

How is a subdomain created?

Creating a SubdomainChoose one of your Domain Names from the drop-down list. Enter the Document Root (this is the folder that contains the website you want to show). We recommend that you use the same name for this folder as your subdomain. Click the Add subdomain button.

What is a subdomain and give an example?

To recap, a subdomain is the portion of a URL that comes before the “main” domain name and the domain extension. For example, docs.themeisle.com . Subdomains can help you divide your website into logical parts or create separate sites, for example a separate blog for each sports team.

Can you make your own subdomain?

Rather than registering a new domain name, you can always create a subdomain using your existing domain name. A subdomain is an addon to your primary domain with its unique content. It is a separate part of your website that operates under the same primary domain name without you purchasing a new domain.


1 Answers

DNS is built off of a hierarchy for scale-ability and/or for granularity.

If we take the a domain like www.stackoverflow.com. and break it down, here is what we get.

  1. www - This is the host portion of the domain. It is either an A record or a CNAME and eventually points to an ip address.
  2. stackoverflow - This is one of the domain levels. It has it's own DNS servers and config managed by the stackoverflow team. This allows that team to manage the entries specific to their needs.
  3. com - This is called a TLD (top level domain). All other domains that end in .com have an entry on the "com" dns servers.
  4. . - This is called the ROOT. There are 20 somodd root DNS servers scattered around the world. These servers are used to identify where the .com, .org, .edu, .gov, etc dns servers are.

From a client perspective what happens when you query www.stackoverflow.com is:

  1. You query the . name servers to ask where the com dns servers are.
  2. You query the com dns servers to ask where the stackoverflow dns servers are.
  3. you query the stackoverflow dns servers to ask where www is.

A subdomain simply means that you add an additional layer of DNS servers in the mix so that you can add more scale-ability and/or granularity to the mix.

For example, if our dns name is: www.foo.stackoverflow.com we would now have the foo dns server layer.

Having said that, I do not think that you need a subdomain. You probably just need an additional DNS A record or CNAME. For example:

raspberry.stackoverflow.com instead of raspberry.foo.stackoverflow.

They should not charge extra for additional host entries (A record or CNAME), only for subdomains.

like image 60
dtorgo Avatar answered Oct 06 '22 19:10

dtorgo