December 4, 2015 in Services
Local DNS Server in Ubuntu Debian
What is a DNS
DNS stands for Domain Name System and its a service that associates domain names with ip addresses. Let me try to explain this a bit more.Since you are reading this article it means that you have typed my domain name (www.allaboutlinux.eu) or you found that link on another website. but when you are typing www.allaboutlinux.eu, your computer is not really able to know where this website is hosted and of course computers are only good with numbers. So your computer will ask the DNS server about a domain name and the DNS server will reply with an ip address. Then your computer will contact that ip and hopefully the server behind that ip will reply. Enough with that lets start with the setup of the DNS server.
What you will need:
bind9 will be used in this tutorial and this one is the most widely used DNS in the world. BIND stands for Berkeley Internet Name Domain and was initially a project of 4 graduate students at the Computer Research Group at the University of California, Berkeley. Lets say now now that i have my DNS server (the one that we create now) at 172.16.10.1, my sql server at "172.16.10.12″, my Apache server at "172.16.10.15″, my file server at "172.16.10.17″, my router at "172.16.10.254″ and my computer at 172.16.0.101 all of them are at /24. so my network is working but i have to remember all the ips in order to connect to each server. and as my company growth i will have more servers and more workstations and that is making things more complicated. it would be easier if I had a way to connect to my sql server by just providing the name and not the ip and that is exactly what we will do here. Open a terminal and type the following commands.
sudo apt-get update
sudo apt-get install bind9
Now we need to define a name for our local zone. I will name this one "allaboutlinux.local" but you can choose whatever you want. more zones are also possible. All files that you will need to configure are in "/etc/bind/". lets define the new zone. Open the /etc/bind/named.conf.default-zones
sudo gedit /etc/bind/named.conf.default-zones
and add the following lines at the end of the document: