How To Configure Bind as a Caching or Forwarding DNS Server on Ubuntu 14.04
How To Configure Bind as a Caching or Forwarding DNS Server on Ubuntu 14.04
Domain Name System (DNS) is used to translate human-readable domain names into IP addresses. Bind (Berkeley Internet Name Domain) is a popular DNS server used on Linux systems. In this tutorial, we will configure Bind as a caching or forwarding DNS server on Ubuntu 14.04.
Step 1: Install Bind
Before we can configure Bind, we need to install it. Open a terminal and run the following command:
sudo apt-get install bind9
Step 2: Configure Bind as a Caching DNS Server
A caching DNS server stores DNS queries and their corresponding responses in memory. When a client requests a domain name, the server checks if it has the corresponding response in its cache. If it does, it returns the response to the client without querying the authoritative DNS server.
To configure Bind as a caching DNS server, we need to edit the configuration file /etc/bind/named.conf.options. Open the file in a text editor:
sudo nano /etc/bind/named.conf.options
Add the following lines to the options section of the file:
forwarders {
8.8.8.8;
8.8.4.4;
};
recursion yes;
allow-query { any; };
The forwarders section specifies the IP addresses of the DNS servers that Bind will forward queries to. In this example, we are using Google's public DNS servers. You can use any DNS servers that you prefer.
The recursion option enables Bind to perform recursive queries. This means that if Bind receives a query for a domain name that it does not have in its cache, it will query the authoritative DNS server for the domain name and cache the response.
The allow-query option specifies which hosts are allowed to send queries to Bind. In this example, we are allowing any host to send queries.
Save and close the file.
Restart Bind to apply the changes:
sudo service bind9 restart
Step 3: Configure Bind as a Forwarding DNS Server
A forwarding DNS server forwards DNS queries to another DNS server. This can be useful in environments where there are multiple DNS servers, or where the DNS server that Bind is forwarding queries to has better performance or security features.
To configure Bind as a forwarding DNS server, we need to edit the configuration file /etc/bind/named.conf.options again. Open the file in a text editor:
sudo nano /etc/bind/named.conf.options
Remove the forwarders section that we added in Step 2. Add the following line to the options section of the file
Комментарии
Отправить комментарий