Until recently I had no idea about
search configuration option of
/etc/resolv.conf and because I find it interesting, I decided to write about it on my blog.
I'm connected to a company network with domain
exampldom.com. Our servers has cool host names like
apolo01,
apolo-p02 etc. Full domain names of those servers are
apolo01.exampldom.com etc.
My colleagues with Windows OS were able to accces those servers just with their hostname, but I, from my Fedora24 laptop, I always had to specify a "long host name" to be able to access them for example via ssh.
I was wondering how this automatic adding of a domain to a hostname works and after a while I found it out.
At first I thought I will solve it via creating an aliases for those "short names". Because instead of using proper naming and realizing that I have
host name and
domain name in front of my eyes, I called it
short name and
long name with domain or mayble little bit differenty but still not correctly ;) Therefore I was googling things like "
linux alias for a domain" or similar. But with this I was only getting results about what can and can't be done via
/etc/hosts file. After a while I asked a colleague who takes care of linux servers and he pointed me to the right direction.
The secret (it's not a secret ;) lies in configuraton of
resolver - file
/etc/resolv.conf.
When I opened that file on my PC I saw:
» cat /etc/resolv.conf
# Generated by NetworkManager
search rz.exampldom.com
nameserver 100.100.128.12
nameserver 100.100.128.9
After reading man pages for "
resolv.conf" it was quite clear.