Deploying Bind9 DNS

From The Opensource Knowledgebase
Jump to navigation Jump to search
Setup Details
Details
Platform: Ubuntu 24.04 LTS
Domain: corp.networked.com
Realm: CORP

Server Details
OS: Ubuntu Server
IP address: 172.16.141.101
Subnet: 255.255.255.0
Gateway: 172.16.141.1
DNS:8.8.8.8
Search Domain: Corp.networked.com

Pre-requisites

  • Ubuntu server 20.04 LTS, fully patched
  • User account with sudo access
  • Internet Access

Installing Bind 9

  • For installing bind9: ssh into the dns server using the credentials and run the following commands
$ sudo apt update && sudo apt upgrade -y
$ sudo bind9 bind9utils bind9-doc dnsutils
  • Check if the service started
$ sudo systemctl status bind9.service
  • After installing the bind9 server, there are three main files that need to be modified
    • /etc/bind/named.conf.options
    • /etc/bind/named.conf.local
    • /etc/resolv.conf
  • Make changes to /etc/bind/named.conf.options. Make a copy of the original file by renaming the original file as something else as a backup in case there are any issues with the configurations
$ sudo cp -prav /etc/bind/named.conf.options /etc/bind/named.conf.options_ORG
  • Open /etc/bind/named.conf.options in an editor and make following changes
directory "/var/cache/bind";
recursion yes;
allow-query { any; };
forwarders {
8.8.8.8;
8.8.4.4;
};
forward only;
  • Save the file and restart the bind9 service
$ sudo systemctl restart bind9.service
  • Make changes to /etc/bind/named.conf.local. Make a copy of the original file by renaming the original file as something else as a backup in case there are any issues with the configurations
$ sudo cp -prav /etc/bind/named.conf.local /etc/bind/named.conf.local_ORG
  • Open the /etc/bind/named.conf.local in an editor and add the following details
zone "internal.zeta.in" {
type forward;
forward first;
forwarders { 172.16.64.51; 172.16.64.52; };
};

zone "internal.directi.com" {
type forward;
forward first;
forwarders { 172.16.140.34; 172.16.140.33; };
};

zone "corp.zeta.tech" {
type forward;
forward first;
forwarders { 172.16.64.58; 172.16.64.59; };
};

zone "ciat.supporthub.tech" {
type forward;
forward first;
forwarders { 172.16.64.58; 172.16.64.59; };
};

zone "kavp.zeta.in" {
type forward;
forward first;
forwarders { 172.16.64.51; 172.16.64.52; };
};

zone "h-nova.internal.nova.tech" {
type forward;
forward first;
forwarders { 172.16.64.51; 172.16.64.52; };
};

zone "connect.zeta.tech" {
type forward;
forward first;
forwarders { 172.16.64.58; 172.16.64.59; };
};
  • Save the above file and make change to /etc/resolv.conf by opening the file in an editor
search <domainname>
nameserver <serverip>
  • Save the file and do a configuration test and restart the bind9 server
$ sudo named-checkconf /etc/bind/named.conf.local
$ sudo systemctl restart bind9

Bind 9 server is now installed and configured.

Webmin Installation

Webmin is a web-based interface for system administration for Unix. Using any modern web browser, you can setup user accounts, Apache, DNS, file sharing and much more. Webmin removes the need to manually edit Unix configuration files like /etc/passwd, and lets you manage a system from the console or remotely. Latest webmin will be installed by using the webmin repositories

Adding repository

Make a copy of the original sources.list file and then add the webmin repository -

$ sudo cp -prav /etc/apt/sources.list /etc/apt/sources.list_ORG

Add the webmin repository by opening /etc/apt/sources.list file in an editor and adding the below line at the end of the file

deb http://download.webmin.com/download/repository sarge contrib

Update and add the signing key

$ sudo apt update
$ sudo wget -q -O- http://www.webmin.com/jcameron-key.asc | sudo apt-key add

Install webmin

$ sudo apt install webmin

Start using Webmin

  • By default webmin gets installed listening to port 10000
  • Open a browser and browse https://<ip-address>:10000

Webmin is now installed

DNS Servers in other locations

  • There is no diference in the configuration files of the DNS server in other locations. Whenever a new DNS server needs to set up, copy named.conf and named.conf.local files to the new server in the same location and make changes to the /etc/resolv.conf file
  • The DNS server in the new location will be ready

References