What does "search localdomain" do in resolv.conf?

12,237

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. (...)

localdomain here is your domain. When you make a DNS query with no dot (actually with fewer dots than the configuration value ndots), this domain is automatically added to your query. I.E. if you look up for foo, the actual DNS lookup will be for foo.localdomain.

Share:
12,237

Related videos on Youtube

mYnDstrEAm
Author by

mYnDstrEAm

I care about making FOSS, cybersecurity and useful/important knowledge accessible. I learn, collaborate and develop with open source.

Updated on September 18, 2022

Comments

  • mYnDstrEAm
    mYnDstrEAm over 1 year

    When connecting to the Internet by default I get two lines in my /etc/resolv.conf file:

    I'd like to know what exactly "search localdomain" means there.
    I see that it's probably related to DNS but I'm not sure how and couldn't find sufficient information on that. I also don't understand why it's getting removed when I disconnect from the Internet - shouldn't it stay there?
    I'm using Debian 9.1 with KDE.

  • JdeBP
    JdeBP almost 7 years
    The questioner also wanted to know why it was appearing and disappearing in that file.
  • xhienne
    xhienne almost 7 years
    @JdeBP Yes, in question 386790