After upgrading to Ubuntu 12.04, I started seeing pretty funny DNS behavior. For example, I could connect to
a wireless network successfully, but still could not connect to external IP addresses because of DNS resolution
problems.
After a lot of fiddling, I realized that the problem is probably related to
resolvconf and its main configuration
file,
/etc/resolv.conf
. On my system, this file sometimes disappears, and sometimes it loses its previous entries.
So far, I have learned that Ubuntu 12.04 indeed introduced a new approach of handling DNS resolution and in particular
the
resolv.conf
file. If my understanding is correct, whenever the system finds a DHCP server, it is supposed to
re-create the
/etc/resolv.conf
file using DNS information it receives via DHCP.
The discussion at
http://askubuntu.com/questions/130452/how-do-i-add-a-dns-server-via-resolv-conf hints at similar
problems. But I guess I do not know enough about Ubuntu's networking internals to really understand what is going on,
unfortunately
The following voodoo script sometimes helps me to resurrect
/etc/resolv.conf
with sufficient DNS information
in it. But it drives me mad that I don't have the slightest clue what I am doing there. If you read this and feel
an urge to slap your forehead, feel free to consider me a raving idiot, but do drop me a line to help me educate myself
on this issue. Thanks.
#! /bin/bash
pushd /etc
if [[ -r resolv.conf ]]; then
if [[ ! -L resolv.conf ]]; then
mv resolv.conf /run/resolvconf
ln -s /run/resolvconf/resolv.conf
fi
fi
popd
resolvconf --enable-updates
to top