Skip to main content
Share Your Experience: Take the 2024 Developer Survey
152 votes

Why does /etc/resolv.conf point at

You are likely running systemd-resolved as a service. systemd-resolved generates two configuration files on the fly, for optional use by DNS client libraries (such as the BIND DNS client library in C ...
JdeBP's user avatar
  • 69.2k
26 votes

Who reads /etc/resolv.conf?

DNS client libraries do. C libraries contain DNS clients that wrap up name-to-address lookups in the DNS protocol and hand them over to proxy DNS servers to do all of the grunt work of query ...
JdeBP's user avatar
  • 69.2k
20 votes

What is the difference between resolvconf, systemd-resolve, and avahi?

When you run a command such as ping foobar the system needs to work out how to convert foobar to an ip address. Typically the first place it looks is /etc/nsswitch.conf. This might have a line such as:...
Stephen Harris's user avatar
19 votes

How to setup DNS manually on Linux?

DNS Config Under Linux DNS usage on linux is done over a set of routines in the C library that provide access to the Internet Domain Name System (DNS). The resolver configuration file (resolv.conf) ...
intika's user avatar
  • 14.5k
18 votes

What's the difference between /run/systemd/resolve/stub-resolv.conf and /run/systemd/resolve/resolv.conf?

Using resolv.conf instead of stub-resolv.conf will bypass a lot of systemd-resolved configuration, such as DNS answer caching, per-interface DNS configuration, DNSSec enforcement, etc. Explanations: ...
duthils's user avatar
  • 426
17 votes

I can resolve a *.local domain, ping the IP, but I can't ping this domain

I found the answer! So most of you will know that the /etc/hosts file will resolve domains, somewhat like a DNS server. But how does the system know to look in that file? And how does it know what ...
DAB's user avatar
  • 475
16 votes

Why does /etc/resolv.conf point at

The entire CIDR block is used for loopack routing. Your host seems to be (or at least seems to think it is) running its own DNS server on that specific loopback address. Because loopback ...
DopeGhoti's user avatar
  • 76.5k
16 votes

Why does /etc/resolv.conf point at

This is because you are using systemd-resolved service for Network Name Resolution. In that case you can use resolvectl status command. Go to your network for eg: wlp1s0. Check the current DNS server. ...
Allen Johnson's user avatar
14 votes

How do I specify the order that Network-Manager populates /etc/resolv.conf

Set ipv4.dns-priority of at least one of the profiles, to specify the relative order. For example nmcli connection modify "$PROFILE" ipv4.dns-priority 5 and reactivate the connection. See ...
thaller's user avatar
  • 1,646
11 votes

CentOS7: Network Manager is using wrong search domain

After a few hours of poking around, I was able to resolve this. It turns out, this was being set via DHCP: nmcli -f ip4 device show eth0 IP4.ADDRESS[1]: IP4....
James Shewey's user avatar
  • 1,166
10 votes

What's the "right way" to effect changes in /etc/resolv.conf with /etc/resolv.conf.d in place?

The answer is simple, The resolv.conf.d folder exists in /etc/resolvconf/ and contains head/base/original and tail files. each of them if edited will update the resolv.conf file in /etc/ lets say you ...
Viktova's user avatar
  • 285
10 votes

Dhclient not updating /etc/resolv.conf

Mint and other modern distros ship with mdns by default, which wraps the regular public DNS with a local "decentralized" wrapper which enables zeroconf support for your local network. Basically, a ...
tripleee's user avatar
  • 7,743
10 votes

Cannot rename resolv.conf file as root

As per your steps, you protected the file /etc/resolv.conf from being deleted/overwritten with chattr +i (immutable) So, you won't be able to move it to another file without doing sudo chattr -i /...
Rui F Ribeiro's user avatar
9 votes

File /etc/resolv.conf deleted on every reboot, why or what?

In my experience, /etc/resolv.conf gets regenerated on boot, so any manual changes to it get reset. To work around this, you can create /etc/resolv.conf.head (or .tail depending on which end of the ...
Mio Rin's user avatar
  • 3,040
9 votes

Where should I configure DNS in Debian 11?

The Debian wiki for resolv.conf explains how the dns-nameserver address is configured: Debian reads the nameserver address from /etc/resolv.conf. /etc/resolv.conf may be dynamically generated by ...
alexma418's user avatar
8 votes

What overwrites /etc/resolv.conf on every boot?

Ubuntu 16.04 If the network interfaces for your server instance is controlled by DHCP, the dhclient program will overwrite your /etc/resolv.conf file whenever the networking service is restarted. You ...
Sandjaie Ravi's user avatar
8 votes

Disable search option for resolv.conf

The solution is to set the search option in /etc/resolv.conf to: search . so /etc/resolv.conf would look like. search . nameserver nameserver
Dovid Bender's user avatar
8 votes

What is the use of sortlist option in /etc/resolv.conf?

sortlist is used to move matching IP addresses in DNS responses to the front of the result list with the intention that applications will use them preferentially. It's a bit obsolete though. Nowadays ...
Celada's user avatar
  • 44.3k
8 votes

How to stop openconnect from changing DNS settings

Posting as an answer rather than a comment to give it some visibility. I am not sure whether there is a better way for just citing other site's answers. But is an ...
Harald's user avatar
  • 908
8 votes

How to fix OpenVPN DNS leak

Sooo the answer is to carefully follow the always-on-point instructions from the ArchLinux wiki: and to append the ...
PlasmaBinturong's user avatar
8 votes

Alpine Linux sometimes DNS is not resolved

tl;dr Open file /etc/udhcpc/udhcpc.conf with a text editor. If the file is missing you just have to create it (and probably its containing folder). Append line RESOLV_CONF=no Done. Found here: ...
Thomas Urban's user avatar
8 votes

Fedora 33: Use custom DNS addresses

resolvectl dns Global: Link 2 (enp2s0): Link 3 (wlp1s0): sudo resolvectl dns wlp1s0 resolvectl dns Global: Link 2 (enp2s0): Link 3 (wlp1s0):
nezabudka's user avatar
  • 2,418
7 votes

Are keywords in resolv.conf case sensitive?

They are certainly case sensitive in the glibc resolver libraries. Note the use of strncmp (case sensitive compare) rather than strncasecmp (case insensitive compare) in the MATCH function within ...
steve's user avatar
  • 22k
7 votes

Who reads /etc/resolv.conf?

From the far better FreeBSD man page, resolv.conf: The resolver configuration file contains information that is read by the resolver routines the first time they are invoked by a process. On a ...
Rob's user avatar
  • 1,804
7 votes

How shall I understand the format of `/etc/resolv.conf`?

/etc/resolv.conf is the main configuration file for the DNS client, so its presence does not imply that you are running a DNS server. Its primary purpose is to list the IP addresses of DNS servers, in ...
Tsundoku's user avatar
  • 828
6 votes

How to stop dhclient from updating resolvconf on Debian?

If you don't need resolvconf to manage your /etc/resolv.conf file, the simplest solution is to uninstall resolvconf entirely.
Stephen Kitt's user avatar
6 votes

How to know where resolv.conf entries come from?

/etc/resolv.conf is built from pieces that are in the directory /run/resolvconf/interface (actual location on current Debian and Ubuntu) /etc/resolvconf/run/interface (old location, still existing via ...
Gilles 'SO- stop being evil''s user avatar
6 votes

CentOS7: Network Manager is using wrong search domain

The /etc/resolv.conf file will always be overwritten when there is a change or update to the network. You can control what is written by editing files in the /etc/resolvconf/resolv.conf.d/ folder... ...
L. D. James's user avatar
  • 1,624
6 votes

Make dnsmasq not altering resolv.conf

dnsmasq itself is not altering resolv.conf If you have your configuration file and start it manually via dnsmasq -d -C <yourconfig> you see that. This behaviour comes from systemd unit on debian ...
Hannes's user avatar
  • 345

Only top scored, non community-wiki answers of a minimum length are eligible