Custom resolv.conf location not working

ranceh

New Member


Messages: 2

I am a dnsmasq user that had a setup working the way I want under 13.0-RELEASE. Since upgrading to 13.0-RELEASE-p11 I have noticed a problem.

I have a resolvconf.conf file with a single line: resolv.conf=/etc/resolv.conf.dhcp

I have a real static /etc/resolv.conf file that tells the box to use itself for name resolution, and I also tell dnsmasq to use the custom /etc/resolv.conf.dhcp for upstream data.

This used to work correctly, but post upgrade to p11 the resolver is writing to resolv.conf instead of the alternate location requested in the config file. This breaks a whole lot of things.

I didnt notice any changes to the resolv.conf process in the changelog, but then, I could easily have missed something.

How do I restore the desired behavior? How do I tell the resolvconf creation tool not to touch resolv.conf and instead manage the alternate file?
 

gpw928

Aspiring Daemon

Reaction score: 374
Messages: 760

If your dhclient(8) is clobbering /etc/resolv.conf, you can populate it, and then make it immutable:
Code:
sudo chflags schg /etc/resolv.conf
 

Alain De Vos

Son of Beastie

Reaction score: 995
Messages: 3,073

I have two lines in resolvconf.conf,
Code:
resolv_conf="/dev/null"
unbound_conf="/dev/null"
It prevents updating of /etc/resolv.conf
 

Phishfry

Beastie's Twin

Reaction score: 3,236
Messages: 6,372

Only one line in mine with DNSMasq installed.
/etc/resolvconf.conf
Code:
resolvconf=NO

/etc/rc.conf
Code:
resolv_enable="NO"

/usr/local/etc/dnsmasq.conf
Code:
domain-needed
bogus-priv
strict-order
no-resolv
interface=lagg0
interface=em1
listen-address=127.0.0.1,192.168.1.1,192.168.2.1
expand-hosts
server=1.1.1.1
server=8.8.4.4
local=/localdomain/
domain=localdomain
dhcp-authoritative
dhcp-range=set:em1,192.168.2.10,192.168.2.20,72h
dhcp-range=set:lagg0,192.168.1.100,192.168.1.140,72h
dhcp-option=em1,option:router,192.168.2.1
dhcp-option=lagg0,option:router,192.168.1.1
dhcp-option=option:dns-server,1.1.1.1,8.8.4.4
dhcp-option=option:domain-search,localdomain
#dhcp-option-force=option:domain-search,internal,localdomain
#log-dhcp
#log-queries
log-facility=/var/log/dnsmasq.log
dhcp-leasefile=/var/db/dnsmasq/dnsmasq.leases
cache-size=500
no-negcache
## conf ###
conf-dir="/usr/local/etc/dnsmasq.d"
# This fixes a security hole. see CERT Vulnerability VU#598349
dhcp-name-match=set:wpad-ignore,wpad
dhcp-ignore-names=tag:wpad-ignore
### Static IP ###
[SNIP]

Here is a real good method for network wide block lists.
mkdir /usr/local/etc/dnsmasq.d
cd /usr/local/etc/dnsmasq.d
fetch https://github.com/notracking/hosts-blocklists/raw/master/dnsmasq/dnsmasq.blacklist.txt
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 13,976
Messages: 40,708

If your dhclient(8) is clobbering /etc/resolv.conf, you can populate it, and then make it immutable:
A better way is to create a /etc/dhclient-enter-hooks:
Code:
add_new_resolv_conf() {
        # We don't want /etc/resolv.conf changed
        # So this is an empty function
        return 0
}
That will stop dhclient(8) from touching /etc/resolv.conf at all. While your solution will probably work, dhclient(8) is going to complain about the fact it can't write to that file.
 
Top