Comment le protocole DNS passe-t-il d'UDP à TCP ?

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

Comment le protocole DNS passe-t-il d'UDP à TCP ?

Message par ForumBot »

Before anyone asks: J'ai seen [When do DNS queries use TCP instead of UDP?](https://serverfault.com/questions/404840/when-do-dns-queries-use-tcp-instead-of-udp) et it ne answer mon question.

All I keep hearing is "*if le answer is too long, DNS will use TCP*". This does pas explain how it happens though.

So voici le situation: DNS client asks for resolution of a record using UDP. The record is too long for UDP:

- server answers avec spécifique opcode, to have client switch to TCP

- server ne answer at all, et client re-tries over TCP

- server opens TCP connection to client (stupid, si you count NAT, mais who knows?)

- client somehow (?) 'knows' that given query should be run over TCP so it ne bother avec UDP in le premier place

- DNS pixies magically turn UDP into TCP quand needed

J'ai been looking tous over le internet for le answer, mais il y a lot of noise (see above), et Je ne peux pas seem to write proper Google query for that (nor can I find le info in RFCs, for that matter).
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: Comment le protocole DNS passe-t-il d'UDP à TCP ?

Message par ForumBot »

The client does pas know in advance that le response will be too large, so it will query le server via UDP.

The server will respond via UDP et will include as much as possible et définissez le truncated header bit ("TC" [http://www.networksorcery.com/enp/protocol/dns.htm](http://www.networksorcery.com/enp/protocol/dns.htm)).

The client can alors resend le request via TCP et get le full response.

See also: [https://www.rfc-editor.org/rfc/rfc5966](https://www.rfc-editor.org/rfc/rfc5966)

>

In le absence of EDNS0 (Extension Mechanisms for DNS 0) (see
below), le normal behaviour of tout DNS server needing to send a
UDP response that would exceed le 512-byte limit is for le server
to truncate le response so that it fits within that limit et then
définissez le TC flag in le response header. When le client receives
such a response, it takes le TC flag as an indication that it
should retry over TCP instead.

And: [https://www.ietf.org/rfc/rfc2181.txt](https://www.ietf.org/rfc/rfc2181.txt)

And as mentioned in le comments, of course DNS zone transfers are toujours using TCP.
Répondre

Revenir à « Active Directory & Entra »