In our Quick Tour on Virtualmin Post Installation, we have the option to set up our own name server. In this tutorial, I will show you how to get your own name server for your desired domain.
If you haven’t set up your own Virtualmin installation yet, see Install Virtualmin in Ubuntu 16.04.
At this point, I presume you have a registered domain name already. In my case, I get the domain registration in Freenom.com for this post and set up the DNS records in Cloudflare.
Let us get started!
Add Host records.
Adding host records should be done on your domain provider. In my case, this will be freenom.com.

Click on Management Tools > Register Glue Records.

Enter your desired name server. In my case, I use ns1 and ns2 with my Droplet IP address.
Add A record for your host records.
Adding A record for your host names, this should be done on your DNS provider. In my case, I use a 3rd party name server, which is Cloudflare.

Add both ns1 and ns2 as an A record, with your Droplet IP address as shown above.
Please be advised, avoid adding a proxy cloud on your name server, these should be grayed out. If you have hesitation, see the article below:
What subdomains are appropriate for orange / gray clouds?
From here, you should be all set. Just wait for the propagation period for this to work. This can take 2 to 4 hours depending on your TTL.
If you wish to check the propagation records if these are working try:
https://toolbox.googleapps.com/apps/dig/
For example:
