DNS Search Domains in Linux

DNS search domains let a Linux system resolve short hostnames by automatically appending one or more domain names.

Example

If the search domain is example.com, a lookup for server1 may also try server1.example.com.

Check resolver configuration

cat /etc/resolv.conf

You may see lines such as:

search example.com internal.example.com
nameserver 192.168.1.1

Test name resolution

getent hosts server1
host server1

On many modern distributions, /etc/resolv.conf may be managed by NetworkManager, systemd-resolved, DHCP or another network service.

Leave a Comment