Saturday, 30 April 2016

High cpu usage on named

I noticed that a Raspberry Pi that I use as my local nameserver was hitting 99% cpu usage, and that's not right.

But first, what's this about a "local nameserver"?

From the outside, you access my servers using an IP address in the usual way - for example, this blog is at But there's a limited number of such addresses, so I don't want to use my allocation except where I have to. Otherwise, I can use an IP address that starts with 10, such as There's 16.7 million addresses that I, or anyone else, can use. But the reason that anyone can use them, is that they're only valid within my network - if someone from outside wants to access a server with an IP address that starts with 10 ... they can't. Tough.

So my firewall does "Network address translation" (NAT), and so when you access an IP address like, my firewall translates that to an address like, and everything works fine.

So the upshot is, I have a couple of dozen servers that can be accessed from the outside world, and a couple of hundred that can't because they're on 10.something IP addresses and I haven't set up NAT for them.

So I need a DNS server to translate names like "bunny" to IP addresses like, and that's what I call my local nameserver.

It runs on a Raspberry Pi, because they're very cheap to run - cheap to buy, and low electricity consumption. And it was working fine, but I didn't like the cpu usage. So I did a bit of googling, and found the answer.

The configuration files are in /etc/bind, and in named.conf.options you'll find

managed-keys-directory "/var/named/dynamic";

And the problem is, that directory doesn't exist, and wasn't created when I installed bind.
The fix was to change that to

managed-keys-directory "/etc/bind/dynamic";

and to create the directory /etc/bind/dynamic, and to give it mode 777.

No comments:

Post a Comment