0

When I modify an ifcfg-.... configuration file for a newtork interface and add DNS1 & DNS2 entries, these DNS values are appended to /etc/resolv.conf by Network-Manager service when this service starts

And those DNS servers are used for system-wide DNS queries in up-down order.

Then, when I manually delete the entries from resolv.conf and save the file, system can't resolve domain names anymore and this takes effect immediately.

Even if we still have DNS1=..., DNS2=... entries in interface configuration files, they don't work.

So, it looks like linux apps take resolv.conf into considiration. Not anything else.

My question is;

If DNS1 and DNS2 lines in ifcfg-.... configuration files need to be in /etc/resolv.conf to work, and as we already know resolv.conf is not bound to a specific network interface, so this is a system-wide setting, why do we define DNS servers in network configuration files, not just in resolv.conf?

Was setting DNS servers in network interface configuration files designed to make DNS queries adapter-specific once but not implemented yet, so these DNS server ip addresses are simply appended to good old /etc/resolv.conf to do the work?

1 Answer 1

1

/etc/resolv.conf is typically the run-time configuration file used by applications. It's parsed by the standard libc libraries, which most programs use.

However the contents of /etc/resolv.conf need not be static, and can be built "on-demand". For example, a machine using DHCP may add entries received from the dhcp server. Indeed this is the most common way that resolv.conf is built.

The DNS1 DNS2 and DNS3 settings in the ifcfg files are not used at runtime; they're used at interface "up" time to modify resolv.conf. This could be used, for example, to point to different DNS servers if you're on the LAN (wired ethernet) or on dialup (ppp) or on WiFi...

Mostly the DNS* settings aren't so important, these days. Network manager can do this better. They're mostly a hold-over from very old RedHat configurations and really only made sense if using static IP addresses.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.