Please adjust above to your environment, I am assuming that you are using static IP instead of dhcp.
You dont have to have static IP but for server it is good idea to have it
Following is the very basic configuration to create a DNS server using bind9. Start by updating the system if needed
sudo apt-get update && sudo apt-get upgrade
Now if you have not installed bind9 yet, install it
sudo apt-get install bind9 dnsutils
Now go to its directory
cd /etc/bind
Make changes to main configuration file
nano named.conf.local
and paste/add the following
// 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 "mydomain.local" {
type master; file "/etc/bind/db.mydomain.local";
};
zone "15.168.192.in-addr.arpa" {
type master; file "/etc/bind/db.192.168.15";
};
Now creat zone file, start with forward zone
nano db.mydomain.local
and paste/add the following information in that file
$TTL 604800
@ IN SOA dnsserv1.mydomain.local. admin.mydomain.local. (
10 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ; Negative Cache Time To Live
)
@ IN NS dnsserv1.mydomain.local.
@ IN A 172.168.15.1
@ IN MX 10 dnsserv1.mydomain.local.
dnsserv1 IN A 172.168.15.1
www IN CNAME dnsserv1
xp-box IN A 172.168.15.2
Save the above file and exit out of it, now lets create reverse zone for above forward zone
nano db.172.168.15
You can name it any way it does not really matter, paste/type the following information in it
$TTL 604800
@ IN SOA dnsserv1.mydomain.local. admin.mydomain.local. (
10 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ; Negative Cache Time To Live
)
@ IN NS dnsserv1.mydomain.local.
1 IN PTR dnsserv1.mydomain.local.
2 IN PTR xp-box.mydomain.local.
That is pretty much it and shiny DNS Server is ready, you can check it by running following command