LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   understanding "domain" option in /etc/resolv.conf (https://www.linuxquestions.org/questions/linux-networking-3/understanding-domain-option-in-etc-resolv-conf-4175428173/)

m4rtin 09-20-2012 04:18 AM

understanding "domain" option in /etc/resolv.conf
 
In /etc/resolv.conf file one can specify domain option which should refer to local domain name. According to resolv.conf manual "Most queries for names within this domain can use short names relative to the local domain.". In case of such /etc/resolv.conf file:

Code:

domain linuxquestions.org
nameserver 8.8.8.8

..the "ping www" command resolves to www.linuxquestions.org. However, if I add the search option, "ping www" command resolves to www.linux.org:

Code:

domain linuxquestions.org
nameserver 8.8.8.8
search linux.org

Is the domain ignored if the search option is specified? Are there any other reasons for domain option in /etc/resolv.conf file other than resolving hostnames to FQDN?

cpasqualini 09-20-2012 06:20 AM

very good question m4rtin!!
i've never ask that to myself.

i use
Code:

domain example.tld
search example.tld
nameserver 8.8.8.8
nameserver 8.8.4.4

but never take the time to look at the difference of domain vs search...

i'll look at this thread too!

thanks!

jefro 09-20-2012 02:52 PM

http://theos.in/desktop-linux/resolv...linux-example/

cpasqualini 09-20-2012 03:16 PM

jefro:

you haven't answered our question:
the link you point talks about the classic resolv.conf:
Code:

search example.com
nameserver 8.8.8.8
nameserver 8.8.4.4

if the idea of search is add example.com behind www

what is the point of having a line with domain, as can be found on the default resolv.conf of many recent distros?

Code:

domain example.com
search example.com
nameserver 8.8.8.8
nameserver 8.8.4.4


jefro 09-20-2012 08:09 PM

I believe the article addresses this case.


"search cyberciti.biz
nameserver 202.54.1.10
nameserver 202.54.1.11"

Where

"search domain.com: The search list is normally determined from the local domain name; by default, it contains only the local domain name. So when you type nslookup www, it will be matched to www.cyberciti.biz"

m4rtin 09-25-2012 09:43 AM

Quote:

Originally Posted by jefro (Post 4785491)
I believe the article addresses this case.


"search cyberciti.biz
nameserver 202.54.1.10
nameserver 202.54.1.11"

Where

"search domain.com: The search list is normally determined from the local domain name; by default, it contains only the local domain name. So when you type nslookup www, it will be matched to www.cyberciti.biz"

Is the domain option ignored if the search option is specified? If yes, then what is the reason to use domain configuration option in /etc/resolv.conf file in case search is specified as well?

acid_kewpie 09-25-2012 10:27 AM

Hmm, I think that quote DOES explain it. It certainly looks like the domain option is ignored for searches in an alternative search value is specified. I *presume* this is a legacy issue, and the search management logic was added in later on without breaking compatibility.

So just DON'T specify a search value and the domain option is totally valid.

Personally I would have thought the searches would be searched after the domain value is searched, but if it's coded differently then so be it I guess.


All times are GMT -5. The time now is 06:45 AM.