Using resolvconf to resolve dns queries

I’m used to editing /etc/resolv.conf to add nameserver information. So when I recently faced an issue resolving dns queries,

# ping bitbucket.org
ping: unknown host bitbucket.org

I tried editing /etc/resolv.conf, but found the following in it:
# cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN

Apparently the solution is to edit the file /etc/resolvconf/resolv.conf.d/head (Ignore the lines which say the file should not be edited) and add lines like these (Google Public DNS):

# cat /etc/resolvconf/resolv.conf.d/head
nameserver 8.8.8.8
nameserver 8.8.4.4

Now regenerate resolv.conf with the following command:

# resolvconf -u

Now check:

ping bitbucket.org
PING bitbucket.org (131.103.20.168) 56(84) bytes of data.
64 bytes from 131.103.20.168: icmp_req=1 ttl=54 time=45.9 ms

You are reading this post on Joel G Mathew’s tech blog. Joel's personal blog is the Eyrie, hosted here.