Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

As is common with home routers, my router, an ASUS RT-N66U, is configured to act as a caching nameserver for my LAN. It looks like the router uses dnsmasq for name service. The router also offers DHCP service, and allows reserving IP addresses for particular MAC addresses -- local-only, RFC 1918 addresses of course. Conveniently, this router allows name resolution for those reserved IP addresses. So, at the command line, "ping mykids-pc" will correctly resolve the local IP address for that device and successfully ping it.

On my Linux desktop, I have BIND configured both as a caching nameserver, and as an authoritative server for virtual machines I run on my Linux desktop. So, "ping centos.posix.test" will resolve the IP and successfully ping it.

The problem is, I can't find a way to do both conveniently at the same time. I haven't figured out how to get BIND on my desktop to use the router as a forwarder for RFC 1918 addresses, or how to configure dnsmasq on my router to use my desktop as a forwarder.

Is there a way to do this?

share|improve this question
    
You can't configure a DNS server to forward requests for specific addresses, since it won't know the address until after the name gets resolved... You can, however, configure Bind9 to forward requests for specific domains, using zone "foo" { type forward; forwarders ... }; is one possible way. –  grawity Aug 24 '12 at 0:33
    
That pretty much gets at the central problem; given my current setup, I can't actually do both things at once. –  bgvaughan Aug 28 '12 at 11:22
add comment

2 Answers

up vote 2 down vote accepted

I believe you could put the DHCP allocated computers into a subdomain and use DNS delegation to hand-off queries to the router whilst still maintaining ISP nameservers as forwarders.

So your Linux desktop would be authoritative for example.com, containing centos.example.com etc. The router would be configured to be authoritative for dhcp.example.com containing mykids-pc.dhcp.example.com etc.

You just need to add the appropriate delegation records.

share|improve this answer
    
A subdomain and delegation is not necessary – in bind9, type forward zones exist and can be used even for TLDs. –  grawity Aug 24 '12 at 0:40
    
This seems like the right approach in general, though I'd need BIND on my router, not just dnsmasq. –  bgvaughan Aug 28 '12 at 11:21
add comment

I have named running on a server that resolves names for a local TLD and forwards other queries to Google's public DNS.

This is what my /etc/bind/named.conf.options looks like:

options {
        ...
        forward only;
        forwarders {
                8.8.8.8;
                8.8.4.4;
        };
};

To make it use your router as a forwarder, delete one of the forwarders stanzas and put your router's IP address for the remaining one.

share|improve this answer
    
Unfortunately, the LAN router has an RFC 1918 address, 192.168.1.1, and forwarding to an RFC 1918 address doesn't seem to work. –  bgvaughan Aug 23 '12 at 22:07
1  
I don't see why it being an RFC 1918 address would change anything. But there could be something going on I don't know about. I learn more about BIND every time I have to reconfigure it. –  ultrasawblade Aug 23 '12 at 23:03
    
@bgvaughan I have successfully configured several instances of bind9 to use my own router at a RFC 1918 address as a forwarder, both for all requests and for specific zones. There is absolutely nothing special in that. –  grawity Aug 24 '12 at 0:37
    
I misstated. It seems to use 192.168.1.1 as a forwarder without trouble in general. However, after setting that up, 'dig mykids-pc' gets an NXDOMAIN response even though it lists '192.168.1.1' as the name server, whereas 'dig mykids-pc @192.168.1.1' gets the expected result. –  bgvaughan Aug 24 '12 at 0:44
add comment

Your Answer

 
discard

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.