Default DNS Template


Sorry to be a pest, (as i've had lots of questions/requests lately) but I'm wondering if there is a way to get rid of "", "".

I like to keep my DNS zones clean, and tidy in my own way. LoLz

Here's the zone configuration I'd like:

mydomain.comA1.2.3.4 ftp.mydomain.comA1.2.3.4 mail.mydomain.comA1.2.3.4 mydomain.comMX mydomain.comTXT"v=spf1 a mx ip4: ?all"

I'd like "sub-servers" to add fewer records, like so. (they are added to the "primary-server" zone)

mysub.mydomain.comA1.2.3.4 www.mysub.mydomain.comA1.2.3.4

I just think this would clean things up quite nicely. I like to reserver "" for usage as a "sub-server", so I can separate it when designing a mobile version of a site. Honestly, "" never really made any sense, and I'd rather not expose my internal IP address publically, as this really is seen as a security issue to me.

At the moment, I simply delete the extra records after creation as I've managed to configure the default DNS servers nicely.

If you have any suggestions, or comments regarding the above proposed idea, please let me know. Also if this is doable, some details on how to accomplish it would be appreciated.

Thanks in advance!

Closed (fixed)


Sure, you can have complete control over the DNS records Virtualmin uses for new domains.

Just go to System Settings -> Server Templates -> Default Settings -> BIND DNS Domain, and in the "BIND DNS records for new domains" enter all the records you want, including the SOA. You can use the macros $IP and $DOM which will be replaced by the IP address and domain name respectively. Also, but sure to select "Use only the records above" to tell Virtualmin that these are the only records you want, not extras to be added to those it generates automatically.

tpnsolutions's picture
Submitted by tpnsolutions on Sat, 10/03/2009 - 16:58

Ok, I remember now why I never did this before.

Here's the deal.

First off, the serial number for the zone doesn't get updated correctly when you do manual templates like this, even by using:


As this generates the same serial each time, if you update the zone more than once per day. No good as slave servers may not pick up the changes for at least 24 hrs in some cases.

The more serious issue though, regarding my original request is:

No matter what you do, "Sub-Servers" always add the "" and "" A records.

Basically, I updated the section noted above (as you pointed out) for both "Top-Level" and "Sub-Server" templates, and the "Sub-Servers" didn't play nice. It's as if they ignored my request to "use ONLY" the above records.

Thanks again for your assistance, and I hope we can archive this issue shortly :-)

tpnsolutions's picture
Submitted by tpnsolutions on Sat, 10/03/2009 - 17:09

While we're on the topic, I'd like to also "fork" this thread a bit.

  1. I think a variable ${EXTERNAL_IP} should be added for those who use a different IP for virtualhosts and DNS.

**** such is the case here, as we are behind a firewall and use internal IPs for apache, while we use the public IP for Bind ***

  1. This may be a bug, but if not can be a recommendation: when you disable DNS for a "Top-Level" domain which includes "Sub-Servers" within the same domain space, those too should be flagged as disabled, so that when you enable the "Top-Level" domain, all changes can be reflected on "Sub-Servers" too.

Regarding the SOA, I recommend using $CURRENT_TIME which is the current Unix time in seconds. When you then edit records in the zone, this will get auto-incremented.

Regarding the external IP, you can get this from the $DNS_IP variable.

Regarding the sub-domain, the only way to use your template records currently is to have Virtualmin create a separate BIND zone for the sub-domain, which can be configured by setting "Add sub-domain DNS records to parent domain?" to "No" on that same template page.

tpnsolutions's picture
Submitted by tpnsolutions on Sat, 10/03/2009 - 21:09

The variable is good to know, however the sub-server option isn't so much. Perhaps removing the "localhost", and "m" sub-domain defaults from the system would be appropriate for a future release.

At the very least, maybe make it an option in the configurations like you do for "admin" and "webmail".

Frankly, I don't understand why they are hard coded into the system to begin with.

For the immediate future, I'll either modify your source code after each upgrade to disable the additional sub-domains like I did in the past, or create a script which deletes them after the domain is created.

That's definitely not a solution I want to use permanently, but given the price I pay for the product I suppose I can't complain either.

Kudos once again on the prompt responses, and hopefully we might see some changes in the future regarding DNS handling. Hint Hint Nudge Nudge Wink Wink... LOLz

Sure, I could make the m and localhost records optional .. I'll add an option for this in the server templates in the next Virtualmin release.

Automatically closed -- issue fixed for 2 weeks with no activity.