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:
#!/bin/bash
echo Contents of /etc/resolv.conf:
cat /etc/resolv.conf
echo Replace dns with open dns, press enter. Otherwise, press ^C.
read $LFJLKJLKJSF
echo nameserver 208.67.222.222 > /etc/resolv.conf
echo nameserver 208.67.220.220 >> /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.
Filed under: Uncategorized
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 4.2.2.1/2/3/4/5/6 (Verizon via Bell via GTEI and *very* reliable, and 4.2.2.2 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.
read FOO, not read $FOO :P
Thanks.