Please help an idiot (me) with DNS

Can someone please tell me what I might be doing wrong and the proper steps required at the registrar level to use BIND for my own domains?

mydomain.com registered at godaddy.

Then I add NS1.mydomain.com as a nameserver
Then I add Ns2.mydomain.com as a nameserver
Then I add both as hosts pointing to the ip address of my server.

Is this correct so far?

If so, what should the centos/virtualmin hostname be? mydomain.com or nsX.mydomain.com
Then, do I need to set up virtual servers for the host & each nameservers?

Or better yet, what do I need to set up, assuming the part at the registrar is correct?

Totally confused as to how handle the DNS, both at setup stage & then what I need to put in a template so I can easily set-up & register/move domains I have elsewhere.

Thanks

Related question – Is there a way to generate BIND records for a domain added to virtualmin after the fact?
In other words, once the DNS and templating issues are solved, how would I do it for a domain without having to delete the website and go through the process from scratch.

I think you can just disable and re-enable the DNS feature for the domain in the Edit page. That’ll regenerate the records (I’m pretty sure), based on what’s in the Server Template.

1 Like

If so, what should the centos/virtualmin hostname be? mydomain.com or nsX.mydomain.com

It doesn’t matter much, but I recommend not using a name for which you’ll be receiving mail (e.g. if you’ll be getting mail at mydomain.com, use something else, like ns1.mydomain.com or srv1.mydomain.com). This allows you to simply ignore mail configuration, because it’ll Just Work when you add the domain (mydomain.com) to Virtualmin.

The first name server record defaults to the hostname of the system, but that is configurable. I like to use server names like “srv1.virtualmin.com”, “srv2.virtualmin.com”, etc. and then have “ns1.virtualmin.com” and “ns2.virtualmin.com” be my name servers on all of my Virtualmin hosts. I tend to recommend doing it this way, so that your name server names are independent; you can move your name service or the hosted domains somewhere else easily, and without disrupting other services, if you do it this way.

Then, do I need to set up virtual servers for the host & each nameservers?

No. Create a virtual server for mydomain.com, and then use the BIND DNS module to add A records for nsX.mydomain.com within that zone. DNS service is (and should be) mostly independent of your Virtualmin domains. You setup one set of name servers at the beginning, and then all of your Virtualmin virtual servers use that set of name servers for their NS records. You only have to set up name servers once in this scenario, and only have to deal with the stupid complexity of glue records (which are a bit ornery to setup the first time).

We recently added a feature to automatically handle each domain hosting its own name servers, but I think this is a mistake (maybe not a mistake for us to add the feature, but a mistake for the vast majority of administrators to consider using it…glue records are a pain in the ass…do them once for your “main” domain and use those two name servers for all the rest of your servers, and then you can just forget about it forever).

Oh, and in case it wasn’t clear: Don’t create nsX.mydomain.com as Virtualmin virtual servers. They aren’t websites. They are just A records in the mydomain.com zone, and you don’t want them to be whole new zones of their own or to get all the other services associated with them. You just want an A record for each of your name servers, and you want to use those two (or more) name servers in the Virtualmin configuration as the name servers for your domains.

Thanks Joe,
I think I have it now.