Skip to content

Latest commit

 

History

History
185 lines (158 loc) · 3.3 KB

Bind9_DNS_Configuration.md

File metadata and controls

185 lines (158 loc) · 3.3 KB

Bind9 DNS Server

sudo apt update
sudo apt install bind9
cd /etc/bind
tree

Tip

Back up original configuration files (recommended)

sudo cp named.conf.options named.conf.options.original
sudo cp named.conf.local named.conf.local.original

Tip

Create copies of zone files

sudo cp db.local db.ewubdserver.com
sudo cp db.127 db.56.168.192

Edit global options file

sudo gedit named.conf.options

Important

named.conf.options

options {
	directory "/var/cache/bind";

	// If there is a firewall between you and nameservers you want
	// to talk to, you may need to fix the firewall to allow multiple
	// ports to talk.  See http://www.kb.cert.org/vuls/id/800113

	// If your ISP provided one or more IP addresses for stable 
	// nameservers, you probably want to use them as forwarders.  
	// Uncomment the following block, and insert the addresses replacing 
	// the all-0's placeholder.

	// forwarders {
	// 	0.0.0.0;
	// };

	//========================================================================
	// If BIND logs error messages about the root key being expired,
	// you will need to update your keys.  See https://www.isc.org/bind-keys
	//========================================================================
	dnssec-validation auto;

	listen-on-v6 { any; };
	recursion yes;
	listen-on{192.168.56.5;};
	allow-transfer {none;};
	
	forwarders {
		192.168.56.0;
	 };
	
};

Edit local zone definitions file

sudo gedit named.conf.local

Important

named.conf.local

zone "ewubdserver.com" IN {
    type master;
    file "/etc/bind/db.ewubdserver.com";
};

zone "56.168.192.in-addr.arpa" IN {
    type master;
    file "/etc/bind/db.56.168.192";
};

Edit forward zone file

sudo gedit db.ewubdserver.com

Important

db.ewubdserver.com

;
; BIND data file for local loopback interface
;
$TTL	604800
@	IN	SOA	ns1.ewubdserver.com. root.ewubdserver.com. (
			      2		; Serial
			 604800		; Refresh
			  86400		; Retry
			2419200		; Expire
			 604800 )	; Negative Cache TTL
;
@	IN	NS	ns1.ewubdserver.com.
ns1	IN	A	192.168.56.5
www	IN	A	192.168.56.5
ftp	IN	A	192.168.56.5
@       IN      MX      10	mail
mail    IN      A       192.168.56.5
@	IN	AAAA	::1
named-checkzone ewubdserver.com db.ewubdserver.com

Edit reverse zone file

sudo gedit db.56.168.192

Important

db.56.168.192

;
; BIND reverse data file for local loopback interface
;
$TTL	604800
@	IN	SOA	ns1.ewubdserver.com. root.ewubdserver.com. (
			      1		; Serial
			 604800		; Refresh
			  86400		; Retry
			2419200		; Expire
			 604800 )	; Negative Cache TTL
;
@	IN	NS	ns1.ewubdserver.com.
24	IN	PTR	ns1.ewubdserver.com.
24	IN	PTR	www.ewubdserver.com.
24	IN	PTR	ftp.ewubdserver.com.
24	IN	PTR	mail.ewubdserver.com.
named-checkzone 56.168.192.in-addr.arpa db.56.168.192

Manage the BIND service

sudo systemctl status named
sudo systemctl start named
sudo systemctl enable named
sudo systemctl status named

Configure local resolver

sudo gedit /etc/resolv.conf

Important

resolv.conf

nameserver 192.168.56.5
sudo systemctl restart named

Tip

Test DNS resolution

nslookup www.ewubdserver.com