What does "search localdomain" do in 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
.
Related videos on Youtube
mYnDstrEAm
I care about making FOSS, cybersecurity and useful/important knowledge accessible. I learn, collaborate and develop with open source.
Updated on September 18, 2022Comments
-
mYnDstrEAm over 1 year
When connecting to the Internet by default I get two lines in my /etc/resolv.conf file:
- search localdomain
- nameserver {ipofmyrouter}
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 almost 7 yearsThe questioner also wanted to know why it was appearing and disappearing in that file.
-
xhienne almost 7 years@JdeBP Yes, in question 386790