how to configure DNS server with bind9 on ubuntu 22.04
BIND or BIND 9 is an open source implementation of DNS, available for almost all Linux distributions. BIND stands Berkeley Internet Name Domain & it allows us to publish DNS information on internet as well as allows us to resolve DNS queries for the users. BIND is by far the most used DNS software on Internet.
DNS or Domain Name System, as we know is an internet service that is used to translate the user friendly domain into computer friendly IP addresses. Not only can we translate domain names to IP addresses, we can also perform reverse translation i.e. from IP addresses to domain name translations. In this post, we are going to learn to setup a private DNS server by implementing BIND 9 on Ubuntu 22.04.
1) Install bind9
$ sudo apt install bind9 bind9utils bind9-doc
2) Copy files
Firstly is change directory to:
cd /etc/bind/
copy "db.local" to "db.artha"
cp db.local db.artha
copy db.127 db.226
cp db.127 db.226
3) Edit files
edit "db.artha
; ; BIND data file for local loopback interface ; $TTL 604800 @ IN SOA artha.ot. root.artha.ot. ( 2 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS artha.ot. @ IN A 192.168.217.82 www IN A 192.168.217.82
edit "db.226"
; ; BIND reverse data file for local loopback interface ; $TTL 604800 @ IN SOA artha.ot. root.artha.ot. ( 1 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS artha.ot. 1 IN PTR artha.ot.
edit "named.conf.default.zones"
// prime the server with knowledge of the root servers zone "." { type hint; file "/usr/share/dns/root.hints"; }; // be authoritative for the localhost forward and reverse zones, and for // broadcast zones as per RFC 1912 zone "artha.ot" { type master; file "/etc/bind/db.artha"; }; zone "217.168.192.in-addr.arpa" { type master; file "/etc/bind/db.226"; }; //zone "localhost" { // type master; // file "/etc/bind/db.local"; //}; //zone "127.in-addr.arpa" { // type master; // file "/etc/bind/db.127"; //}; zone "0.in-addr.arpa" { type master; file "/etc/bind/db.0"; }; zone "255.in-addr.arpa" { type master; file "/etc/bind/db.255"; };
# This is /run/systemd/resolve/stub-resolv.conf managed by man:systemd-resol> # Do not edit. # # This file might be symlinked as /etc/resolv.conf. If you're looking at # /etc/resolv.conf and seeing this text, you have followed the symlink. # # This is a dynamic resolv.conf file for connecting local clients to the # internal DNS stub resolver of systemd-resolved. This file lists all # configured search domains. # # Run "resolvectl status" to see details about the uplink DNS servers # currently in use. # # Third party programs should typically not access this file directly, but o> # through the symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a # different way, replace this symlink by a static file or a different symlin> # # See man:systemd-resolved.service(8) for details about the supported modes > # operation for /etc/resolv.conf. #nameserver 127.0.0.53 options edns0 trust-ad #search . nameserver 192.168.217.82 domain artha.ot search artha.ot
# # run resolvconf? RESOLVCONF=no # startup options for the server OPTIONS="-4 -u bind"
4) Restart Bind9
systemctl restart bind9
systemctl status bind9 -l
5) Uji coba DNS server
try "nslookup"
nslookup artha.ot
Komentar
Posting Komentar