Primary and Secondary DNS on same machine

Hi Joe,

I’d like to point both ns1.mydomain.com and ns2.mydomain.com 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 ns1.mydomain.com and ns2.mydomain.com 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?

Thanks

You need to go to the bind configuration for ‘mydomain.com

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

Name: ns1.yourdomain.com.
Address: IP # 1

Name: ns2.yourdomain.com.
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 mydomain.com and pointed your other domains at ns1…and ns2… things should be rolling…
Kevin

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[<>> mydomain.com
;; 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

;; QUESTION SECTION:
;mydomain.com. IN A

;; ANSWER SECTION:
mydomain.com. 3600 IN A 202.43.168.188

;; AUTHORITY SECTION:
mydomain.com. 3600 IN NS ns1.mydomain.com.
mydomain.com. 3600 IN NS ns2.mydomain.com.

;; ADDITIONAL SECTION:
ns1.mydomain.com. 3600 IN A 202.453.168.187
ns2.mydomain.com. 3600 IN A 202.543.168.188

;; Query time: 0 msec
;; SERVER: 10.4.168.187#53(10.4.168.187)
;; WHEN: Thu Mar 8 17:52:01 2007
;; MSG SIZE rcvd: 115

But here’s the dig from the outside:

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

;; QUESTION SECTION:
;mydomain.com. IN A

;; Query time: 21 msec
;; SERVER: 220.233.0.4#53(220.233.0.4)
;; 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 dnsreport.com and see what it returns.

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

${DOM} 38400 IN NS ns2.yourdomain.com

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 mydomain.com for ns1 and ns2.

As for variables:

${DOM} The domain name, such as foo.com
${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 192.168.1.1
${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.

Kevin

Thanks Kevin…

I’ve done points 1 and 2 (BTW - Virtualmin creates the default ns1 line: “@ IN NS ns1.mydomain.com.” - does this mean I could add “@ IN NS ns2.mydomain.com.” 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 mydomain.com for ns1 and ns2.</i>

Not exactly sure re this - do you mean creating the ns1 and ns2 on mydomain.com 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!