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
Nginx is a high-performance HTTP and reverse prox...
HostDare launched the Japanese VPS at the end of ...
We often hear network operators and equipment ven...
Bandwagonhost restocked its first special annual ...
2019 is a crucial year for the mobile phone indus...
[Beijing, July 3, 2018] Digital performance compa...
Some media reported that "the first tens of ...
AkkoCloud is a merchant that mainly provides VPS ...
Virtono recently launched a 2022 New Year promoti...
1. Introduction to DHCP DHCP (Dynamic Host Config...
On June 6, 2019, the Ministry of Industry and Inf...
[[280015]] 4G changes life, 5G changes society. W...
In the summer of 2019, a set of data about China&...
Sharktech's two promotional machines this mon...
Guizhou Tianhetan Scenic Area is famous for its t...