I actually figured it out, and managed to do a whole bit more:
To overwrite DNS servers, all you have to do is create a config file. This is what to put in "/etc/dhcp/dhclient-wlan0.conf":
Code:
#supersede domain-name-servers 208.67.222.222, 208.67.220.220;
prepend domain-name-servers 208.67.222.222, 208.67.220.220;
Those IP addresses are the OpenDNS servers. You'll have to create this file for every network interface (eth0, wlan0, etc.) that you want to override. Supersede would actually override the DNS servers provided by the DHCP server, prepend prioritizes these DNS servers before the ones provided by the DHCP server. There's an append option too, see the dhclient.conf man page for more info.
What I did next is to use DNSMASQ (which turned out to be installed on my computer already) to do DNS caching, which improves my browsing speed significantly. Here's the settings:
/etc/dhcp/dhclient-wlan0.conf:
Code:
#supersede domain-name-servers 127.0.0.1, 208.67.222.222, 208.67.220.220;
prepend domain-name-servers 127.0.0.1, 208.67.222.222, 208.67.220.220;
/etc/dnsmasq.conf:
Code:
domain-needed
bogus-priv
no-resolv
no-poll
server=208.67.222.222 # Forward to OpenDNS's servers
server=208.67.220.220
listen-address=127.0.0.1
bind-interfaces
cache-size=1000
no-negcache
So all DNS requests are routed through the dnsmasq caching nameserver (whith direct querying of the OpenDNS servers in case dnsmasq ceashes). Dnsmasq queries the OpenDNS servers and caches for better performance.
Hope this helps others that want to try to do the same thing.