Skip to content

Instantly share code, notes, and snippets.

@gilangvperdana
Last active February 9, 2024 18:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gilangvperdana/25b77505159f48b11febfbf11af0fbcb to your computer and use it in GitHub Desktop.
Save gilangvperdana/25b77505159f48b11febfbf11af0fbcb to your computer and use it in GitHub Desktop.
DNS Server with BIND9

Installation DNS Server with BIND9

Environment

Ubuntu 20.04 Server LTS
BIND9

Node Description

192.168.0.35 is IPv4 Private DNS Server

Installation

apt-get install bind9
cd /etc/bind/
nano named.conf
zone "gbesar.com" {
	type master;
	file "/etc/bind/db.gbesar";
};

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

Configure Forwarder

cp db.local db.gbesar
nano db.gbesar
;
; BIND data file for local loopback interface
;
$TTL	604800
@	IN	SOA	gbesar.com. root.gbesar.com. (
			      2		; Serial
			 604800		; Refresh
			  86400		; Retry
			2419200		; Expire
			 604800 )	; Negative Cache TTL
;
@	IN	NS	gbesar.com.
@	IN	A	192.168.0.35
@	IN	A	192.168.0.35

Configure Reverser

nano db.192
;
; BIND reverse data file for local loopback interface
;
$TTL	604800
@	IN	SOA	gbesar.com. root.gbesar.com. (
			      1		; Serial
			 604800		; Refresh
			  86400		; Retry
			2419200		; Expire
			 604800 )	; Negative Cache TTL
;
@	IN	NS	gbesar.com.
35	IN	PTR	gbesar.com.
35	IN	PTR	www.gbesar.com.

Restart BIND9

systemctl restart bind9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment