Sobes.tech
Junior — Middle

Where in system configuration files is the DNS server usually specified and changed if necessary?

sobes.tech AI

Answer from AI

In Linux systems, DNS servers are usually specified in the /etc/resolv.conf file. This file contains the DNS server addresses in the following format:

nameserver 8.8.8.8
nameserver 8.8.4.4

However, in modern systems using systemd-resolved or NetworkManager, this file may be automatically generated, and changes to it can be overwritten.

In such cases, DNS servers are configured via:

  • NetworkManager: through the graphical interface or the nmcli command.
  • systemd-resolved: in the /etc/systemd/resolved.conf file or via resolvectl.

In Windows, DNS servers are configured in the network connection properties or through the netsh command.

Thus, the main file for directly specifying DNS is /etc/resolv.conf, but in modern systems, it is important to consider network managers and services that may manage this file.