To speed up internet, ubuntu 12.04 has added a plugin to NetworkManager to start dnsmasq, a local dns server that caches dns entries. The problem is the plugin has hardcoded the --no-hosts string.
So one solution is to comment out the line that load the plugin in the NetworkManager config file and restart NetworkManager :
sudo mv /etc/NetworkManager/NetworkManager.conf /etc/NetworkManager/NetworkManager.conf.bak
sudo bash -c 'cat /etc/NetworkManager/NetworkManager.conf.bak | sed -e "s/^\(dns=dnsmasq\)$/#\1/" > /etc/NetworkManager/NetworkManager.conf'
sudo restart network-manager
Another solution is to wrap dnsmasq to filter out the undesired arguments:
sudo mv /usr/sbin/dnsmasq /usr/sbin/dnsmasq.bin
sudo bash -c 'cat > /usr/sbin/dnsmasq' << EOF
#!/bin/sh
dnsmasq=/usr/sbin/dnsmasq.bin
exec $dnsmasq `echo $@ | sed -e s/--no-hosts//`
EOF
sudo chmod 755 /usr/sbin/dnsmasq
Please mark the bug as affecting you.
Another solution without patching system files
cat /etc/NetworkManager/dnsmasq.d/hosts.conf
addn-hosts=/etc/hosts