23 August 2014

Changing DNS nameservers in aptosid + wpa_gui

This is a corner-case quickie.

I use the Debian-sid derivative aptosid as my main OS along with the blessed-by-aptosid wpa_gui for wlan management. There are reasons I prefer wpa_gui to the aptosid default Ceni--but this is the subject for another post, perhaps.

Unlike other GUI wlan management tools such as wicd or Network Manager, wpa_gui doesn't provide an obvious way to change your DNS nameserver(s). I ran into this problem recently when I was in filter-happy Turkey and the modem+router I bought there had firmware in which the DNS nameserver setting was disabled.

I solved the problem for my machine by editing /etc/dhcp/dhclient.conf. I decommented the line:
#prepend domain-name-servers 127.0.0.1;
and then changed 127.0.0.1 to a comma-separated list of the desired DNS servers, e.g.:
prepend domain-name-servers 208.67.222.222, 208.67.220.220;
(for OpenDNS).

Reboot, and a
$ dig google.com
showed that it worked.

I can't say it'll work on every machine, but it worked for me.