How to configure my Linode adding my own domain
However, I already purchased a domain name, so my simple question is: will I have to configure my Linode with both domains?
Supposing I registered the domain 'llehirgen.org', and that my Linode is given the domain 'something.linode.com' with ip address 12.34.56.78, I wonder how do I have to configure my DNS zone file and my /etc/hosts file.
Will the following configurations be correct?
DNS zone file
llehirgen.org CNAME something.linode.com.
something.linode.com A 12.34.56.78
something.linode.com NS ns1.linode.com.
something.linode.com NS ns2.linode.com.
...
/etc/hosts
127.0.0.1 localhost.localdomain localhost
12.34.56.78 hydrogen.something.linode.com hydrogen
12.34.56.78 hydrogen.llehirgen.org hydrogen
3 Replies
But most people want to access their server by name and not by IP. So you setup an A record (IPv4) and an AAAA record (IPv6) in your DNS, then tell your domain registrar to point to your DNS servers. You may use your own DNS server (nsd or bind, under CentOS 7) or you may use the DNS servers provided by Linode.
So, when you try to access your domain.tld, the resolver will contact the root .tld ask for the DNS servers of domain.tld (for example nsX.linode.com), then propagate the request directly to the provided DNS servers, which in turn will resolve domain.tld for the client.
You do not need to modify your /etc/hosts file, your own address will already be resolvable by your DNS.
So, as you suggest, I would avoid to add two Fully Qualified Domain Names (FQDNs) in my /etc/hosts file.
The following entries should be enough:
127.0.0.1 localhost
12.34.56.78 hydrogen
My main concern was to preserve both domains, the one given by Linode and the one I purchased, because I may not renew the latter.
So, once it is expired, my application can still be referenced using the linode.com domain.
That's why I thought of adding the CNAME record in the DNS zone files (at Linode and at other DNS provider of my choice) and using the linode.com domain for the remaining records.
in your case, it doesn't really make a difference…
since you don't really expect to keep the purchased domain, then you could just remember the IP address and use that, instead of a domain name. I know many IP addresses by heart, I am my own resolver, for my private servers that aren't accessible by others.