Tuesday, February 3, 2015

ubuntu - How do I configure bind to resolve a specific name and forward all others?

(See bottom for what I think might be the solution.)



I want to configure bind on our caching dns to resolve bla.mydomain.com to 192.168.115.13 (an internal host) while still forwarding all other requests to our internet provider's name servers.
This should only work from our intranet, the box is not meant for external access.



I got the first part working by creating a master zone for mydomain.com and adding an address entry for bla:




/etc/bind/mydomain.com.hosts:



$ttl 38400
mydomain.com. IN SOA dns. webmaster.mydomain.com. (
1313763352
10800
3600
604800
38400 )
mydomain.com. IN NS s6.

bla.mydomain.com. IN A 192.168.115.13


But of course now nobody in our intranet can find our webserver www.mydomain.com any more.



If I remove this master zone again, everything goes back to normal, that is bind only caches and forwards dns lookups.



I already tried Google but either I did not find the correct key words or this problem is so rare that nobody writes about it (which I just can't believe).



Any hints?




Edit:



I tried adding a master zone for bla.mydomain.com as voretaq7 suggested:



/etc/bind/bla.mydomain.com.hosts:



$ttl 38400
bla.mydomain.com. IN SOA dns. webmaster.mydomain.com. (
1314085537

10800
3600
604800
38400 )
bla.mydomain.com. IN A 192.168.115.13


and restarted bind, just to be sure.



Now, nslookup kind of works:




>nslookup
Default Server: localhost
Address: 192.168.115.13

> bla.mydomain.com
Server: localhost
Address: 192.168.115.13

Name: bla.mydomain.com

Address: 192.168.115.13


(Why does it say "Default Server: localhost", that's not the ip of my local box but the ip of the name server.)



But a ping bla.mydomain.com still returns the ip address from my internet provider's dns.



Edit:



Based on an answer to this question I think dnsmasq is what I am looking for. I'll give it a try.

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...