Primary and Secondary DNS on same machine

Hi Joe,

I’d like to point both and to the one Virtualmin machine. I’ve got 2 IP’s - can you please let me know what I have to do for Virtualmin to take care of setting up and for new servers, as well as any other config needed on the server? I know about setting up slave but that’s for another machine yeah?

Also, is there a list of Virtualmin variables for use in templates?


You need to go to the bind configuration for ‘

From there, create two new A (Address) records, defining what exactly ns1 and ns2 are…

Address: IP # 1

Address: IP # 2

I’m not sure why VM doesn’t add the domain and expiry to the ns1 record. I never noticed until you pointed it out. It is better to include it, so for now at least, put that line as I typed it. It can only help…

Once you’ve added those A records to the bind conf for and pointed your other domains at ns1…and ns2… things should be rolling…

Thanks again Kevin. I’ve done that - still not working from the outside world, but is this a DNS cache thing?

Here’s dig output run from server (with names and IP’s changed) - does it look right?:

;[<>> DiG 9.3.4[<>>
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31053
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2

; IN A



;; ADDITIONAL SECTION: 3600 IN A 202.453.168.187 3600 IN A 202.543.168.188

;; Query time: 0 msec
;; WHEN: Thu Mar 8 17:52:01 2007
;; MSG SIZE rcvd: 115

But here’s the dig from the outside:

;[<>> DiG 9.2.2[<>>
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 19507
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

; IN A

;; Query time: 21 msec
;; WHEN: Thu Mar 8 17:56:14 2007
;; MSG SIZE rcvd: 29

I know that you created your nameservers at the registrar. BUT, did you point mydomain at those nameservers? Also, have you added your second IP to the server as eth0:0 (or similar?)

Your bind configuration looks alright to me(though I’m no expert)…

Also - did you restart bind after you made the changes? That’s very important, and kind of what it looks like…

If you did restart bind, then yeah, I’d say it’s some sort of cache. Try running a report on and see what it returns.

  1. Edit the bind configuration to set the default nameserver to
  2. Edit the server template for the default server, and add the following to the bind configuration:

${DOM} 38400 IN NS

And make sure that ‘Add above to automatically generated records’ is checked.

That’s virtualmin’s part. You also need to configure bind and be sure and have A records on for ns1 and ns2.

As for variables:

${DOM} The domain name, such as
${PREFIX} The first part of the domain name, like foo
${USER} The user that owns the domain, such as foo
${IP} The IP address assigned to the virtual server, such as
${HOME} The domain user’s home directory, such as /home/foo
In addition, conditional blocks like $IF-MAIL…$ENDIF-MAIL and $IF-WEB…$ELSE-WEB…{$ENDIF-WEB} may be used.


Thanks Kevin…

I’ve done points 1 and 2 (BTW - Virtualmin creates the default ns1 line: “@ IN NS” - does this mean I could add “@ IN NS” to the server template without the “${DOM} 38400”? Or is it better to include it, if so why doesn’t VM do that for default ns1 entry?

<i>You also need to configure bind and be sure and have A records on for ns1 and ns2.</i>

Not exactly sure re this - do you mean creating the ns1 and ns2 on at my registrar? If so, I’ve done that and entered both my IP’s for ns1 and ns2. Or are you saying I need to do something else on the VM server?

No luck yet but maybe I need to give DNS cache the benefit of the doubt and wait and see…

Thanks for your help!