In this tutorial we will see how to add DNS server IP addresses manually by editing the /etc/resolv.conf file under Ubuntu (11.10/11.04/10.10). You may use this tutorial to add for example DNS servers of Google Public DNS (18.104.22.168,22.214.171.124) or that of OpenDNS (126.96.36.199,188.8.131.52).
Via the terminal, edit the /etc/resolv.conf file with this command (you can replace gedit with your favorite text editor like vim.tiny, nano, etc.):
sudo gedit /etc/resolv.conf
Add now your DNS server addresses as follows (we will use the Google Public DNS in this example):
Replace the given IP addresses with whatever you want, then save your file and close. Restart now your nework manager with this command:
sudo /etc/init.d/networking restart