DNS Server
Features
- A full fledged DNS server allowing configuration of an unlimited number of domains/subdomains, all types of DNS records, and without any restriction in TTL
We are running the PowerDNS authoritative nameserveras our DNS server. Zone files are plain text files in /etc/powerdns/zones and may be edited directly using your favourite editor.
Required information
Send to the server administrator
- Your domain name
Basics of DNS
Before we get into editing your DNS records, let us familiarize ourselves with some of the more important DNS concepts and lingo. I will try to keep the description as accessible to common sense as possible, at the expense of some exactness and rigor.
Zones and Zone Files
DNS Names are URLs in Reverse
DNS is a hierarchical path, very much like a common web URL or a
filesystem path. The only difference is that it is meant to be read
from right to left, instead of left to right like normal URLs. So,
ns1.systemreboot.net. is like the URL /net/systemreboot/ns1, and
www.labour.tn.gov.in. is like the URL /in/gov/tn/labour/www,
etc. The . after net and in is like the / representing root in
a filesystem. Though we conventionally leave out this . in the
domain name of web URLs, it is required in zone files, and elsewhere
while configuring your DNS.
Time To Live (TTL)
When your computer resolves a domain name by querying a DNS server, it
keeps the result cached for a while. This time for which the DNS
result should be kept cached is specified by the DNS server, and is
called the Time To Live or TTL. Low TTL increases traffic to the
DNS server, but ensures that changes to DNS records propagate quickly.
Types of DNS Records
There are several different types of DNS records. But, for the most part, you will likely need to only know two of them — the A record and the CNAME record.
The A record is what we commonly think of as "DNS records" — it maps a subdomain name to an IP address.
The CNAME record acts as a kind of symbolic link or shortcut to an A
record. For example, you might have only one physical server (say,
server.example.com.) with many different services running on it
(say, service1.example.com., service2.example.com., etc.). Instead
of maintaining separate A records for service1.example.com. and
service2.example.com. with the same value, you just create a single A
record for server.example.com. and an ALIAS record each for
service1.example.com. and service2.example.com. both pointing to
server.example.com. Thus, when you need to update your server's IP
address, you only need to update one record. Please note the caveat
that CNAME records cannot be placed on your top-level domain.
Edit your zone
The zone file for your.domain.name is at
/etc/powerdns/zones/your.domain.name. You can edit your zone file with
your favourite editor.
$ nano /etc/powerdns/zones/your.domain.name
A zone file has one DNS record on each line. Each line is split into five columns separated by tabs. The five columns are the name, TTL, class, type and value of the DNS record respectively.
Let us look at a concrete example to understand what goes into a zone
file. Suppose you have a server at server.example.com. serving
your blog at blog.example.com., a GNU Social instance at
social.example.com. and an XMPP server at
xmpp.example.com.. Then, your zone file could look something like
example.com. 60 IN ALIAS server.example.com. blog.example.com. 60 IN ALIAS server.example.com. social.example.com. 60 IN ALIAS server.example.com. xmpp.example.com. 60 IN ALIAS server.example.com. server.example.com. 60 IN A 203.0.113.0 example.com. 3600 IN NS ns1.systemreboot.net. example.com. 3600 IN NS ns2.systemreboot.net. example.com. 3600 IN SOA ns1.systemreboot.net. arunisaac.systemreboot.net. 2017073972 10800 3600 604800 3600
Unless you know what you are doing, leave the NS and SOA records with their default values, and use a TTL of 60 seconds for A and ALIAS records. An explanation of NS and SOA records is currently beyond the scope of this text.
Point your domain at our nameservers
Finally, at your domain registrar, set ns1.systemreboot.net and
ns2.systemreboot.net as the nameservers for your domain. This
process usually involves interacting with some web interface provided by
your domain registrar. Once the new DNS records propagate, your domain
should be online. Verify on the command line using dig.
$ dig your.domain.name.