Is DNS TCP or UDP port 53? (2024)

The answer is DNS is mostly UDP Port 53, but as time progresses, DNS will rely on TCP Port 53 more heavily. DNS has always been designed to use both UDP and TCP port 53 from the start1 , with UDP being the default, and fall back to using TCP when it is unable to communicate on UDP, typically when the packet size is too large to push through in a single UDP packet.

When Does DNS Switch to TCP?

The next natural question is: when will DNS messages exceed 512 bytes? Actually, this happens quite often in today’s environment. When DNS was first implemented, the only thing that would be so large that it exceeded the 512-byte limit was a zone transfer, in which one DNS server sends every single resource record in the zone to another machine, usually another DNS server.

In modern DNS systems though, we are increasingly seeing resource record sets (or RRsets) that have a larger combined size. For example, Figure FAQ-5 illustrates querying for www.example.com may yield results such as this (AAAA are IPv6 records):

Or the same query might return the following TXT records, each providing a specific function such as spam detection or site verification as demonstrated in Figure FAQ-6:

If a zone is signed by DNSSEC, it will routinely return large responses due to the cryptographic keys and signatures as shown in Figure FAQ-7:

As more and more people adopt newer features such as IPv6, spam avoidance, and DNSSEC, DNS is more likely to switch to TCP due to the larger response size.

What Happens If TCP Is Blocked?

Whatever the case, when the message size exceeds 512 bytes, it will trigger the ‘TC’ bit (Truncation) in DNS to be set, informing the client that the message length has exceeded the allowed size. In these situations, the client needs to re-transmit over TCP for which the size limit is 64000 bytes. If DNS servers and network environment cannot support large UDP packets, it will cause retransmission over TCP; if TCP is blocked, the large UDP response will either result in IP fragmentation or be dropped completely. The end symptom to the end client is usually slow DNS resolution, or inability to resolve certain domain names at all.

Size Matters: EDNS

You might be wondering where the size limit of 512 bytes come from. The 512-byte UDP payload size is a dependency on IPv4. The IPv4 standard2 specifies that every host must be able to reassemble packets of 576 bytes or less, take away header and other options, that leaves 512 bytes for payload data. This is the reason why there are precisely 13 DNS root servers3 originally: 13 domain names and 13 IPv4 addresses fit nicely into a single UDP packet.

This size limitation was recognized long ago as a problem. In 1999, Extension Mechanism for DNS (EDNS) was proposed, and it has been updated over the years, increasing the size all the way to 4096 bytes, or 4 kilobytes. So, if you are running a reasonably up to date DNS server, the chances of it switching to TCP should be slim(mer).

However, even though EDNS has been around a long time, its support has not been as universal as it should be4 . Some network equipment, such as firewalls, might still make assumptions about DNS packet size. A firewall may drop or reject a large DNS packet, thinking it is an attack. This behavior may not have caused visible problems in the past (or it did but no one understood why), but as DNS data continues to increase in size, it is important that all network equipment is configured correctly to support large DNS packet sizes. If the network environment does not fully support large DNS messages, it may lead to the DNS message being rejected by network gear, or partially dropped during fragmentation. What this looks like to the end user is that DNS queries are going unanswered, or take a very long time, giving the impression that “DNS/network is really slow.”

While EDNS is necessary for the operation of modern-day DNS, the ability to send larger messages contributed to volumetric attacks such as Amplification and Reflection.

1 RFC 1034, written in 1987, specified the use of TCP for DNS as a requirement.

2 RFC 791, which was published in 1981

3 While there are still only 13 IPv4 addresses for DNS root today, it is actually distributed across many nodes across the world using techniques such as anycast and load balancing.

4 Recognizing this problem, the DNS community held a “DNS Flag Day” event on February 1st, 2019, declaring it the day that EDNS must be fully support going forward.

Is DNS TCP or UDP port 53? (2024)

FAQs

Is DNS TCP or UDP port 53? ›

The answer is DNS is mostly UDP Port 53, but as time progresses, DNS will rely on TCP Port 53 more heavily.

Is DNS using TCP or UDP? ›

DNS uses TCP for Zone transfer and UDP for name, and queries either regular (primary) or reverse. UDP can be used to exchange small information whereas TCP must be used to exchange information larger than 512 bytes.

What is the UDP port number for DNS? ›

A DNS server uses well-known port 53 for all its UDP activities and as its server port for TCP. It uses a random port above 1023 for TCP requests.

What is the DNS port 53 firewall? ›

You will need to create a firewall traffic rule to block any traffic using port 53. Remember that there's both UDP and TCP traffic that can use port 53, and to block either or both as appropriate. Also note that while blocking DNS traffic except to specific resolvers is a good idea, it does not stop DNS tunneling.

What is DNS port 53 vulnerability? ›

Vulnerabilities in DNS Bypass Firewall Rules (UDP 53) is a Low risk vulnerability that is one of the most frequently found on networks around the world. This issue has been around since at least 1990 but has proven either difficult to detect, difficult to resolve or prone to being overlooked entirely.

Is port 53 TCP or UDP? ›

The standard port for DNS is port 53. DNS client applications use the DNS protocol to query and request information from DNS servers, and the server returns the results to the client using the same port. Port 53 is used for both TCP and UDP communication.

Is DHCP a TCP or UDP port? ›

The DHCP employs a connectionless service model, using the User Datagram Protocol (UDP). It is implemented with two UDP port numbers for its operations which are the same as for the bootstrap protocol (BOOTP). The server listens on UDP port number 67, and the client listens on UDP port number 68.

What is DNS tunneling port 53? ›

This enables various types of communication over the DNS protocol, including file transfer, C2 and web browsing. Why perform DNS tunneling? DNS normally uses UDP port 53, which is usually open on clients, systems, servers and firewalls to transmit DNS queries. DNS is a fundamental component of the internet.

Why is DNS called Route 53? ›

The name for our service (Route 53) comes from the fact that DNS servers respond to queries on port 53 and provide answers that route end users to your applications on the Internet.

Should port 53 be open? ›

The only reason why you need to have port 53 (tcp and udp) open so to any IP address on the public Internet is when there is an authoritative name server running that the Internet needs to reach. If you have that going on, then focus your firewall rule to only that server.

Can port 53 be hacked? ›

Security & Compliance

UDP port 53 is used by the DNS protocol to resolve domain names to IP addresses and vice versa. If it is left open and unrestricted, it can be exploited by attackers to redirect users to malicious websites, intercept sensitive information or launch DDoS attacks.

What port is secure for DNS? ›

The client resolver attempts to establish a secure connection on port 853 to the specified DNS server. If a secure connection is established, this provides privacy for the user's queries from passive observers on the path.

What port do most DDoS DNS attacks occur on? ›

It is extremely common for these types of attacks to occur on open DNS servers. When leveraging a botnet to generate spoofed DNS requests, the target will experience a flood of DNS replies, all coming from UDP source port 53.

Is DNS in TCP IP? ›

DNS is an Application-layer protocol. The Application layer is the top-most layer on the TCP/IP Model.

Does HTTP use TCP or UDP? ›

Among the two most common transport protocols on the Internet, TCP is reliable and UDP isn't. HTTP therefore relies on the TCP standard, which is connection-based. Before a client and server can exchange an HTTP request/response pair, they must establish a TCP connection, a process which requires several round-trips.

How does DNS over TLS work? ›

Once the DNS client successfully connects, it proceeds with the TLS handshake and will authenticate with the DNS server, if required. After the TLS negotiation is completed, the connection is encrypted.

What is TCP UDP IP HTTP DNS? ›

IP is unique identifier assigned to each device on a network, It ensures that the data is sent to the correct destination. TCP-UDP provides efficient and secure transmission of sent data. DNS translates domain names into IP addresses. HTTP is responsible for sending data transfer between client and server.

Top Articles
Latest Posts
Article information

Author: Eusebia Nader

Last Updated:

Views: 6126

Rating: 5 / 5 (80 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Eusebia Nader

Birthday: 1994-11-11

Address: Apt. 721 977 Ebert Meadows, Jereville, GA 73618-6603

Phone: +2316203969400

Job: International Farming Consultant

Hobby: Reading, Photography, Shooting, Singing, Magic, Kayaking, Mushroom hunting

Introduction: My name is Eusebia Nader, I am a encouraging, brainy, lively, nice, famous, healthy, clever person who loves writing and wants to share my knowledge and understanding with you.