Bind9 stops to operate: socket: file descriptor exceeds limit

With a lot of DNS clients, it may happen that the DNS server runs out of free sockets.
The DNS server needs free sockets to allow clients to connect to it and to connect to upstream DNS servers.
In such a case the following lines would be found in the output of service bind9 status and in the logfile /var/log/syslog:

Mär 06 11:42:02 myhost named[1270]: accept: file descriptor exceeds limit (5739/4096)
Mär 06 11:42:03 myhost named[1270]: socket: file descriptor exceeds limit (5739/4096)
Mär 06 11:42:03 myhost named[1270]: socket: file descriptor exceeds limit (5739/4096)
...

Since UCS 4.4-1 errata 249 it is possible to set the maximum number of sockets the DNS server (named) is allowed to open. This should only be done, in the above mentioned case!
To raise the maximum number of sockets, set the UCR variable dns/max-socks to a number higher than 4096 (the builtin default) and restart the DNS server:

$ ucr set dns/max-socks=10000
$ service bind9 restart

When restarted, the DNS server will write its new configuration to /var/log/syslog, including a line using up to _____ sockets.

Mastodon