Creating a Master, Slave, Slave Nameserver setup using Vesta Control Panel

https://jefferytay.wordpress.com/2015/07/14/creating-a-master-slave-slave-nameserver-setup-using-vesta-control-panel/

You can easily setup a master, slave DNS using Vesta CP with a single command line found at

https://vestacp.com/docs/#how-to-setup-dns-cluser

However should you bring this to the next level and use it for your “enterprise” web hosting, there are a few things you need to do

 

You might be tempted to setup Vesta in the following way, where all the webhosts will sync to NS01 and then have NS01 sync the dns config over to NS02.

image

Unfortunately Vesta does not allow you to do this, BUT it does allow the setup as shown below, where each of the web servers will send the dns updates to each of the named servers.

image

 

Setting up the NameServers (NS01, NS02)

Now given that Vesta will install and setup different components depending on the amount of ram of the machine, for NS01 and NS02, it would be wise to go with 512MB ram so that it will install the bare minimum.

Once you have installed Vesta on the servers, its time for some clean up

    1. Delete the unused packages

cd $VESTA/bin 
./v-delete-user-package palegreen 
./v-delete-user-package gainsboro 
./v-delete-user-package slategrey

  1. Create the dns-cluster user, who will own all the domains that was synchronized over./v-add-user dns-cluster [password] [email] default [firstname] [lastname]
  2. Stop all the unnecessary services./v-stop-service httpd 
    ./v-stop-service nginx 
    ./v-stop-service exim 
    ./v-stop-service dovecot 
    ./v-stop-service vsftpd
  3. Login to Vesta using your web browser, and disable the necessary services at the Firewall section
    1. Accepted services: SSH, DNS, Vesta, Ping
    2. Blocked services: Web, FTP, SMTP, POP3, IMAP, DB

Setting up the Master > Slave DNS (Web01, Web02 > NS01, NS02)

Remember that Vesta allows you to add an unlimited number of slave DNS for each master server

So for web01, and web02, run the following commands:

cd $VESTA/bin 
./v-add-remote-dns-host ns01 8083 admin [ns01 admin password] 
./v-add-remote-dns-host ns02 8083 admin [ns02 admin password]

 

You can verify that this is done by doing to server setup and ensuring that DNS is set to cluster and confirm that the following cron job exists

image

 

Testing the setup

Now goto web01 and/or web02 and create a few domains, on ANY accounts and at for the 6th minute of the hour, goto ns01 and ns02 to confirm that the changes are synchronized

 

Now what about URGENT cases

If there are cases where you urgently need to sync over, you can run this command on all of your web servers for each named server that you have: v-sync-dns-cluster [target host]

e.g 
v-sync-dns-cluster ns01 
v-sync-dns-cluster ns02