Select DNS Servers depending on the domain

Hello,

I'm using CentOS 5.3, and I connect to a VPN in order to work. The problem is that I'm constantly accessing things on the local network and the remote network. But once I'm connected to the VPN I can't access local addresses by name, I have to use the ip-address.

What I'd like is to configure things so that all of the things that are on my domain use my local DNS, and the rest of the stuff use the VPN DNS.

Is this possible? Regards

It is a long time since I did this but you need to point your CentOS machine at your local DNS servers ensure your CentOS machine know what domain it belongs to (both in /etc/resolv.conf) and then get your DNS server to use the VPN DNS when it gets DNS requests for domains that it does not know about. I trust someone else will tell us how to do the latter.

while you are VPN connected ; can you try to resolve anything using you local DNS ? ; can you even ping your local DNS ?
i have a feeling that your VPN connection should not filter out any communication with local IP network ? if so then test this criteria by trying to do a DNS query while VPN connected
some thing like
#nslookup
then set the server to your local server
>server my.dns.ip.address
then try to resolve any local DNS name

if the request times out this means that your resolver [DNS client] could not communicate with your DNS server ! ; if not then this means that you will need to add the local DNS to the list of valid DNS servers that is used while you are VPN connected [this is related with the configuration acquisition that is made upon VPN connection ]

regards

Hello,

When I'm VPN connected and I try to access anything inside the local network, it gets resolved to an error page from Yahoo.

I did the nslookup:

$ nslookup
> server my.dns.server
> local-computer-name

And it worked. So this should be a matter of setting the dns server on the resolv.conf file, which looks like this when I'm not vpn connected:

nameserver 172.x.x.x

And like this when I'm connected:

;;SNX;; - {
nameserver 10.x.x.x
nameserver 10.x.x.x
search corp.mycompany.com
;;SNX;; - }
; generated by /sbin/dhclient-script
nameserver 172.x.x.x

If I move my local nameserver up, everything gets resolved using my dns, and the other way around. That's why I was kind of asking if it's posible to decide wich one to use depending on the thing you want to access.

thanks and regards

You need to get you local DNS servers to pass on queries for domains that are not yours to a higher tier DNS server (e.g. the DNS server responsible for .com).