Sometimes I have to connect to my work network throughout VPNC. That network has DNS server. I don't have a permission to pull zone files from it. And I have local bind server which forwards to 220.127.116.11 and resolves some internal names of my KVMs. And my resolve.conf directs to 127.0.0.1.
All names from the work network have the same subdomain (company.com).
I would be glad to find a config option with regex to forward resolution domain names matching regex /company.com$/ to another DNS server instead the default.
Yeah, this solution doesn't look technically perfect but it's simple.
Thanks for the idea about dnsmasq. Now it's left get it working.
Now I run the bind9 on an veth only. /etc/resolve.conf is left unchanged. dnsmasq is bound to rest interfaces and forwards to bind9 by default otherwise to the company server.
And everything working if vpn network was established before. But if you start vpnc-connect it fails after hanging some time with complain that vpn.company.com cannot be resolved.
I tried to disable negative cached and setting max cache size to zero. Nothing helped.
This looping don't happened if /etc/resolve.conf points to 18.104.22.168 or to my bind9.