Now Reading
What number of IP addresses can a DNS question return?

What number of IP addresses can a DNS question return?

2024-02-04 11:22:31

02-13-2015 3:15PM (ET)


Whereas making a DNS zone file I start to marvel how huge I may make it earlier than DNS would break. May I map 5 hundred, ten thousand, a million IP addresses to a site identify? Is there a single quantity or would this quantity change relying on implementation particulars? It seems there’s, in truth, a single quantity, which throughout all requirements praise implementations is the utmost however that this quantity is dependent upon the size of your area identify.

wireshark capture

To make a DNS question a consumer will ship a UDP packet asking the DNS server for the IP addresses of a specific area identify.
If the response is 512 bytes or smaller, the server will simply put the IP addresses in a UDP packet and ship it again to the consumer.

In any other case, if the DNS response incorporates so many IP addresses that it can’t slot in a single 512 byte UDP packet the server will ship the consumer a UDP packet with the truncated flag set to inform the consumer that the response is just too huge and to retry over TCP.
The consumer on receiving finish of a UDP packet with a truncated flag can open a TCP reference to the DNS server and proceed the DNS question.

4095 is the utmost doable variety of IP addresses returned by a DNS question.
Lets have a look at why.
A big DNS response should match right into a single TCP packet.
TCP packets solely reserve 2 bytes for the packet measurement. Thus, TCP packets cannot maintain greater than $2^16=65536$ bytes.
For the reason that domainname is included within the DNS response, the shorter the domainname the extra room for IP addresses. Utilizing the shortest legitimate area identify doable a.io (4 characters), there’s a 13 byte overhead. Every IP handle returned makes use of 16 bytes (as IPv4 is simply 4 bytes this consists of further data), giving us the equation:

$$mbox{measurement of response}=13+(16 occasions mbox{# IP addresses}) mbox{ bytes}$$

Fixing this for 65439 bytes offers us 4095 ip addresses.

See Also

EDIT: Colmmacc on twitter despatched me a correction, initially I had mentioned 4094 IP addresses, however it’s really 4095 IP handle. I’ve fastened this within the put up. Taking a look at ealier variations of my notes (and tweets) I see that I had 4095 as effectively however will need to have accidently modified it in some unspecified time in the future. Colmmacc additionally factors out some very fascinating strategies to shorten the area identify to suit extra IP addresseses however I have never tried them but see beneath:




Source Link

What's Your Reaction?
Excited
0
Happy
0
In Love
0
Not Sure
0
Silly
0
View Comments (0)

Leave a Reply

Your email address will not be published.

2022 Blinking Robots.
WordPress by Doejo

Scroll To Top