It is generally acknowledged that DNS occupies both UDP and TCP port 53. This situation where a single application protocol uses two transport protocols at the same time is also an exception in the TCP/IP stack. However, few people know under what circumstances DNS uses these two protocols. TCP vs UDP TCP: A connection-oriented protocol that provides reliable data transmission. This protocol is generally used when high quality of service requirements are required. UDP: User Datagram Protocol is a connectionless transport layer protocol that provides simple, transaction-oriented, unreliable information transmission services.
Differences between TCP and UDP The main difference between UDP and TCP protocols is how they achieve reliable delivery of information. The TCP protocol includes a special delivery guarantee mechanism. When the data receiver receives information from the sender, it will automatically send a confirmation message to the sender. The sender will continue to transmit other information only after receiving the confirmation message, otherwise it will wait until the confirmation message is received. Unlike TCP, the UDP protocol does not provide a mechanism to guarantee data transmission. If a datagram is lost during the transmission from the sender to the receiver, the protocol itself cannot make any detection or prompt. Therefore, people usually call the UDP protocol an unreliable transmission protocol. Another difference between UDP and TCP is how to receive multiple bursts of datagrams. Unlike TCP, UDP does not ensure the order in which data is sent and received. In fact, this disorder of UDP rarely occurs, and usually only occurs when the network is very congested. Since UDP is an unreliable network protocol, what is the value or necessity of using it? Actually, in some cases, the UDP protocol may become very useful because UDP has a speed advantage that TCP cannot match. Although various security features are built into the TCP protocol, it will take up a lot of system overhead during actual execution, which will undoubtedly seriously affect the speed. In contrast, UDP eliminates the reliable information delivery mechanism and transfers functions such as security and sorting to upper-layer applications, which greatly reduces the execution time and ensures speed. DNS uses TCP protocol when performing zone transfers and UDP protocol at other times. The DNS specification stipulates two types of DNS servers, one is called the primary DNS server and the other is called the secondary DNS server. In a zone, the primary DNS server reads the DNS data information of the zone from its own local data file, while the secondary DNS server reads the DNS data information of the zone from the primary DNS server of the zone. When a secondary DNS server starts, it needs to communicate with the primary DNS server and load the data information, which is called zone transfer. Why use both TCP and UDP? First, let's understand the length limit of TCP and UDP transmission bytes: The maximum length of a UDP message is 512 bytes, while TCP allows messages to be longer than 512 bytes. When a DNS query exceeds 512 bytes, the TC flag of the protocol will be deleted, and TCP will be used to send it. Usually, traditional UDP messages are not larger than 512 bytes. When using TCP for zone transfers, there are two main considerations:
Use UDP protocol when resolving domain names When a client queries a DNS server for a domain name, the returned content generally does not exceed 512 bytes and can be transmitted using UDP. This eliminates the need for a TCP three-way handshake, which reduces the load on the DNS server and allows for faster responses. Although in theory, the client can also specify to use TCP when querying the DNS server, in fact, many DNS servers only support UDP query packets when configured. |
<<: Huawei Enjoy 10S hands-on review: good looks, photography, and battery life
>>: “Transparent” Ruijie gives people a sense of security
In the future, 5G networks are developing in the ...
What is 5G Home Internet? 5G Home Internet, also ...
Software architecture is always evolving and iter...
The coronavirus has not slowed down China’s stead...
[[263958]] Why is it called Wi-Fi 6? Each new Wi-...
On July 11, Wangsu Technology announced the launc...
[[387801]] This article is reprinted from the WeC...
In 450 BC, Nehemiah, an official of the Persian E...
Technology is constantly evolving, and it's e...
Wi-Fi 6 (802.11ax) is here, and more and more wir...
This article mainly conducts an in-depth analysis...
1. Overview of DHCP Working Principle Before lear...
Most IT organizations are under pressure to be mo...
Recently, at the "ICT China High-level Forum...
In 2020, China, which was the first to achieve a ...