Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

When does DNS use the TCP and UDP protocols?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

DNS uses UDP and TCP port 53 at the same time is recognized, this single application protocol using two transport protocols at the same time in the TCP/IP stack is also an exception. But few people know when DNS uses either protocol separately.

DNS uses UDP and TCP port 53 at the same time is recognized, this single application protocol using two transport protocols at the same time in the TCP/IP stack is also an exception. But few people know when DNS uses either protocol separately.

TCP and UDP

TCP: Connection-oriented protocol that provides reliable data transmission and is generally used for high quality of service requirements.

UDP: User Datagram Protocol is a connectionless transport layer protocol that provides simple, unreliable, transaction-oriented messaging services.

Difference between TCP and UDP

The main difference between UDP and TCP protocols is how they achieve reliable delivery of information.

TCP protocol contains a special delivery guarantee mechanism, when the data receiver receives the information sent by the sender, it will automatically send an acknowledgement message to the sender; the sender will only continue to transmit other information after receiving the acknowledgement message, otherwise it will wait until the acknowledgement message is received.

Unlike TCP, UDP does not provide a guaranteed mechanism for data transfer. The protocol itself does not detect or indicate any loss of datagrams in transit from sender to receiver. UDP is often referred to as an unreliable transport protocol.

Another difference between UDP and TCP is how it receives bursts of multiple datagrams. Unlike TCP, UDP does not guarantee the order in which data is sent and received. In fact, this disorder of UDP protocol is rarely seen, and usually only occurs when the network is very congested.

Since UDP is an unreliable network protocol, what else is valuable or necessary? In fact, UDP can be useful in some situations. UDP has a speed advantage over TCP.

Although TCP protocol has embedded various security functions, it will take up a lot of system overhead in the actual implementation process, which will undoubtedly affect the speed seriously.

On the other hand, UDP eliminates the reliable information transmission mechanism and transfers the functions such as security and sorting to the upper application, which greatly reduces the execution time and ensures the speed.

DNS uses TCP for zone transfers and UDP for other uses.

The DNS specification specifies two types of DNS servers, one called primary DNS servers and one called secondary DNS servers.

The primary DNS server in a zone reads DNS data for that zone from its own local data file, while the secondary DNS server reads DNS data for that zone from the zone's primary DNS server. When a secondary DNS server starts up, it needs to communicate with the primary DNS server and load data information, which is called zone transfer.

Why use both TCP and UDP?

First, let's look at the TCP and UDP transmission byte length limits:

UDP messages have a maximum length of 512 bytes, whereas TCP allows messages longer than 512 bytes. When DNS queries exceed 512 bytes, the TC flag of the protocol appears deleted, and TCP is used to send them. UDP packets are usually no larger than 512 bytes.

TCP is used for regional transmission. There are two main considerations:

The secondary nameserver queries the primary nameserver periodically (typically 3 hours) to see if the data has changed. If there is a change, a regional transfer is performed to synchronize the data. Zone transfers will use TCP rather than UDP because the amount of data transferred synchronously is much larger than the amount of data in a single request and response. TCP is a reliable connection that guarantees data accuracy. UDP protocol used for domain name resolution

The client queries the DNS server for the domain name, and the content returned generally does not exceed 512 bytes, which can be transmitted by UDP. No TCP three-way handshake required, resulting in lower DNS server load and faster response times.

Although in theory clients can specify TCP for queries to DNS servers, in practice many DNS servers are configured to support only UDP query packets.

Original address: https://www.linuxprobe.com/dns-tcp-udp.html

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report