In this article, we will install and configure a DNS server (Domain Name System) with bind9.


  1. A server machine (debian)
  2. A client machine (we can use any operating system for that)

Before doing anything, we will update our 2 machines:

apt-get update && apt-get upgrade



We will start by modify the machine hostname , in the form « MachineName.Domain.tld », to indicate to which domain the machine will belong.

Don’t forget to adapt the hostname of your machine according to your situation.

nano /etc/hostname

1) hostname

Then we will modify the /etc/hosts file so that it does a local name resolution without going through the DNS server.

Add these 2 lines to the file without forgetting to adapt your IP address according to your situation.

nano /etc/hosts

2) Hosts

Finally we will modify the file /etc/resolv.conf to indicate to the machine its domain and on which server(s) it will be able to resolve the host names to IP addresses and vice versa.

nano /etc/resolv.conf

3) resolv.conf



For starters, on the server machine, we will install Bind9.

apt-get install -y bind9

Once installed, we will create 2 zones in the file /etc/bind/named.conf.local

  • The zone « sio.tp » which will solve the host names of the domain « sio.tp » in IP addresses.
  • The zone « 1.168.192.in-addr.arpa » (the IP address of the network ( written backwards follows from « .in-addr.arpa » which will replace the .0 of the address Network IP) that will resolve the IP addresses in host name.
nano /etc/bind/named.conf.local

6) déclaration zones

Now that we have declared the zones, we will create the files we specified in the file /etc/bind/named.conf.local so that we can configure our zones and add the hosts of the domain « sio.tp ».

nano /etc/bind/db.sio.tp

7) zone sio.tp

nano /etc/bind/db.1.168.192.in-addr.arpa

8) zone addr arpa

We will now verify that our zone configuration files are correct with the command

named-checkconf -z

If all your configuration files are correct, the command should return you a similar message:

9) checkconf

If your files are not correct, the command will show you which file and which line there is an error.

To finish with the server machine, we restart the service bind9 so that all our changes are taken into account.


service bind9 restart


We will now add the client device to the sio.tp domain and indicate which DNS server it should use so that it can resolve the host name of this domain.

nano /etc/hostname

11) client hostname

nano /etc/resolv.conf

3) resolv.conf

Once configured, you can now test using the command ping.

ping SrvBind (from the client machine)

12) ping test

ping Client (from the server machine)

13) ping Client

There you go! Now you can for example connect in SSH with the name of the machine without knowing the IP address.


SOURCE: https://lucasvidelaine.wordpress.com/bind9/


Laisser un commentaire

Entrez vos coordonnées ci-dessous ou cliquez sur une icône pour vous connecter:

Logo WordPress.com

Vous commentez à l'aide de votre compte WordPress.com. Déconnexion /  Changer )

Photo Google+

Vous commentez à l'aide de votre compte Google+. Déconnexion /  Changer )

Image Twitter

Vous commentez à l'aide de votre compte Twitter. Déconnexion /  Changer )

Photo Facebook

Vous commentez à l'aide de votre compte Facebook. Déconnexion /  Changer )

Connexion à %s