LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Call DNS server based on domain query (http://www.linuxquestions.org/questions/linux-networking-3/call-dns-server-based-on-domain-query-904207/)

benjalien 09-21-2011 09:35 AM

Call DNS server based on domain query
 
Hi everyone,

I have a strange setup here and I need to do some tweaking to get it solved.

I'm on a network where all DNS queries to Dynamic IPs (dyndns.com) are redirected to a "don't go there" IP.

So I tought about setting a static external DNS server IP in my resolv.conf using /etc/dhcp/dhclient.conf.

This works fine!

The only problem I have now, is that if I put the external DNS server first, I don't have any name resolution for the internal network, and if I put the internal DNS first, I don't have any name resolution for the dyndns domains...

How can I configure my linux to tell it to go to the internal DNS for .internal.org adresses, and to the external for everything else?

Quite interesting, insn't it?

Benja

jason_not 09-21-2011 11:03 AM

Hi.

My first thought is "why are resolutions go dyndns.org being re-directed?" If that's just your ISP, then ensure you are not breaking some sort of acceptable use policy. However, if this is where you work, bypassing your IT department's policies could be bad for you.

Having said that, when I need a more complex dns solution such as your own, I build my own dns server locally. You can then change teh settings in resolv.conf to "nameserver 127.0.0.1". You can configure zones, so that queries to internal domains get re-directed to the internal dns servers, whereas all others can get routed to the internet dns server of your choice.

I will not try to tell you how to configure a dns server: that is WAY beyond this topic.

I hope this helps...

--jason

barlafues 09-25-2011 05:55 PM

Quote:

Originally Posted by benjalien (Post 4478140)
The only problem I have now, is that if I put the external DNS server first, I don't have any name resolution for the internal network, and if I put the internal DNS first, I don't have any name resolution for the dyndns domains...

How can I configure my linux to tell it to go to the internal DNS for .internal.org adresses, and to the external for everything else?

You can make the external DNS a cache. You can then tell the cache to direct queries for *.dyndns.com to a phony server, queries for *.yourcompany.com to the internal DNS, and all other queries to root nameservers. Dnscache from djbdns allows you to do this quite simply.

benjalien 09-26-2011 07:13 AM

Hi Jason_not and barlafues,

I was looking for some sort of "easy solution" to avoid having to play in my resolv.conf during the day. Setting up a local DNS server or starting to cache stuff is too complicated for the additional comfort it would bring... But anyway, thanks for your replies!


All times are GMT -5. The time now is 05:57 AM.