Linux Server setup

Configure DNS records

The Internet is an IP-based network and does not need domain names per se, with the exception of e-mail servers. When computers communicate over networks, they address data packets to IP addresses. A domain name is therefore only a synonym for an IP address. Name servers, or DNS (Domain Name System) services, are distributed all over the world and have the task of resolving domain names into IP addresses. Similar to a phone book, where a phone number is looked up via a name. Nameservers also translate in the other direction, IP to domain, but more on that later when it comes to mail servers.

With DNS entries we determine to which IP address our domain should be resolved.

DNS records, so-called resource records, can have different purposes. We are mainly interested in these:

  • A-Record: Assigns an IPv4 address to a DNS name.
  • MX-Record: Refers exclusively to e-mail services. The special feature here is that the entry provides an FQDN (Full Qualified Domain Name), since an MX record cannot refer to an IP address.
  • NS-Record: Responsible or determining name server (parent server/delegating hoster).
  • SOA-Record: Stands for "Start of Authority". This record holds various information and also controls indirectly the timing for updating.

We have received an IP and a domain from our hoster. We write our DNS configuration in a "zone file", with which we determine to which IP our domains and subdomains should be resolved. We deposit the zone file with our hoster, who includes it in his name server. All nameservers worldwide synchronize regularly to keep their databases up to date. It may take several hours until our DNS configuration is known all over the world.

We can find the IP in the project "P1" at the server entry in the Hetzner Cloud environment.

Under project P1 our server is listed. There you will find the IP. Since we will need it again and again, we should note it down to not have to navigate here every time.

go to cloud page
select project
Server list with IP

We now switch to Hetzner's DNS administration, where we store the entries. By the way, this page is only available in English.

go to DNS page

First we create a new zone with "add new zone". In the field "your DNS zone" we write the newly registered domain name. From the three options we select "import zone file". This will allow us to edit the zone file directly. We could also click this together with the first option using form fields, but I find it clearer in the original. Besides, it is certainly instructive to have seen the DNS syntax once. With a click on "continue" we see a standard template. We will add to it.

DNS console
create new zone
default zone file

The default entries are the following:

@     IN  A
www   IN  A
mail  IN  A
@     IN  MX  10 mail
@     IN  NS
@     IN  NS
@     IN  NS

Short explanation

The $ORIGIN statement defines the zone name. The @ character is a placeholder, for $ORIGIN. The A record is thus assigned as well as the subdomains www and mail. The MX (Mail Exchange) record is for the mail server and is set with priority 10. If there are multiple mail servers, the lower number would be preferred. The three name servers are listed with NS. The zone class IN stands for "Internet". One more note about the dot . at the end of the domain: it is important because it is part of a Fully Qualified Domain Name (FQDN).

Our additions

We complete the zone file with our server IP, the SOA Record mentioned earlier, and one more subdomain "dev". The date format of the SOA serial is according to ISO 8601: YYYY-MM-DD. The number of changes is represented by the last two digits. This counter starts at 1.

The final zone file

Our DNS file should finally have these entries. My server IP is, you have to enter yours here of course:


; SOA Records
$TTL 86400
@    IN  SOA (
     2021123101  ; serial
     86400       ; refresh
     10800       ; retry
     3600000     ; expire
     3600        ; negatives caching

; NS Records
@    IN  NS
@    IN  NS
@    IN  NS

; MX Records
@    IN  MX  10 mail

; A Records
@    IN  A
mail IN  A
www  IN  A
dev  IN  A

With the dev record we can later create a subdomain ( as a development site and assign it its own TLS certificate. A note about the mail record: The subdomain is important for the mail exchange server, so most web servers will need it as well.

check zone file
save zone file
Zone file submitted

With "check file" we check the file. If everything is ok, we save it and then we have to be patient. Usually it takes only a few hours until the whole globe can resolve our domain to our server IP.

We can ignore the hint that we have to adjust the nameservers, because we have already stored them during the domain registration.

Other possible record types

There are various other record types that we don't need for now, but might come into use later. For example:

  • AAAA-Record: Also called "quad-A", refers to IPv6 addresses.
  • CNAME-Record: Alias for other DNS names.
  • PTR-Record: Stands for "pointer" and is for DNS inverse queries (reverse DNS lookup).
  • TXT-Record: Allows an administrator to write text into the DNS record. Mostly these are SPF (Sender Policy Framework) entries, for example as spam protection, or to authenticate domain ownership to services like Google Console.