Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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

Can anybody explain to me about the dns-search directive in /etc/network/interfaces file:

iface eth0 inet static

Is it mandatory? And how can I configure it?

share|improve this question
I personally disabled this on my server, because I use IPv6, and when an address (f.e. I was trying to connect to didn't support IPv6, the system tried to resolve instead and that yielded an IPv6 of the as the result (not IPv4 address of as expected). I wrote about it in more detail here:… – arrange Mar 9 '13 at 11:28
@arrange, thanks in advance – pylover Mar 9 '13 at 13:27
up vote 15 down vote accepted

dns-search determines which domain is appended for dns lookups.

Normally you will specify here the same domain as returned by hostname -f.

For detailed information see the following quote from man resolv.conf:

   search Search list for host-name lookup.
          The  search  list  is  normally  determined from the local domain name; by default, it contains only the local domain
          name.  This may be changed by listing the desired domain search path following the search keyword with spaces or tabs
          separating  the  names.  Resolver queries having fewer than ndots dots (default is 1) in them will be attempted using
          each component of the search path in turn until a match is found.  For environments with multiple  subdomains  please
          read options ndots:n below to avoid man-in-the-middle attacks and unnecessary traffic for the root-dns-servers.  Note
          that this process may be slow and will generate a lot of network traffic if the servers for the  listed  domains  are
          not local, and that queries will time out if no server is available for one of the domains.

          The search list is currently limited to six domains with a total of 256 characters.
share|improve this answer
Why isn't the dns-search directive mentioned in the man page for the interfaces file? ( – odigity Jan 12 '15 at 19:41
@odigity, I think it is because it is an option passed to resolvconf, and not an internal feature of ifup. – Tiago Sep 28 '15 at 8:55

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.