Domain Name Servers (DNS) are essential for the Internet, matching domain names with IP addresses. You will need to set appropriate DNS entries for all the domains and subdomains hosted on your server in order to make them accessible on the web.
In general, the registrar of your domain name(s) (such as namecheap.com) offers free DNS services. There are situations in which the hosting company offering VPSs, cloud servers or dedicated servers also offers free DNS services (such as linode.com). It’s recommended to use the DNS services offered by the registrar or by the hosting company. This is because these free DNS services are in general of good enough quality and by using them you’ll avoid installing and maintaining your own BIND servers, which will use around 20 MB of RAM memory continuously (you must have at least two DNS servers: one master and one slave DNS server, each with a separate IP and on a separate VPS, cloud server or dedicated server, preferably in different geographic locations). However, in the situation where neither the registrar, nor the hosting company offers free DNS services, you have to consider installing and maintaining your own DNS servers (by installing BIND as described in the Install BIND chapter of this guide). Using the paid DNS services of a third party is not optimal and since this guide presents the optimal solution for everything, it won’t describe this option.
If neither the registrar of your domain name(s), nor the hosting company offers free DNS services and you don’t want to install and maintain BIND on two of your servers, you can use the free DNS services offered by Hurricane Electric, as we’ll describe below. Their servers are fast, stable and secure.
If you use the DNS services offered by your registrar or hosting provider, you can set the DNS records in a similar manner to what we’ll describe for Hurricane Electric, although the web interface for Hurricane Electric is quite different from that of other DNS services providers.
13.1. Add DNS records using Hurricane Electric’s free DNS services
As explained in the Domain hosting strategy chapter, you should choose a domain hosted on your server as your main domain. Let’s say the main domain is
example.com . Then you can set up all the subdomains necessary for the applications described in this guide, as subdomains of the main domain like this:
mail.example.com as subdomain for Roundcube,
lists.example.com for phpList,
mailman.example.com for Mailman,
doli.example.com for Dolibarr,
cloud.example.com for Nextcloud,
office.example.com for Collabora Online,
roundpin.example.com for Roundpin,
stats.example.com for Matomo,
friendica.example.com for Friendica and
forum.example.com for MyBB. Each subdomain should have its own A and AAAA DNS records, that you can set up as explained below.
First register for an account on: https://dns.he.net/ (by clicking on ‘Register!’ in the upper left corner). Then log in to your free account by entering the username and password that you have set at registration.
Next, click on ‘Add a new domain’, in the left panel, under ‘Zone Functions’. You’ll be prompted to enter your domain. First of all enter your main domain:
example.com . Then click on ‘Add Domain!’. Please note: if the domain is not registered yet, you’ll receive an error when trying to add it, therefore the domain that you want to add must be acquired in advance from a registrar (such as namecheap.com). Also, when you buy a domain, you’ll have to set the Hurricane Electric’s name servers (
ns5.he.net) as name servers for that domain in your registrar’s client account.
If you used Namecheap to register your domain(s), you can set up Hurricane Electric’s DNS servers for them as follows: once you log in to your namecheap.com account, on the Dashboard, click on ‘Manage’ next to the domain name for which you want to set up DNS servers, then on the ‘Domain’ tab, in the ‘NAME SERVERS’ section, select ‘Custom DNS’ from the drop-down list, then click on ‘ADD NAMESERVER’, enter
ns1.he.net, then save the server by clicking on the green tick sign in the upper right corner. In the same manner enter the following DNS servers:
Repeat the process for all the domains registered with Namecheap, for which you want to set up Hurricane Electric’s DNS servers.
In your Hurricane Electric’s account, in the window of your newly added domain, you must first enter the A record for
example.com, as well as for
www.example.com (this is regardless of which one you want to use as your canonical domain name; if you use
www.example.com as the official domain name for your website, then you will configure Nginx to redirect requests for
www.example.com; if you use
example.com, you will configure Nginx to redirect requests for
example.com , as we’ll describe further down below). You will also need to add A records for all your subdomains, such as
office.example.com, etc. Then you’ll have to add similar AAAA records. The AAAA records will be identical with the A records, with the exception of the IP address, which will be the public IPv6 address of your server. The A and AAAA records for the main domain should look similar to the following:
22.214.171.124 is the IPv4 address, and
2b03:8df0:a24b:6eb::1 is the IPv6 address of your server.
When you want to add an A record click on ‘New A’ on the upper bar and fill the fields as follows:
Similarly, for an AAAA record click on ‘New AAAA’; in the ‘Name’ field write the whole domain or subdomain, and in the ‘IPv6 Address’ field enter your server’s public IPv6 address.