Linux changing DNS search order

Under Linux you need to use /etc/nsswitch.conf file which is used by system databases and Name Service Switch configuration file

edit /etc/nsswitch.conf

Open /etc/nsswitch.conf file using text editor:

vi /etc/nsswitch.conf

Look for hosts:

hosts:          files dns wins mdns4_minimal [NOTFOUND=return]

Set above order as per your requirement. Close and save the file.