Modify DNS server address on Ubuntu

My ISPs DNS server responds slowly. So I was trying to modify /etc/resolv.conf on Ubuntu 12.04 with Google’s DNS server IPs (, as usual. To make the change permanent I ran chattr +i on the file but it failed. I found that in Ubuntu 12.04 it is a symbolic link to the following file:

/run/resolvconf/resolv.conf and /run is mounted as tmpfs in RAM.

Simple solution to add the DNS IPs using the GUI:

NetworkManager (in taskbar)  Edit Connections…  Select used connection  Edit…  IPv4 Settings  Method: Automatic (DHCP) addresses only [if your conneciton is DHCP based, otherwise select Manual]  Add the IPs (separated by comma) in DNS servers: field.

Quick tip: If you are using ADSL modem, you can set the Primary and Secondary DNS in the modem. Most modems support it nowadays.