Understanding openresolv
by lostintime from LinuxQuestions.org on (#6R3JX)
How does openresolv function? I browsed the manpage and author's web site and still do not understand how openresolv functions on-the-fly.
* Is the /usr/sbin/resolvconf command called externally by other processes?
* Does the /etc/resolvconf.conf file handle both "up" and "down" events when wanting to modify /etc/resolv.conf?
* Is the /etc/openvpn/update-resolv-conf script required to guide the openvpn command to use /usr/bin/resolvconf? If not then how does the openvpn command automatically look to see if /usr/bin/resolvconf is installed?
For example, my local /etc/resolv.conf is: 1) 127.0.0.1 (local dnsmasq), and 2) my LAN DNS server (also dnsmasq). When using a VPN I want the local dnsmasq.conf to change to comment out the 'server=' options and add a 'server=' option for the VPN DNS server, but I want to retain all of my 'addn-hosts=' entries to block unwanted URLs. I want the local /etc/resolv.conf file to comment out (2) the LAN DNS server, and add the IP address for the VPN DNS server.
Thanks.
Edit: I found this tutorial that states:
The openvpn client doesn't automatically implement DNS servers pushed by the VPN server. To accomplish this, you must install a DNS management program such as resolvconf or openresolv, but those many clash with existing network management software in your OS.
The statement does not explain how openresolv is used or how openresolv is triggered. The tutorial mentions the /etc/openvpn/update-resolv-conf script, but implies the script is native to Debian/Ubuntu, although I presume is adaptable with the 'up' and 'down' options in any *.opvn file.
Based on what I've read, any script can be used with the 'up' and 'down' options in an *.ovpn file. Seems I could accomplish what I described with my own script.
Still confused.
* Is the /usr/sbin/resolvconf command called externally by other processes?
* Does the /etc/resolvconf.conf file handle both "up" and "down" events when wanting to modify /etc/resolv.conf?
* Is the /etc/openvpn/update-resolv-conf script required to guide the openvpn command to use /usr/bin/resolvconf? If not then how does the openvpn command automatically look to see if /usr/bin/resolvconf is installed?
For example, my local /etc/resolv.conf is: 1) 127.0.0.1 (local dnsmasq), and 2) my LAN DNS server (also dnsmasq). When using a VPN I want the local dnsmasq.conf to change to comment out the 'server=' options and add a 'server=' option for the VPN DNS server, but I want to retain all of my 'addn-hosts=' entries to block unwanted URLs. I want the local /etc/resolv.conf file to comment out (2) the LAN DNS server, and add the IP address for the VPN DNS server.
Thanks.
Edit: I found this tutorial that states:
The openvpn client doesn't automatically implement DNS servers pushed by the VPN server. To accomplish this, you must install a DNS management program such as resolvconf or openresolv, but those many clash with existing network management software in your OS.
The statement does not explain how openresolv is used or how openresolv is triggered. The tutorial mentions the /etc/openvpn/update-resolv-conf script, but implies the script is native to Debian/Ubuntu, although I presume is adaptable with the 'up' and 'down' options in any *.opvn file.
Based on what I've read, any script can be used with the 'up' and 'down' options in an *.ovpn file. Seems I could accomplish what I described with my own script.
Still confused.