Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Sorry if this has been asked before, but I can't seem to find any information specific to my case.

I run a server where users can connect with a Nintendo DS game if they change their DS' primary DNS server to my box. I'm currently using a simple python script that basically forwards all requests to their actual addresses except one:, which it forwards to my IP. The problem is that this script tends to stop working after a day or two, requiring me to restart it.

Would I be able to override that single host in BIND9 while forwarding all other addresses to their proper IP? Or is there another server that would be better?

share|improve this question
up vote 5 down vote accepted

I would use dnsmasq and set the specific override in the config with the



share|improve this answer
You are a life-saver! It worked!! All I had to do was install dnsmasq and edit the /etc/dnsmasq.conf file to include the directive. Thank you so much! – ceolwulf Jan 18 '11 at 19:50

For the record: you can also do this with BIND, but it's a litte more involved. You need to configure bind as the authoritative nameserver for the specific resource record you want to override. For example, if you wanted to redirect to your own host, you would need this in your named.conf:

zone "" {
        type master;
        file "";

And inside, a zone definition like this:

$TTL 3600

@       IN SOA localhost. lars.localhost. (
        2010011800 ; sn = serial number
        172800     ; ref = refresh = 2d
        900        ; ret = update retry = 15m
        1209600    ; ex = expiry = 2w
        3600       ; min = minimum = 1h

        ; we need one nameserver
        IN NS ns0

        ; and we're overriding the public ip address with
        ; this address.
        IN A

ns0     IN A

That is, your zone file must provide, minimally, an SOA record, at least one NS record, and there must exist valid A records for the listed nameservers...and you'll probably want a single A record to provide your selected address.

With all this in place:

$ host localhost
Using domain server:
Name: localhost
Aliases: has address

It's certainly not as convenient as using dnsmasq, but it's worth knowing.

share|improve this answer
A couple of months late, but I'd like to say thank you for writing this up. dnsmasq has been great but can't handle a lot of connections so I've been looking into BIND again. – ceolwulf Apr 9 '11 at 18:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.