Hostnames, Domains

From Elvanör's Technical Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Domain name (UNIX)

  • The domainname command manages "local" domains. The first thing to understand is that this has *nothing* to with Internet domains (DNS). *Nothing*. This is used to manage large subgroups of IP adresses into domains. For example, if you have 50 computers from 192.168.0.1 to 0.50 you could group them into the domain "servers", and use the domain "developers" for the machines above 192.168.0.50.
  • Generally you don't need a domain name. If you use one, remember that domainname (on Gentoo!) does not echo the real domain name but the NIS one, which is not needed for most cases.

Setting the FQDN on a Gentoo box

  • Not sure if the dnsdomainname or FQDN is really used, but you must do the following. Edit /etc/hosts and add a line like:
127.0.0.1       utumno.elvanor.net utumno localhost
  • The FQDN must be the FIRST value in the line.
  • It is normally instantly applied IF the hostname is correct. So you can issue a
hostname utumno

command to first update the hostname, and then the dnsdomainname is also updated. I've also seen strange cases where the system would take the value of the domain variable in /etc/resolv.conf instead of /etc/hosts, but I could not reproduce this later.

Domain Name System

General

  • A domain name is hosted by (and bought from) a registrar. This registrar only handles the domain name registration (or transfer). It may or may not offer services related to this domain name. The only thing that is mandatory from this registrar is to at least link the domain to a name server.
  • whois is a nice tool to obtain domain related information.
  • dig is useful to obtain a trace about a DNS query (it will show you the name servers used).

Name servers

  • The name servers for a domain are extremely important since they control the actual translation of subdomain (or the main domain) to an IP or CNAME. Most registrars will have their own name servers (which can be usually configured via a Web interface), but you can also host your own (BIND is a well known name server). In this case you have of course to configure it correctly yourself.
  • In any case, your domain should be linked to the name servers you plan to use! In the case of a domain transfert, the new registrar should initially point the domain to the old name servers in order to keep the configuration working until you reconfigure it. This means that you can use whatever name server you want, independently of where your domain name itself is hosted.
  • Note that a change of name server can take 1-2 days for propagation. You should cancel the old registrar plan once the propagation is finished.

MX and SPF records

  • MX records are for the mail (SMTP) system. You should create at least one MX record for the domain that will point to the correct host serving email for the domain. Note that there is a priority system if you define more than one MX record. A MX record can point to a CNAME.
  • SPF records are used for anti-spamming measures.

Reverse DNS

  • A reverse DNS query will give you the DNS of a given IP address. Note that ISPs (Free for example) assign a default reverse DNS, that you may ask to modify. If you don't modify your reverse DNS you may have problems with mail servers.