Code in this video_How to Install and Configure DNS Server on Ubuntu

Code in this video_How to Install and Configure DNS Server on Ubuntu

In this video:

Note: Replace the highlighted orange information with your own details.

✳️ DNS Server
     🔸 My Domain: ttc.local
     🔸 Hostname: dns-1
     🔸 FNQD: dns-1.ttc.local
     🔸 IP address: 192.168.1.8/24
✳️ Mail Server
     🔸 Hostname: mail
     🔸 FNQD: mail.ttc.local
     🔸 IP address: 192.168.1.15/24
✳️ Web Server
     🔸 Hostname: www
     🔸 FNQD: www.ttc.local
     🔸 IP address: 192.168.1.21/24

📌 named.conf.options

// Define LAN network
acl MYLAN {
	192.168.1.0/24;
};
options {
	// Default directory
	directory "/var/cache/bind";
	// Allow queries from localhost and LAN network
	allow-query {
		localhost;
		MYLAN;
	};
	// Use Google DNS as a forwarder
	forwarders{
		8.8.8.8 ;
		8.8.4.4 ;
	};
	// Allow recursive queries
	recursion yes;
};

📌 named.conf.local

// Define the Forward zone
// My domain: ttc.local
// Forward file called forward.ttc.local
zone "ttc.local" IN { 
	type master;
	// Path of Forward file
	file "/etc/bind/totatca/forward.ttc.local";
};
// Define the Reverse zone
// Reverse file called: reverse.ttc.local
zone "1.168.192.in-addr.arpa" IN {
        type master;
        file "/etc/bind/totatca/reverse.ttc.local";
};

📌 forward.ttc.local

$TTL    604800
; SOA record with MNAME and RNAME updated
@       IN      SOA     ttc.local. root.ttc.local. (
                              3         ; Serial Note: increment after each change
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
; Name server record 
@       IN      NS      dns-1.ttc.local.
; A record for name server
dns-1	IN      A       192.168.1.8
www	IN	A	192.168.1.21
mail	IN	A	192.168.1.15

; Mail handler or MX record for the domain ttc.local
ttc.local.    IN     MX   10   mail.ttc.local.

; A record for clients
client1      IN      A       192.168.1.111
client2      IN      A       192.168.1.112

📌 reverse.ttc.local

$TTL    604800
; SOA record with MNAME and RNAME updated
@       IN      SOA     ttc.local. root.ttc.local. (
                              2         ; Serial Note: increment after each change
                         604800         ; Refresh
                          86400         ; Retry
                        2419200         ; Expire
                         604800 )       ; Negative Cache TTL
; Name server record 
@       IN      NS      dns-1.ttc.local.
; A record for name server
dns-1	IN      A       192.168.1.8
www	IN	A	192.168.1.21
mail	IN	A	192.168.1.10
; PTR record for name server
8	IN      PTR     dns-1.ttc.local
21	IN	PTR	www.ttc.local
15	IN	PTR	mail.ttc.local
; PTR record for clients
111	IN      PTR     client1.ttc.local
112	IN      PTR     client2.ttc.local



Leave a Reply

Your email address will not be published. Required fields are marked *