1. Academy
  2. Compute & Instances

How to configure a nameserver.

In this tutorial you are going to learn how to set up a nameserver. It is used to point a logical domain name, such as “docs.fuga.cloud” to the IP address of fuga’s hosting server.


For this tutorial you need the following:

  1. Active fuga Cloud Account
  2. 1 Instance for Primary

Step 1 - install the packages 

With Cloud-init

Go to the fuga.cloud dashboard and Create Instance. Select below Boot Source, a distribution, in this tutorial Ubuntu 20.04 LST is being used. 

Select a Boot disk size, flavor, network, key pair, security group, and give your instance a name.

Nextup unfold the Advanced Settings and deploy the script below:

apt_update: true
apt_upgrade: true
 - bind9

Without Cloud-init

If you already have an instance running that you want to use, you can install the packages bij running the following command: 

$ sudo apt install bind9

Step 1 - Configuration

After the installation, open the named.conf.option file:

$ sudo nano /etc/bind/named.conf.options

First edit the forwarders with the containing IP addresses of DNS servers.

Forwarders {;;

Below dnssec-validation auto; add following with the IP address of your instance.

For the first ip address, add the first 3 octets of your instance ip address, same goes with the second ip address, but here use 2 octets. See exemple:

Listen-on {;;

Add allow-query to the necessary IP address of any to allow all requests.

$ allow-query { any; };

Save and exit the file, and restart the service. After that, you can check the status of bind9

$ sudo systemctl restart bind9
$ sudo systemctl status bind9

To check if everything is working correctly, enter the following command.

$ nslookup google.com <ip_address_dns>

You should receive the following output:

Server:  <ip_address_dns>
Address: <ip_address_dns>#53

Non-authoritative answer:
Name: google.com
Name: google.com
Address: 2a00:1450:400e:803::200e

Step-2 configure bind as a primary DNS server

Relocate to /etc/bind/ and edit the named.conf.local file.

$ sudo nano /etc/bind/named.conf.local 

Add the following lines to it:

Zone “<domain.com” {
Type master;
File “/etc/bind/zones/<domain.com>”;
Allow-transfer { <ip_address_dns; };
Also-notify { <ip_address_dns; };

After you add the zone information of your domain name, restart bind9. 

$ systemctl reload bind9

After reloading bind9, create a copy of the zone file from db.local. 

$ sudo mkdir /etc/bind/zones
$ sudo cp /etc/bind/db.local /etc/bind/zones/<domain.com>

Open the file

$ sudo nano /etc/bind/zones/<domain.com>

In this file, replace the SOA with the FQDN of your server, use a dot “.” at the end of it. This will be ns.domain.com. Replace root.localhost. with your admin email address, using the dot “.” instead of “@” and end it with a dot. See example below:

; BIND data file for local loopback interface
$TTL    604800
@       IN      SOA   ns.domain.com. admin.domain.com. (
                             2         ; Serial
                        604800         ; Refresh
                        86400         ; Retry
                      2419200         ; Expire
                     604800 )       ; Negative Cache TTL
@       IN     NS      ns.domain.com.
@       IN     A       <ip_address_instance>
ns IN A <ip_address_instance>
@       IN     AAAA    ::1

After you have edited the file, restart rndc.

$ sudo rndc reload

You can check the DNS server, enter the following command.

$ nslookup domain.com <ip_address_instance>


You have learned how to install bind9 and configure the files to set up a nameserver for your domain. As well giving the domain an A record that can be looked up from any remote computer.