What is the maximum limit of domains in a DNS search list?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux (RHEL)
  • glibc

Issue

  • Need more than 6 domains in the resolv.conf search list.
  • Only the first 6 domains in the search path are looked up by the resolver.
  • The release notes for RHEL7.5 indicate the 6 search domain limit has bee removed. However, that does not appear to be the case, at least for RHEL8.1.

Resolution

glibc has its own name resolver which is widely used. Prior to glibc-2.17-222 there is limitation of up to 6 search domains to be appended to the queried name when attempting to resolve it. Past that version this limit has been removed and you may add any amount of search domains to /etc/resolv.conf.

It's important to note that programs that don't make use of the glibc's resolver may have their own limitations. That's the case of dig, for example, which has its own name resolution implementation and doesn't use glibc's resolver. dig has its own limit of 8 search domains.

Root Cause

On older versions of glibc the search list is limited to six domains with a total of 256 characters.

The limit is specified by glibc source at resolv/resolv.h as below:

 # define MAXDNSRCH              6 /* max # domains in search path */

This cannot be modified for RHEL 6.x and below, but this limit has been removed in RHEL 7 and higher for glibc package versions at or exceeding glibc-2.17-222.

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

5 Comments

is there any workaround to this issue?

Yes, we need a work around.

My windows workstation supports more than the RHEL server.

In a global enterprise environment this is imperative.

I understand your problem Jeffery. I woudld advise investigating a work around with Red Hat Support at https://access.redhat.com/support/cases/new/ . I will also make sure the appropriate team reads your comment just in case. Thank you.

We have the same problem, and we also need to increase the 256 max characters limit in resolv.conf.

So, other than some specific programs that don't use the glibc resolver, the general 6 domain 256 character limit has been removed? If so it looks like man page still needs to be updated. Even on RHEL 8.2 RESOLV.CONF(5) still says "The search list is currently limited to six domains with a total of 256 characters."

Seem to keep seeing instances recently where man pages just don't seem to be getting updated and are not authoritative any longer. It causes a lot of unnecessary confusion.