DNS
Using bind on ubuntu:
Network Setup:

Step 1: Install BIND
First, update your package lists and install BIND9:
sudo apt update
sudo apt install bind9 dnsutilsStep 2: Configure the DNS Zone for team2.net
team2.netNeed to configure the forward and reverse DNS zones for team2.net.
Forward Zone File Configuration
Navigate to the BIND directory
cd /etc/bindCreate the forward zone file for team2.net. First, open the named configuration file to define the zone:
sudo nano named.conf.localAdd the following zone definition:
zone "team2.net" {
type master;
file "/etc/bind/zones/db.team2.net";
};Create the directory for your zones if it doesn't already exist:
sudo mkdir /etc/bind/zonesNext, create and edit the zone file:
sudo nano /etc/bind/zones/db.team2.netAdd the following records to the zone file:
$TTL 604800
@ IN SOA ns1.team2.net. admin.team2.net. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
; Name servers
@ IN NS ns1.team2.net.
; A records for name server and other hosts
ns1 IN A 192.168.2.12
www IN A 192.168.2.5
db IN A 192.168.2.7Step 3: Reverse Zone File Configuration
This step is optional but recommended for resolving IP addresses back to hostnames.
Define the reverse zone in named.conf.local:
sudo nano named.conf.localAdd the reverse zone configuration:
zone "2.168.192.in-addr.arpa" {
type master;
file "/etc/bind/zones/db.192.168.2";
};Create the reverse zone file:
sudo nano /etc/bind/zones/db.192.168.2Add reverse mappings:
$TTL 604800
@ IN SOA team2.net. admin.team2.net. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
@ IN NS ns1.team2.net.
12 IN PTR ns1.team2.net.
5 IN PTR www.team2.net.
7 IN PTR db.team2.net.Step 4: Check Configuration and Restart BIND
After setting up your zone files, check the configuration for errors:
sudo named-checkconf
sudo named-checkzone team2.net /etc/bind/zones/db.team2.net
sudo named-checkzone 2.168.192.in-addr.arpa /etc/bind/zones/db.192.168.2If everything is configured correctly, restart BIND to apply changes:
sudo systemctl restart bind9Step 5: Test DNS Server
Use dig or nslookup to test your DNS server and ensure it's resolving domain names correctly:
dig @192.168.2.12 www.team2.net +short
dig -x 192.168.2.5 @192.168.2.12 +shortFinal Config Output:
Config "/etc/bind/named.conf.local"
//
// Do any local configuration here
//
// Consider adding the 1918 zones here, if they are not used in your
// organization
//include "/etc/bind/zones.rfc1918";
zone "team2.net" {
type master;
file "/etc/bind/zones/db.team2.net";
};
zone "2.168.192.in-addr.arpa" {
type master;
file "/etc/bind/zones/db.192.168.2";
};
Config "/etc/bind/zones/db.team2.net"
TTL 604800
@ IN SOA ns1.team2.net. admin.team2.net. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
; Name servers
@ IN NS ns1.team2.net.
; A records for name server and other hosts
ns1 IN A 192.168.2.12
www IN A 192.168.2.5
db IN A 192.168.2.7
Config "/etc/bind/zones/db.192.168.2"
TTL 604800
@ IN SOA team2.net. admin.team2.net. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
@ IN NS ns1.team2.net.
12 IN PTR ns1.team2.net.
5 IN PTR www.team2.net.
7 IN PTR db.team2.net.Last updated