4

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: gamestats2.gs.nintendowifi.net, 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?

John Gardeniers
  • 27,458
  • 12
  • 55
  • 109
Patrick
  • 143
  • 1
  • 4

2 Answers2

17

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 gamestats2.gs.nintendowifi.net to your own host, you would need this in your named.conf:

zone "gamestats2.gs.nintendowifi.net" {
        type master;
        file "override.zone";
};

And inside override.zone, a zone definition like this:

$TTL 3600
$ORIGIN gamestats2.gs.nintendowifi.net.

@       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 10.0.0.1

ns0     IN A 127.0.0.1

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 gamestats2.gs.nintendowifi.net localhost
Using domain server:
Name: localhost
Address: 127.0.0.1#53
Aliases: 

gamestats2.gs.nintendowifi.net has address 10.0.0.1

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

larsks
  • 43,623
  • 14
  • 121
  • 180
  • 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. – Patrick Apr 09 '11 at 18:39
5

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

address=/gamestats2.gs.nintendowifi.net/Yo.Ur.Ip.Ad

Directive...

quanta
  • 51,413
  • 19
  • 159
  • 217
Essobi
  • 901
  • 6
  • 9
  • 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! – Patrick Jan 18 '11 at 19:50