Tuesday, July 23, 2013

correcting NetworkManager

Ubuntu uses the NetworkManager (NM) daemon to regulate a computer's network connections, most importantly the wireless.  Sometimes it gets confused, and sometimes upstream routers lie to it.

Every now and then someone lies to NM, telling it about Domain Name Server (DNS) machines that don't work.  The symptom is that even though your local LAN works, and you can ping external IPs, web pages generally don't work.  They stall and give you the Unhappy Chrome message.

To test DNS:

dig yahoo.com

If it comes back nearly immediately with verbiage in the "ANSWER SECTION", then your nameserver is fine and working properly.  If it takes a few seconds, then something is confused.

One fix is to overwrite NetworkManager's settings when it does anything.  This is kind of impolite, but what the hell.

As root, copy this script to /etc/NetworkManager/dispatcher.d/50fix-dns and mark it executable with "chmod +x ".

# Fix DNS set by misguided routers
# JM 7/2013
cat << EOF > /etc/resolv.conf
# see $0

No comments:

Post a Comment