DNS (Domain Name System) is a hierarchical decentralized naming system for computers, services, or any resource connected to the Internet or a private network. It translates easily memorizable domain names to the numerical IP addresses needed for locating and identifying computer services and devices with the underlying network protocols.
Functions of DNS:
- Name Resolution: DNS resolves domain names to IP addresses, allowing users to access websites, services, and resources using human-readable names instead of numerical IP addresses.
- IP Address Assignment: DNS also assigns IP addresses to domain names, enabling communication between devices on the internet or within a private network.
- Load Balancing: DNS can distribute incoming network traffic across multiple servers to improve performance, enhance redundancy, and achieve high availability.nal entities see only the public IP address, making it more difficult for attackers to directly access devices within the private network.
- Email Routing: DNS is used to route emails by mapping email domain names to mail server IP addresses through MX (Mail Exchange) records.
- Domain Registration: DNS facilitates the registration and management of domain names through domain registrars, enabling individuals and organizations to claim unique internet identities.
- Caching: DNS servers cache DNS lookup results to improve performance and reduce the load on DNS infrastructure by storing recently accessed domain records.
Configuring DNS (Domain Name System) on Ubuntu involves setting up a DNS server, typically using BIND (Berkeley Internet Name Domain) software, and configuring the server to resolve domain names for clients on the network. Here's a basic guide to configure DNS on Ubuntu:
- Step 1: Install BIND (DNS Server) Package:
First, update the package index and install the BIND package:
sudo apt update sudo apt install bind9
-
Step 2: Configure BIND:
- Edit Configuration File: Open the BIND configuration file (/etc/bind/named.conf.options) in a text editor:
sudo nano /etc/bind/named.conf.options
- Configure Forwarders (Optional): Add DNS servers provided by your ISP or other public DNS servers to forward DNS queries if the local DNS server can't resolve them directly:
forwarders {
8.8.8.8;
8.8.4.4;
};
allow-query { any; };
- Forward Lookup Zone: Create a forward lookup zone file (/etc/bind/db.example.com):
sudo cp /etc/bind/db.local /etc/bind/db.example.com
sudo nano /etc/bind/db.example.com
;
; BIND data file for example.com
;
$TTL 604800
@ IN SOA ns.example.com. admin.example.com. (
3 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns.example.com.
@ IN A 192.168.1.10
ns IN A 192.168.1.10
sudo cp /etc/bind/db.127 /etc/bind/db.192
sudo nano /etc/bind/db.192
;
; BIND reverse data file for local loopback interface
;
$TTL 604800
@ IN SOA ns.example.com. admin.example.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns.example.com.
10 IN PTR ns.example.com.
- Edit BIND Configuration File: Open the BIND configuration file (/etc/bind/named.conf.local) in a text editor:
sudo nano /etc/bind/named.conf.local
zone "example.com" {
type master;
file "/etc/bind/db.example.com";
};
zone "1.168.192.in-addr.arpa" {
type master;
file "/etc/bind/db.192";
};
sudo systemctl restart bind9
Edit the DNS resolver configuration file (/etc/resolv.conf) to point to your local DNS server:
sudo nano /etc/resolv.conf
Update the nameserver directive to point to your DNS server IP address:
nameserver 192.168.1.10
Save and close the file.
Use the nslookup or dig command to test DNS resolution:
nslookup example.com
That's it! You've now configured a DNS server on your Ubuntu system. Remember to replace example.com and 192.168.1.10 with your actual domain name and server IP address.

Leave a comment