RHEL 6, NetworkManager and resolv.conf

Latest response

Having spent some time with NetworkManager on RHEL 6 lately, I have noticed an oddity in its created /etc/resolv.conf

# Generated by NetworkManager
domain pridomain.com
search pridomain.com secdomain.com
nameserver 8.8.8.8
nameserver 8.8.4.4

It creates the /etc/resolv.conf with both 'domain' and 'search' options set, which is contrary to what the man page suggests is valid / correct.

From the man page for resolv.conf:
"The domain and search keywords are mutually exclusive. If more than one instance of these keywords is present, the last instance wins."

So in this case the 'search' option is overwriting the 'domain' option and the 'domain' option is superfluous.

Is this a bug.. or just not perfect? Is there a valid reason for why it is configured this way?

Responses

I am not sure of the answer to why NM does this, but we almost always suggest to disable NM on RHEL6, it's just not feature-complete enough to be useful for most situations.

As you've pointed out "the last instance wins", so theoretically this should function as desired.

Sorry that's not much of an answer.

Seems to me the OP is reading "If more than one instance of these keywords is present, the last instance wins." as "If BOTH of these keywords is present, the last instance wins."

The way I read it - "If more than one instance of these keywords is present, the last instance wins." makes perfect sense. In other words, if the file contains:

domain pridomain.com

domain secdomain.com

search pridomain.com secdomain.com

search secdomain.com pridomain.com

then (the last instance) 'domain secdomain' wins, and the search order would be (the last instance) "secdomain.com pridomain.com"! That's the way I understand it.

We could file a bug against the man page to suggest: s/If more than one instance of these keywords is present, the last instance wins./If more than one instance of a keyword is present, the last instance of that keyword wins./

What do you think?

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.