How to use a subdomain as if it were a domain

2

How can I create 2 subdomains via DNS ?

I need to create 1 for each server and use them as if it were a domain.

I have 2 servers, one in BR and one in the US

What I want is to do this:

srvbr.yourdomain.com - > Point to BR Server

My.yourdomain.com - > Pointing to US Server

    
asked by anonymous 01.06.2014 / 04:31

2 answers

7

At the suggestion of @Renan, I will try to elaborate my answer better, although I am not an expert in DNS:)

However, there are two ways (as far as I know) of creating subdomains for a given host. Or by Address or CNAME records.

1. Log in to your DNS provider

You can create, update, delete DNS records. Remembering that these changes, if memory does not fail me, take some time to be applied ( up to 48h , at the suggestion of @brasiofilo) because it does not depend only on your provider, the new record needs to propagate between the TLDs of the highest level and etc ...

I believe that upon entering your provider, you will see a screen similar to this:

IdonotknowhowTTL(TimeToLive)changesinfluenceperformance,sincewhenaTTLofarecordends,DNScacheismadebasedonTTLandDNS.

2.CreatingrecordsoftypeADDRESS(A)

IfyouknowtheIP'softheserversandtheywillnotchange,thenjustcreateaArecordforeachonewiththevalue:

srvbr.meudominio.comINAIP.do.Servidor.BRsrveua.meudominio.comINAIP.do.Servidor.EUA

Andwaitacertainperiodfortheregistrytopropagate.

3.CreatingCNAMErecords

CNAMErecordsdonotsupportIP's,theyarealiases("shortcuts") for domains. That is, if I create a CNAME record of:

srvbr.meudominio.com IN CNAME srvbr.com
srveua.meudominio.com IN CNAME srveua.com

When someone resolves the DNS (browser, whoever), the address srvbr.yourdomain.com will point to srvbr.com .

With this strategy, you need to configure a domain for each server, that is, you need each server to have a record of type Address pointing to the IP. According to this OS question , the CNAME does not accept values of type IP .

In the end I would have something like:

srvbr.com IN A xxx.xxx.xxx.xxx
svreua.com IN A yyy.yyy.yyy.yyy

srvbr.dominio.com IN CNAME srvbr.com
srveua.dominio.com IN CNAME srveua.com

Practical example:

I have no hosting for a personal page of mine, but I have a personal page on GitHub Pages . What I do: I've created a CNAME that points from my domain mydomain.com to menunome.github.io >. Given that I can not rely on IP (record type A), which is not under my control.

If I made a theoretical mistake, I'm sorry that I'm not an expert on DNS. Feel free to suggest changes

Some reading suggestions:

  • CNAME_record
  • understanding-the-records-of-dns -aaaa-ns
  • differences-between-a-cname-alias-url
  • cname-record
  • 01.06.2014 / 18:11
    -3

    I do this on a number of occasions and it always works out with the .br registry, using their dns to make a registry entry A. I have not yet been able to get the .com purchased from Godaddy because their panel seemed confusing and simply does not work as expected. At least for me.

    I do exactly as the colleague suggested above, except that I do not use cname, as it does not seem necessary to me, since I have two ips bought one on one server and the other on another.

    srvbr.com IN A xxx.xxx.xxx.xxx svreua.com IN A yyy.yyy.yyy.yyy

        
    27.09.2016 / 13:29