Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my DNS server's named.conf I see

    rate-limit {
            responses-per-second 5;
            window 5;

What does this actually mean? And can it cause DNS clients problems? Is this too tight a configuration?

share|improve this question
As for "what does it actually mean" I would recommend the relevant section in the manual‌​, also see the same section for the upcoming 9.10 version – Håkan Lindqvist Mar 30 '14 at 9:20
up vote 6 down vote accepted

It limits the number of identical responses a single DNS client can get in a second. The window 5 option allows a burst of 5*5 responses.

"Identical responses" and "single DNS client" are a bit non-obvious terms here, read this for more info: .

Generally it's a good thing to rate-limit - may help you in case of a DOS attack some day. The defaults should be OK for most cases.

share|improve this answer
The part about "burst" in the first paragraph is wrong. window is only used for controlling the timespan within which "identical responses" sent to each "single DNS client" are tracked. The BIND 9 Administrator Reference Manual states: The [client's RRL] account cannot become more positive than the per-second limit or more negative than window times the per-second limit. This message by Vernon Schryver explains the algorithm's behavior in more detail. – Kempniu May 20 '15 at 9:14

You should read the administrator reference manual for BIND 9.9.

Basically, responses-per-second is the number of identical replies that can be sent to one single destination, per second. The definitions are tricky.

A single destination is a block of network addresses, of the size configured in ipv4-prefix-length or ipv6-prefix-length as applicable. So, if the ipv4-prefix-length is 24, and both and are querying the DNS server, they will share this quota and can only send so many queries between the two of them.

Identical replies are replies to queries for a particular RRtype for a particular existent name, or for a nonexistent name. The following queries are all distinct:


However, all of the following queries are identical (assuming etc. live up to their names):


window complicates things a little more still. It is the number of seconds for which quota can be banked. Multiplying window and responses-per-second gives the maximum by which any quota can be positive, or in more basic terms, the burst capacity.

To give a catch-all example:

You are the nonrecursing, authoritative nameserver for Imagine no DNS traffic was seen at all in the past 10 seconds, and the configuration in the question applies globally. The following events happen sequentially:

  1. Host sends 100 queries for IN NS 25 will be allowed, and the remaining 75 will be ignored.
  2. Host sends 100 queries for IN A 25 will be allowed, and the remaining 75 will be ignored.
  3. Host sends 1 query for IN MX It will be ignored since the limit for nonexistent domains has been reached.
  4. Host sends 1 query for IN A It is allowed.
  5. Hosts through each send a single query for IN NS 25 of them get replies and the remaining 25 are ignored; the quota for does not apply to these hosts, but they share the quota for
  6. One second passes
  7. Hosts through repeat their query IN NS 5 of them get replies and the remaining 20 are ignored, since the quota is only replenished by 5 queries per second.
share|improve this answer
iptables -A INPUT -p udp --dport 53 -m recent --set --name dnslimit
iptables -A INPUT -p udp --dport 53 -m recent --update --seconds 60 --hitcount 11 --name dnslimit -j DROP 

IPtables can work just as well. Keeps the traffic out of the service completely if an attack is found.

share|improve this answer
awesome! I didn't even think of iptables. But what does that mean in English. I can guess ... if some IP sends 11 or more dns queries block them for 60 seconds, right? – Red Cricket Mar 22 '13 at 6:44
No, the translation is : Accept no more than 11 packets within a timeframe of 60 seconds, drop all other packets. – drcelus Mar 22 '13 at 7:38
I had a problem, after try to apply your nice solution I had an error like: "iptables: Applying firewall rules: iptables-restore v1.4.7: -c packet counter not numeric Error occurred at line: 17" Line 17 is the first one of yours. I should load some specific module? – user172544 May 6 '13 at 6:46
first line should be as follow: iptables -A INPUT -p udp -m udp --dport 53 -m recent --set --name dnslimit --rsource – user173406 May 12 '13 at 5:43
I wouldn't go as far as saying say that it "works just as well". This rate limits without any idea if it's actually the same query being spammed or different queries, the latter would much more likely be legitimate traffic. – Håkan Lindqvist Mar 30 '14 at 9:26

I don't think its a good idea to rate limit, ask yourself : do you rate limit the webserver responses too? Why do you think DNS responses are less important than webserver responses?
And even if you rate limit, that 5 req/sec sounds very low.

share|improve this answer
Ratelimiting webserver responses might nog be such a bad idea in certain cases. But DNS is mostly UDP, which is easily spoofed (unlike http), so rate limiting is necessary prevent you nameservers from being used in amplification or reflection attacks. – arjarj May 12 '13 at 13:31
If he is not an open resolver then i don't think its a good target for reflection/amplification attacks, but you have right. 5 req/sec i still think is too low. – Sandor Marton May 12 '13 at 13:49
He doesn't specify if it's a recursive or an authoritative server. For an authoritative server rate limiting still is important. Also, it's not just 5 requests per second, it's 5 of the same answers per second, and even corrected if you generate different answers. Generally the 5 requests-per-second setting is fine on bind (because a legitimate server also asks other questions in between). – arjarj May 12 '13 at 14:17
Ok, i checked the docs and as i see rate-limit is a per client setting and not per server. I was under the impression that bind would be limited to a total if 5req/s. Per client 5req/sec is ok. – Sandor Marton May 12 '13 at 14:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.