DNS Problem and Solution

For some time, I have had a problem. My computer has failed, for some time, to aquire the proper DNS server from the wireless router. However, it only happens on some wireless networks. So, I signed up for OpenDNS, and I use it frequently. However, whenever my computer suspends, I lose my dns settings on these networks. So, I wrote a shell script to add OpenDNS to my DNS settings. The Script:

echo Contents of /etc/resolv.conf:
cat /etc/resolv.conf
echo Replace dns with open dns, press enter. Otherwise, press ^C.
echo nameserver > /etc/resolv.conf
echo nameserver >> /etc/resolv.conf
echo Done. New contents of /etc/resolv.conf
cat /etc/resolv.conf
echo Happy?

The first few lines prints out /etc/resolv.conf, and asks whether the file has open dns or not. If you press enter, it is given to a junk variable, and it continues. ^C to cancel. It then replaces /etc/resolv.conf with te first OpenDNS server, then adds the second. It then prints out the file to make sure, then exits. Rather useful.

    • Jercos
    • June 17th, 2009

    Protip: if you’re running NetworkManager it will outright *NUKE* your resolv.conf every time you connect to a new wireless network. And sometimes it just does it for the hell of it.

    My solution? sudo apt-get remove network-manager. But then, I don’t use wireless either… A curious conundrum… ‘could always take a shot at having networkmanager install a host route to your server instead of a default route and then doing everything inside a VPN, in which case networkmanager will happily use a static DNS server…

    Also, OpenDNS seriously just pisses me off with its domain not found pages. Can’t they just let it go to NXDOMAIN like a standard provider? I always just wind up either using AT&T’s servers, almost never, or (Verizon via Bell via GTEI and *very* reliable, and is really easy to remember of course.)

    Man. Now what with Bonjour being a standard thing, I’m waiting for mDNS -> unicast DNS proxies at hotspots and in home gateway products, But I guess if DHCP works for most people, it’s not going to change. plus, I hear people don’t like their surfing habits being broadcast to their neighbors… But whatever.

    • Yeah, the not found page also messes with utilities that aren’t prepared to deal with pages instead of going along official DNS channels. It’s also the fact that PXE relies on DHCP to find the PXE server.

    • Jercos
    • August 20th, 2009

    read FOO, not read $FOO :P

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: