Category: DNS

DNS over TCP

We recently ran into a problem where a DNS query was failing because the response was too large. The maximum size of a DNS response that can be sent over UDP (User Datagram Protocol) is 512 bytes. This is because the original DNS protocol was designed to fit within a single UDP datagram of this size. However, modern DNS implementations often support an extension called EDNS0 (Extension Mechanisms for DNS 0) that allows for larger DNS messages. The problem that we ran into was that our platform didn’t support DNS over TCP!

If a DNS response exceeds the 512-byte limit, the DNS server will set the “truncated” (TC) bit in the response message header and indicate that the client should retry the request using TCP (Transmission Control Protocol). TCP is a reliable, connection-oriented protocol that can handle larger data payloads than UDP.

In practice, most DNS queries and responses fit within the 512-byte limit, and TCP is rarely used for DNS traffic. However, certain DNS applications, such as DNSSEC (DNS Security Extensions) and large DNS zone transfers, may require the use of TCP due to the size of the response data.

Types of DNS records

There are several types of DNS (Domain Name System) records, each serving a different purpose. Here are some of the most common types:

  1. A (Address) Record: This record maps a domain name to an IPv4 address.
  2. AAAA (IPv6 Address) Record: This record maps a domain name to an IPv6 address.
  3. CNAME (Canonical Name) Record: This record creates an alias for an existing domain name, allowing it to be accessed under a different name.
  4. MX (Mail Exchange) Record: This record specifies the mail server responsible for accepting email messages for a particular domain.
  5. TXT (Text) Record: This record allows for the addition of arbitrary text to a domain name. It is often used for domain verification, spam prevention, and other administrative purposes.
  6. NS (Name Server) Record: This record identifies the authoritative name servers for a particular domain.
  7. SRV (Service) Record: This record specifies the location of a service, such as a SIP or XMPP server, on a domain.
  8. SOA (Start of Authority) Record: This record provides information about the domain name, such as the primary name server, the email address of the domain administrator, and the domain’s serial number.

These records are essential for the functioning of the DNS system and are used by various internet services to provide functionality such as email delivery, web browsing, and other network communication protocols.

© 2024