Colleagues, please tell me how to switch resolve.conf on the fly?
When I have OpenVPN running on my router and after that DNS requests should go to the server in the private network. When VPN is disconnected, they should return to the provider's DNS.
I have a file /tmp/resolv.conf and a file /tmp/resolv.conf.openvpn, which creates VPN. I want to copy these files when starting and stopping VPN to a third file, for example /tmp/resolv.conf.real. Then restart dnsmasq.
Of course, dnsmasq needs to know that it is now using a third file. (I suppose this can be explained to it.)
Is this the correct way, or is there a better one?
Thank you for your answers and recommendations,
Ogogon.