Install BIND9 DNS on ubuntu 20.04 server steps
1) lsb_release -a
2) vi /etc/hosts
127.0.0.1 localhost
192.168.32.50 dc.faceitnet.com.au dc
3) vi /etc/hostname
dc
4) vi /etc/cloud/cloud.cfg
preserve_hostname: true
5) reboot
6) vi /etc/resolv.conf
nameserver 192.168.32.50
nameserver 127.0.0.53
options edns0
search faceitnet.com.au
7) apt-get install bind9 bind9utils bind9-doc -y
cd /etc/bind/
cp named.conf.local named.conf.local.back
cp db.local db.fwd.faceitnet.com.au
cp db.local db.rev.faceitnet.com.au
mkdir /etc/bind/zones
mv db.fwd.faceitnet.com.au zones
mv db.rev.faceitnet.com.au zones
8) vi named.conf.local
Zone "faceitnet.com.au" IN {
Type master;
file "/etc/bind/zones/db.fwd.faceitnet.com.au";
allow-update {none;};
};
Zone "168.192.in-addr.arpa" IN {
type master;
file "/etc/bind/zones/db.rev.faceitnet.com.au";
allow-update {none;};
};
9) vi named.conf.options
acl "Trusted" {
192.168.32.50; # Name Server
};
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.
recursion yes; # enables resursive queries
allow-recursion { Trusted; }; # allows recursive queries from "trusted" clients
listen-on { 192.168.32.50; }; # ns1 private IP address - listen on private network only
allow-transfer { none; }; # disable zone transfers by default
forwarders {
8.8.8.8;
8.8.4.4;
};
// 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;
auth-nxdomain no; # conform to RFC1035
listen-on-v6 { any; };
};
10) cd zones
vi db.fwd.faceitnet.com.au
;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA dc.faceitnet.com.au. root.dc.faceitnet.com.au. (
6
604800
86400
2419200
604800 )
;
@ IN NS localhost.
@ IN A 127.0.0.1
@ IN AAAA ::1
;Name Server Information
IN NS dc.faceitnet.com.au.
;Name Server A records
dc.faceitnet.com.au. IN A 192.168.32.50
11) Now open reverse file db.rev.faceitnet.com.au
vi db.rev.faceitnet.com.au
;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA dc.faceitnet.com.au. root.dc.faceitnet.com.au. (
5
604800
86400
2419200
604800 )
;
@ IN NS localhost.
@ IN A 127.0.0.1
@ IN AAAA ::1
;Name Server Information
IN NS dc.faceitnet.com.au.
;PTR records from ip last two part
32.50 IN PTR dc.faceitnet.com.au.
12) root@ns1:/etc/bind/zones# service bind9 restart
13) root@ns1:/etc/bind/zones# service bind9 status
root@ns1:/etc/bind/zones# named-checkzone 168.192.in-addr.arpa db.fwd.faceitnet.com.au
root@ns1:/etc/bind/zones# named-checkzone 168.192.in-addr.arpa db.rev.faceitnet.com.au