OSX envy and how to get per domain DNS servers

I work with a few people who are staunch Mac OS X lovers. I admit it’s neat, but for me, there isn’t anything there I need, that isn’t already satisfied by my Ubuntu box. Then I found out about a feature in Mac OS X, that allowed for the definition of per-domain DNS servers. So for most of the DNS the general default/public/dhcp provided DNS server was great, but for servers and such on the other side of the company VPN I had to kludge around it. Then I figured out how to do the same thing on my laptop.

The setup is really rather simple:

  1. install dnsmasq (sudo apt-get install dnsmasq)
  2. configure dnsmasq (vi /etc/dnsmasq.conf and add lines like server=/corporate-domain.com/, one for each domain
  3. edit your dhcp configs to make the localhost your default nameserver (vi /etc/dhcp3/dhclient.conf and find the line that says prepend domain-name-servers;. uncomment it and make sure it points to
  4. start dnsmasq (/etc/init.d/dnsmasq start)
  5. and reconnect to your network

And that’s it. I’ve been running that way for a couple of days now and it’s working rather well.


Leave a Reply

Your email address will not be published. Required fields are marked *