DNS protocol – Communication via UDP and TCP

  DNS, DNS theory, Protocol of DNS

DNS servers communicate with other DNS servers and clients by (resolvers) upon protocols TCP and UDP, in both cases on port 53. Normally request sends by one UDP packet and the response is returned again in UDP packet. This protocol was chosen for its simplicity and minimal overhead, where is need not to establish a connection over TCP for small data.

If it happens that a response does not fit (which may contain either one actual response or other data in additional sections) into a single UDP packet (DNS response size is limited according to standard to 512 bits, not counting the UDP and IP protocol header), will be sent a partial response (maximum of packet size) and in the header it sets a flag for announcing it (truncated). Now can decide whether the received data are sufficient. If not, it sends the same request again, but this time by using TCP, through which you can download full answer in the required number of packets.

However, UDP does not solve packet loss along the way, therefore, the request is repeated after a few seconds, after a specified number of unsuccessful attempts, the DNS server is considered unreachable. It all depends on the settings of resolvers.

Byl pro Vás tento návod užitečný?