Tuesday, October 7, 2014

How to add default network search domain on Ubuntu 12.04

Why?
you can use ping p1.google.com
if you added google.com to the default search domain, you only need to do ping p1.
This is especially needed for Erlang.

Forwarded from:
http://askubuntu.com/questions/135629/how-to-add-some-additional-dns-search-domains-without-ignoring-the-ones-returned

You will need to edit this file with your favorite editor:
sudo vim /etc/dhcp/dhclient.conf
Once in file, you should see a commented line with the word supersede next to it:
#supersede domain-name "...."
Uncomment that line, substitute the name supersede for append, then add the domain names you wish to search (follow the example below and leave a space after the first "):
append domain-name " ubuntu.com ubuntu.net test.ubunut.com";
Save the file and close.
All you need to do is restart your network connection. You can do this by unplugging and plugging in the physical network connect OR disable and enable your network connect (see picture below). After that you should be good to go:
To verify:
sudo cat /etc/resolv.conf
Disconnect Network
enter image description here
Connect Network
enter image description here