Lightweight DNS Server for VMware Lab

0

For those of you who are building and working with your own VMware labs and using either physical home lab hardware or maybe using VMware workstation to setup your nested VMware lab, you most likely will be in need of a DNS server, especially since the new VCSA 6 appliance basically requires DNS records to be in place or it will not deploy correctly.  I wanted to post for you guys how to spin up your own lightweight DNS server for VMware lab purposes.

The DNS server runs on Ubuntu Server.  I went out and downloaded the latest version of Ubuntu Server which in current trim is version 15.04.  The thing I like about Ubuntu Server is that especially if you are not running many services and only running something like BIND DNS which is what we will spin up, you can get away with just allocating around 512 MB of memory for the VM as well as minimal disk space.

BIND DNS has been around forever, so there are lots of resources out there to help with configuration.  What I don’t like about it is that it is very finicky with syntax and file configurations.  If you don’t have those just right, you will run into problems.  However, hopefully with the file examples below, you can easily spin up a lab DNS server in no time.

Network Configuration

I am using a 192.168.5.0/24 network in my host only network config of VMware workstation.  So all the records and values below are based on that.

Installation

As mentioned above, you can either install BIND during the Ubuntu Server install, by selecting DNS Server as the option you want to include when you come to the packages screen, or you can simply install BIND after the fact, via the command line.

sudo apt-get update && sudo apt-get upgrade

sudo apt-get install bind9

After you have installed BIND you can get started configuring.  Most everything that has to do with your BIND configuration will be found under the directory /etc/bind and the files that need editing will be found here.

Below are examples of the files that I edited and their contents to get my esxlab.local zone up and running on my Ubuntu Server.

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 "esxlab.local" {
        type master;
        file "/etc/bind/zones/esxlab.local.db";
        };

# This is the zone definition for reverse DNS. replace 0.168.192 with your network address in reverse notation - e.g my network address is 192.168.0
zone "5.168.192.in-addr.arpa" {
     type master;
     file "/etc/bind/zones/rev.5.168.192.in-addr.arpa";
};

To create the zone files

sudo mkdir /etc/bind/zones
sudo nano /etc/bind/zones/esxlab.local.db
sudo nano /etc/bind/zones/rev.5.168.192.in-addr.arpa

esxlab.local.db

$TTL	86400 ; 24 hours could have been written as 24h or 1d
; $TTL used for all RRs without explicit TTL value
$ORIGIN esxlab.local.
@  1D  IN  SOA esxlabdns.esxlab.local. hostmaster.esxlab.local. (
			      2002022401 ; serial
			      3H ; refresh
			      15 ; retry
			      1w ; expire
			      3h ; minimum
			     )
esxlab.local.      IN      NS              esxlabdns.esxlab.local.
       

esxlabdns    IN  A      192.168.5.53       
vcsa6    IN  A      192.168.5.19
esx6host1  IN  A      192.168.5.20  
esx6host2  IN  A      192.168.5.21 

rev.5.168.192.in-addr.arpa

@ IN SOA esxlabdns.esxlab.local. admin.esxlab.local. (
                        2006081401;
                        28800; 
                        604800;
                        604800;
                        86400 
)

           IN    NS     esxlabdns.esxlab.local.
53         IN    PTR    esxlab.local
19	   IN	 PTR	vcsa6
20	   IN	 PTR	esx6host1
21	   IN	 PTR	esx6host2

/etc/resolve.conf

Make sure you have the server’s IP address in the resolve.conf file as you can see I have the domain and IP of the Ubuntu server populated.

search esxlab.local
nameserver 192.168.5.53

After you finish with configuring your zones and any other configurations you need to make, you need to restart BIND

sudo service bind9 restart

Troubleshooting

To troubleshoot any issues, look in the /var/log/syslog file to see any BIND related issues.  Also use the command named-checkzone esxlab.local /etc/bind/esxlab.local.db replacing the names with your appropriately named zones and DBs and it will tell you whether or not the zone file has any issues or will load correctly.

Final Thoughts

After spinning up the lightweight BIND DNS server on Ubuntu Server, you will have a useful tool in your VMware lab environment and get some hands on experience with Linux DNS technologies.