if domain==example.com; then nameserver=1.2.3.4
else nameserver=4.3.2.1
since I need that when I'm on my VPN to example.com.
So, round one of the hack is to tell dhclient to use my local nameserver, and do it with named.
So, in /etc/dhclient.conf, I have:
interface "wlan0" {
prepend domain-name-servers 127.0.0.1;
}
and I have the following snippets in named.conf:
...
options {
...
forwarders {
4.3.2.1;
};
...
};
zone "example.com" IN {
type forward;
forwarders {
1.2.3.4;
};
};
The only problem I have yet to figure out is how to dynamically update the 4.3.2.1 in /etc/namedb/named.conf as I roam from network to network. There doesn't appear to be a hook in dhclient to say 'run this command when my IP address changes' or 'run this command when I get a new lease' or anything useful like that....
All this is with FreeBSD-current, but these techniques should work back to at least FreeBSD 6.x.
Finally, does anybody know a good way to quote code (as opposed to text) in blogger.com? By default, it seems, all leading whitespace is eaten, which make this post look ugly.