-1

we want to know what is the right configuration in resolve.conf and about domain name in resolve.conf

in our rhel 7 server we configured the following example of resolve.conf

more /etc/resolv.conf
; generated by /usr/sbin/dhclient-script
search sandyam.com
nameserver 12.21.16.17
domain sandyam.com

but we can also set the following resolve.conf , without domain sandyam.com , and resolving will works fine

more /etc/resolv.conf
; generated by /usr/sbin/dhclient-script
search sandyam.com
nameserver 12.21.16.17

or to set as the following without search sandyam.com , and resolving will works fine

more /etc/resolv.conf
; generated by /usr/sbin/dhclient-script
nameserver 12.21.16.17
domain sandyam.com

so we are little not sure what is the right resolve.conf settings ( option 1 or option 2 or option 3 )

option 1

more /etc/resolv.conf
; generated by /usr/sbin/dhclient-script
search sandyam.com
nameserver 12.21.16.17
domain sandyam.com

option 2

more /etc/resolv.conf
; generated by /usr/sbin/dhclient-script
search sandyam.com
nameserver 12.21.16.17

option 3

more /etc/resolv.conf
; generated by /usr/sbin/dhclient-script
nameserver 12.21.16.17
domain sandyam.com
sheffadmin
  • 49
  • 1
  • 3
  • 11

1 Answers1

0

There's really no "right" answer here as it depends on what you're trying to do. If for example, you have the "www" entry:

domain: allows to establish a default domain that will be added to the end of the short name. An example would be:

domain sandyam.com

first it will search for the name www.sandyam.com, and if it does not exist, then it will try to resolve the name www.

search: allows to define a list of domains that will be used to complete the short names, before searching for them. The domains in the list must be separated by spaces or tabs, and cannot exceed 6 domains, with a total of 256 characters. An example would be:

search sandyam.com sandyam.net

so when you try to do:

ping www

The first thing it will do is search for www.sandyam.com, if it is not found, it will try www.sandyam.net and finally it will try to resolve the name www.

The search and domain parameters are mutually exclusive and cannot appear more than once. If you do not use either parameter, the system will try to assign the short names the domain of the local machine, which it will find out using the getdomainname system call.

Tomas
  • 106
  • 3