Name resolution in linux

We can resolve a hostname from IP address if we have searchlist in /etc/resolv.conf to define DNS suffix.

domain example.com
options timeout:1 attempts:4
nameserver xxx.yyy.zzz.aaa
search example2.com example3.com

By default dig don't use searchlist. If you want to use it, use +search option.

       +[no]search
           Use [do not use] the search list defined by the searchlist or domain directive in resolv.conf (if any). The
           search list is not used by default.

From man dig

DHCP client or NetworkManager may update /etc/resolv.conf. We should be careful with these settings when we don't want /etc/resolv.conf get updated.