DNS and TCP?

life24

Senior member
Mar 25, 2014
283
0
76
Hello my friends,
In DNS we use TCP when i want use "Zone Transfer" and transfer packet upper 512 KB.

Why we use TCP instead UDP when transfer packet upper 512 KB?
 

kevnich2

Platinum Member
Apr 10, 2004
2,465
8
76
DNS uses IP port number 53 and can either use UDP or TCP for transport. Generally, UDP (limited to 512 bytes) is used for queries and responses i.e. Lookups but, TCP (virtual circuit) has to be used for Zone Transfers as the data shared between authoritative servers handling particular zones needs to be reliable.
 

Fallen Kell

Diamond Member
Oct 9, 1999
6,163
514
126
As kevnich2 said, TCP is used because its protocol has guarantees that the data that was sent over it was actually received (and received properly) by the other system. UDP has no such guarantee that the data was received, it is essentially "fire and forget" vs "fire and confirmed hit".
 

Gryz

Golden Member
Aug 28, 2010
1,551
204
106
Long long time ago, there were networks that had an MTU of only 500-600 bytes.
See this list for MTU-sizes of old layer-2 networks.
https://docs.appneta.com/book/export/html/532
I think Arcnet was quite popular before Ethernet took over as the one and only LAN-technology. And Arcnet had an small MTU.
I think in those days it was also common to configure smaller MTUs for slow-speed dialup-link, like 14.4Kbps modems, etc.

Nowadays everything assumes the minimum MTU is 1500 bytes.
But in the old days, it was different.
And DNS is a very old protocols (from the eigthies).

Fragmenting UDP packets is a problem. Or to be more precise, re-assembling them is a problem. It is expensive (you need to reserve memory to buffer the fragments, and you don't know how long you should keep those fragments around, if it seems one fragment was dropped somewhere). So the DNS guys wanted to prevent fragmenting, no matter what. So they defined the maximum size of a DNS packet in UDP to be so big it would always fit in an Arcnet packet, or some kinda value around 500 bytes.

If DNS was designed today, that number 500 would have been changed into 1500.

But the thinking was: if it is just one small query, with a small answer, and the whole reply will guaranteed fit in a single UDP-packet, then use UDP. But if there is more data to transmit than fits into 500 bytes, there is a chance we might need to fragment. And in that case, just use TCP. Simple.