resolvd

resolvd(8) was added in OpenBSD 6.9. This daemon manages /etc/resolv.conf by automatically adding nameservers from various sources such as dhcpleased(8), iked(8), slaacd(8), and other network devices.

By default, OpenBSD enables and starts resolvd on bootup.

Default nameservers

The default nameserver used in name lookup is located in resolv.conf:

# cat /etc/resolv.conf
lookup file bind
family inet6 inet4
nameserver 127.0.0.1

Changing default nameservers

You can remove all nameservers for the interface if0 using route's nameserver command:

Note: You must replace if0 with your actual interface name.

# route nameserver if0 

Nameservers can also be manually set using route:

# route nameserver if0 203.0.113.1
# cat /etc/resolv.conf                       
nameserver 203.0.113.1 # resolvd: if0
lookup file bind
family inet6 inet4
nameserver 127.0.0.1

Disabling resolvd

Sometimes, resolvd may give you incorrect nameserver information. This may happen if your DHCP server is providing an incorrect DNS server (or simply a DNS server you don't want to use).

There are two methods to fix this. One is to configure dhclient? to override or ignore the DNS server. The other is to simply disable resolvd(8) and manually edit resolv.conf(5).

Note that resolvd(8) may automatically overwrites resolv.conf(5), and those nameservers may supersede the ones you specify. In that case, you can disable resolvd(8):

# rcctl disable resolvd
# rcctl stop resolvd

Now, edits to /etc/resolv.conf will persist.