Changing TTL for domin only affects domain.com but not www.domain.com

SYSTEM INFORMATION
OS type and version Centos 7.9
Virtualmin version 7.10.0 Pro

Hi great people
A long time since i posted here.

I have a need to change the TTL of a domain ready for a move to another server (site is hosted elsewhere so I only need to update the “A” record) to 300 (5 minutes).
I have updated the TTL in the DNS settings > DNS Records > Manually Edit Records and saved.

The top line now reads “$ttl 300”.

When I check using online services I see that domain.com TTL is 300 but the www.domain.com is 11 hours.

Obviously I’m being thick as usual.

Please can someone point me in the right direction?

I know the OS is past it’s due date and as a result I cannot install the later version of Virtualmin. That is on my list of “to-dos”.

I would appreciate any help that anyone can offer.

If it was originally set to 11 hours, it can take up to 11 hours to update all records.

I don’t see a separate TTL for each A record in Virtualmin, compared to Cpanel where do have a TTL record, not sure why that is.

I just tried the command virtualmin modify-dns --domain example.com.au --all-ttl 5m
By the doc should add to all records, but doesn’t seem to add to the A records.

Am I correct to believe that www.domain.com is a sub-domain of domain.com?

If that is the case, should there be a different TTL anyway?

@staff can anyone there confirm this?

Thanks for your time everyone.

Yes, it is, and it can be just another record in the same zone as domain.tld or a separate zone record like www.domain.tld.

TTL is per record, not “per domain” or “per subdomain”.

@Ilia is the command as @stefan1959 has shown working as expected?

Yes, it worked perfectly fine for me:

root@debian12-pro:/var/lib/bind# virtualmin modify-dns --domain debian12-pro.virtualmin.dev --all-ttl 5m
Updating server debian12-pro.virtualmin.dev ..
    Setting default TTL to 5m ..
    .. done
.. done

root@debian12-pro:/var/lib/bind# gd
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   debian12-pro.virtualmin.dev.hosts

no changes added to commit (use "git add" and/or "git commit -a")
diff --git a/debian12-pro.virtualmin.dev.hosts b/debian12-pro.virtualmin.dev.hosts
index f57cc90..a84c1c6 100755
--- a/debian12-pro.virtualmin.dev.hosts
+++ b/debian12-pro.virtualmin.dev.hosts
@@ -1,6 +1,6 @@
-$ttl 3600
+$ttl 5m
 debian12-pro.virtualmin.dev.	IN	SOA	host.debian12-pro.virtualmin.dev. root.host.debian12-pro.virtualmin.dev. (
-			2025060500
+			2025111100
 			3600
 			600
 			1209600
root@debian12-pro:/var/lib/bind# systemctl restart named
root@debian12-pro:/var/lib/bind# 

I thought that should add a TTL to all A records (and other records), like it is in CPanel

I can do it with the virtualmin modify-dns --domain example.com --add-record-with-ttl "www A 5m 192.0.2.1"
But thats adding a record not modifying a current record.

Thats how I read the docs, although I can see that the one setting would do all records though.

image

But then whats the difference between --ttl and --all-ttl flag

From the docs:

The default TTL for records can be set with the --ttl flag
followed by a number in seconds. Suffixes like h, m and d are also allowed
to specific a TTL in hours, minutes or days. Alternately, the --all-ttl
flag can be used to set the TTL for all records in the domain.

You probably shouldn’t do that in general. Unless you have a specific record that needs to change at a very different rate than the rest (e.g. some cloud thing with an ephemeral IP or whatever that you expect to change very frequently), it’s nicest to maintain one TTL.

1 Like

I’m happy asis, just testing and I don’t think the command does what it says in docs.
Might be useful for users who want to move say www to another server and just want the www A record to be a low TTL.
But getting off topic.

@stefan1959 Do the docs need new wording for this command.

Can you post here the doc URL and suggested changes to the wording? Or is it just in the cli?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.