Second Name Server on One server

Ubuntu 20.04 Server
I am building a dedicated web server to host my own domains. I have one piece of Dell 610 server only. I will use my own BIND server to resolve my domain names. After setting up ns1.mydomain.com, how do I setup ns2.mydomain.com? I have one single server only. Is it possible setting up a secondary name server with one piece of hardware? I would like to avoid to cost of purchasing a second Dell 610 and paying extra fees for the second server at the data center.
Thanks

Yes you can. Just re-run the Post-Installation Wizard by going to System Settings > Re-Run Install Wizard and add the additional nameserver(s) in the DNS configuration step of the wizard.

Once you have completed the Post-Installation Wizard, you can re-check the server configuration by going to System Settings > Re-Check Configuration to make sure that everything is properly setup.

1 Like

Thank you for your reply. Once added the secondary name server, where can I change the settings, zones etc? In the BIND DNS Server menu cannot see the second name server.

You can make necessary changes by going to System Settings > Server Templates > Default Settings > BIND DNS Domain or make global server changes from Webmin > Servers > Bind DNS Server.

Make sure you:

  1. Created a new “A - IPv4 Address” record for ns2.mydomain.com in Server Configuration > DNS Records.
  2. Tell Virtualmin to use your nameservers when it generates NS records for new Virtual Servers that it creates. You can do that by going into System Settings > Server Templates > Default Settings > BIND DNS Domain, and update Master DNS server hostname as well as Additional manually configured nameservers.

I use cheap (like $5/month) virtual machines for my secondaries for most of my zones. DNS requires almost no resources for any reasonable volume of requests (really, 2GB of RAM is a pretty big DNS machine if you’re not seeing massive traffic). I’m also slowly switching to using AWS Route 53 for important/work-related zones, because it’s a pretty cheap way to get massively redundant anycast DNS.

1 Like

Removed the virtual machines and re-ran the setup wizard. These records on the attached screen shot were generated automatically.

Do I need to add these ‘A’ records again for .ns2 ?

Yes. For both ns1 and ns2. Should look something like this in the list after you set it up:

ns1        A - IPv4 Address        [your ip address]
ns2        A - IPv4 Address        [your ip address]

You can use that green [+ Create Record of Type] button below the list to add the A records.

Also, I second this:

I added those last two marked lines. Are they correct?

The first 13 records before that were automatically generated. Are they okay?

That looks right but I did a quick check in mxtoolbox and it seems that your domain isn’t resolving though. Could either be because the records aren’t updated yet (Usually take a couple hours or less) or there’s something else going on with your DNS server.

Try to periodically check mxtoolbox every few hours and if everything is properly set up, your records should reflect in mxtoolbox when the dns records are updated.

Thank you very much for your help. My domains are not resolving now. I am running a test server at home installed on a regular desktop computer. Hopefully in a week my Dell server will arrive, I will install and take it to the data center. Unfortunately my home IP is not resolvable, cannot do the final test until I take the final server to the data center. Thanks again.

As for running a cheap $5 virtual server for the second name server, I don’t think it makes any sense. Let’s say the worst thing happens and my only serves dies: I would lose the web server and the primary DNS server. Having an external server pointing the dead server is next to nothing :slight_smile:

Quoting an answer from this Serverfault thread:

Generally a DNS server contains more information than just a single server, it might contain mail routing information, information for many many hosts, mail spam keys, etc. So resilancy and redundancy are of DEFINITE benefit to domain holders.

And quoting another answer from that same thread:

If all you run is a web server a secondary DNS may not seem that important. However, when your server is down there are a number of reasons you may want a backup DNS server, including:

  • to enable you to ping or traceroute to your host to verify it is down.
  • to prevent users and crawlers from deciding your domain is no longer used.

If your domain gets or send email you need a backup DNS to establish your credibility and ensure future delivery of email. If a mail server looks up you domain and finds it doesn’t exist, it will immediately bounce your email. However, if it DNS lookups succeed and the server is down, then the email will be queued for later delivery. Only if you are down for a few days will your email start bouncing. (Some poorly behaved automated delivery systems try only once and may fail to deliver messages even if your server is up.)

Maybe the best solution is that as primary name server I use my own server, and for secondary name server the registrar’s name server?
So as long as my server is up, I can take the advantage of my own fast name server. If something bad thing happens still there is the registrar’s name server for backup

ffs. cloudflare.

You can have pretty much unlimited sites in a free account.
You don’t need to use anything but their DNS services.

Yes I already transferred a few domains to them. They have the lowest renewal fees. Their DNS server is the second fastest according to this review

I don’t think I can come up any faster name server if I run it on my own.
By adding multiple ip addresses to the A records you can do round robin load balancing, although no failover monitoring. Not a big problem.
If you have multiple servers, you can run a cron job that monitors the other servers. If one server is down, by API calls that A record can be deleted, so the traffic is not directed to the dead server.