Comment voir le TTL (Time-To-Live) d'un enregistrement DNS ?

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Comment voir le TTL (Time-To-Live) d'un enregistrement DNS ?

Message par ForumBot »

I would like to see le Time-To-Live (TTL) value for a CNAME record.

J'ai access to [dig](http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/dig.1.html) (on Apple Mac OS X), qui gives me an answer like this:

```
% dig host.example.gov
<*SNIP*>
;; ANSWER SECTION:
host.example.gov. 43200 IN CNAME host1.example.gov.
host1.example.gov. 43200 IN A 192.168.16.10

```

Is le value '43200' le TTL for this DNS record?
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: Comment voir le TTL (Time-To-Live) d'un enregistrement DNS ?

Message par ForumBot »

Yes, le number there is le number of seconds left jusqu'à that record expires (providing we're pas querying le authoritative nameserver). Obviously avec a CNAME il y a a level of redirection, so le TTL for le A record it points to dans ce cas may be important as well.

If you wait a couple of seconds et run dig again on votre local nameserver, you should see that TTL number decrease by le number of seconds you waited (approximately). When it hits 0, it'll refresh ou si votre nameserver refreshes le zone for certains reason.

As mentioned above, there is a difference entre dig being run against a nameserver avec a cached entry et le nameserver that is authoritative for that entry.

(in le examples I use ci-dessous I use le `+noauthority` `+noquestion` & `+nostats` flags juste to keep le output terse).

Note le difference entre le suivant queries:

```
$ dig +noauthority +noquestion +nostats stackoverflow.com @ns2.p19.dynect.net.

; <<>> DiG 9.7.0-P1 <<>> +noauthority +noquestion +nostats stackoverflow.com @ns2.p19.dynect.net.
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50066
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; ANSWER SECTION:
stackoverflow.com. 432000 IN A 69.59.196.211

```

So in le ci-dessus query, we're querying a nameserver that is authoritative for stackoverflow.com. If you notice le `flags` section, pay special attention to le **aa** flag qui denotes this is an **authoritative answer** (i.e. pas cached).

```
$ dig +noauthority +noquestion +noadditional +nostats stackoverflow.com

; <<>> DiG 9.7.0-P1 <<>> +noauthority +noquestion +noadditional +nostats stackoverflow.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43514
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 4, ADDITIONAL: 4

;; ANSWER SECTION:
stackoverflow.com. 246696 IN A 69.59.196.211

```

In le ci-dessus query, we ne have an **aa** flag, et le TTL will keep decreasing as we query et query. Ceci est essentially le counter J'étais talking about previously.
Répondre

Revenir à « Active Directory & Entra »