In this article, we will install and configure a DNS server (Domain Name System) again, this time on Unbound.
- A server machine (debian)
- 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
CONFIGURATION OF THE SERVER MACHINE
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.
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.
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.
INSTALLATION AND CONFIGURATION OF UNBOUND
For starters, on the server machine, we will install Unbound.
apt-get install -y unbound
Unlike Bind9, the Unbound configuration is done in a single file.
We will now check that our configuration file is correct with the command
If your configuration file is correct, the command should return you a similar message:
If your file is not correct, the command will show you at which line there is an error and why it is not good.
Finally we will restart the unbound service for all changes to take effect.
service unbound restart
CONFIGURATION OF THE CLIENT MACHINE
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.
Once configured, you can now test using the command ping.
ping SrvUnbound (from the client machine)
ping Client (from the server machine)
There you go! Now, as for the Bind9 server, you can for example connect in SSH with the name of the machine without knowing the IP address.