Berkley Internet Naming Domain/Daemon (BIND)
- is the most common program used for maintaining a domain name server on Linux
Installation
Click here to expand...
packages to install
bind9 - the DNS service
dnsutils - a set of tools such as dig which can be helpful for testing and troubleshooting.
bind9-doc - Local info pages with information about bind and its configuration options. This is optional but recommended.
apt-get
- install bind9
- sudo apt-get install bind9 dnsutils bind9-doc
- path to bind configuration files
- /etc/bind
- /etc/bind9
yum 1. install bind9
yum install bind9 dnsutils bind9-doc
Configuration
Click here to expand...
Modifying /etc/bind/named.conf.options
Click here to expand...
# Access Control List that includes the loopback interface and the local network # determines who is allowed to query this DNS acl internals { 127.0.0.0/8; 192.168.86.0/24; }; options { directory "/var/cache/bind"; auth-nxdomain no; # Forward queries to ... forwarders { 192.168.86.1; # Router DNS # 1.1.1.1 # Cloudflare # 8.8.8.8; # Google DNS }; # Listen port 53 from loopback and our own IP Address listen-on port 53 { 127.0.0.1; 192.168.86.218; // IP Address of this Bind9 Server }; # listen IPv6 traffic listen-on-v6 { any; }; # Allow queries from loopback and our internal network allow-query { internals; }; # Do not transfer the zone information to the secondary DNS allow-transfer { none; }; // Allow recursive queries to the local host allow-recursion { internals; }; };Adding Zones
let’s redirect confluence.marcuschiu.com to 192.168.86.217
Click here to expand...
; ; BIND data file for local loopback interface ; $TTL 604800 @ IN SOA confluence.marcuschiu.com. admin.confluence.marcuschiu.com. ( 6 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS local. @ IN A 192.168.86.217 @ IN AAAA ::1open file: /etc/bind/named.conf.default-zones. and add the following lines
... zone "confluence.marcuschiu.com" { type master; file "/etc/bind/confluence.marcuschiu.com"; };restart bind9 server
Test
dig @BIND9-IP-ADDRESS confluence.marcuschiu.com +shortcreate a file /etc/bind/confluence.marcuschiu.com
let’s add {dns.local, vpn.local, proxy.local, etc}
Click here to expand...
; ; BIND data file for local loopback interface ; $TTL 604800 @ IN SOA local. admin.local. ( 6 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS local. @ IN A 127.0.0.1 @ IN AAAA ::1 vpn IN A 192.168.86.221 dns IN A 192.168.86.218 proxy IN A 192.168.86.217 ubuntu-server IN A 192.168.86.28open file: /etc/bind/named.conf.default-zones. and add the following lines
... zone "local" { type master; file "/etc/bind/local"; };restart bind9 server
Test
dig @BIND9-IP-ADDRESS dns.local +short dig @BIND9-IP-ADDRESS vpn.local +short dig @BIND9-IP-ADDRESS proxy.local +short ...
Commands
Click here to expand...
Start Stop Restart (refer to Daemon Manager for various service commands)
sudo service bind9 startsudo service bind9 restartsudo service bind9 stopsudo service bind9 statussudo /etc/init.d/bind9 startsudo /etc/init.d/bind9 restartsudo /etc/init.d/bind9 stopsudo /etc/init.d/bind9 statussudo systemctl start bind9sudo systemctl restart bind9sudo systemctl stop bind9sudo systemctl status bind9