Gentoo/Openresolv

Page last edited 3,796 days ago
From Alon Bar-Lev's Site
Jump to navigation Jump to search

Openresolv

net-dns/openresolv handles /etc/resolv.conf dynamic changes and priority. This is needed as there are several daemons (dhcpcd, ppp, openvpn) that actively rewrites /etc/resolv.conf. This leads to undesired results, as usually only the last settings are preserved.

net-dns/openresolv provides a common interface for /etc/resolv.conf, and is used by sys-apps/openrc, net-misc/dhcpcd, net-misc/openvpn if openresolv package is installed. There is no direct dependency, so you need to install it directly.

Installation

emerge net-dns/openresolv

Manage

Usually once installed nothing should be done, to see it working, watch for resolvconf signature within /etc/resolv.conf.

cat /etc/resolv.conf
# Generated by resolvconf
search mydomain.com domain.name
nameserver 10.10.50.2
nameserver 10.10.50.39
nameserver 192.168.1.1

Show status:

resolvconf -l
# resolvconf -l
# resolv.conf from vpn0
# Generated by openvpn for interface vpn0
domain mydomain.com
nameserver 10.10.50.2
nameserver 10.10.50.39

# resolv.conf from wlan0
# Generated by dhcpcd from wlan0
domain domain.name
nameserver 192.168.1.1

Force update:

resolvconf -u

Tweeks

Setting Interface Metrics

If OpenVPN(bug 391175) is used or any VPN that does not support interface metrics, interface metrics should be set via /etc/resolvconf.conf

For example, set vpn interface to have higher priority than other interfaces:

File: /etc/resolvconf,conf
interface_order="lo lo[0-9]* vpn*"

Maintainer

Alon Bar-Lev

Authors

Originally written by: Alon Bar-Lev - 2011-11-17


Authors are people who have worked on this document and have made significant changes to its content. If you have edited this article and wish to add yourself to the authors list please read "Who are Authors".