Good to know : What is DNS and real world examples
A DNS server is a server that is used to translate IP addresses into host names so that they are more efficient and easy to remember. Apart from that, DNS is used to identify computers, services, and other resources that can be reached via the Internet or other Internet Protocol (IP) networks.
A simple example of implementing DNS, for example, is when you want to access a website like Google. By configuring the DNS server, you only need to type the address google.com, and not the IP 216.239.38.120, but you can still access the IP above to display pages from google.com.
Configuration
Install Package
apt install bind9 dnsutils -y
Copy File
Copy the db.local (File Forward) and db.127 (File Reverse) files into a new file. This is so that if there is a config error later, we still have a backup file.
;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA rizwanpemula.com. root.rizwanpemula.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS rizwanpemula.com.
@ IN A 10.1.31.1
@ IN MX 0 10.1.31.1
mail IN A 10.1.31.1
www IN A 10.1.31.1
php IN A 10.1.31.1
wordpress IN A 10.1.31.1
phpmyadmin IN A 10.1.31.1
;
; BIND reverse data file for local loopback interface
;
$TTL 604800
@ IN SOA rizwanpemula.com. root.rizwanpemula.com. (
1 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS rizwanpemula.com.
1 IN PTR rizwanpemula.com.
1 IN PTR www.rizwanpemula.com.
1 IN PTR mail.rizwanpemula.com.
1 IN PTR php.rizwanpemula.com.
1 IN PTR wordpress.rizwanpemula.com.
1 IN PTR phpmyadmin.rizwanpemula.com.
zone "rizwanpemula.com" {
type master;
file "/etc/bind/db.rizwan";
};
zone "1.31.1" {
type master;
file "/etc/bind/db.10.1.31";
};