Este conteúdo não está disponível no idioma selecionado.
Chapter 23. Manually configuring the /etc/resolv.conf file
By default, NetworkManager dynamically updates the /etc/resolv.conf file with the DNS settings from active NetworkManager connection profiles. However, you can disable this behavior and manually configure DNS settings in /etc/resolv.conf.
Alternatively, if you require a specific order of DNS servers in /etc/resolv.conf, see Configuring the order of DNS servers.
23.1. Disabling DNS processing in the NetworkManager configuration Copiar o linkLink copiado para a área de transferência!
By default, NetworkManager manages DNS settings in the /etc/resolv.conf file, and you can configure the order of DNS servers. Alternatively, you can disable DNS processing in NetworkManager if you prefer to manually configure DNS settings in /etc/resolv.conf.
Procedure
As the root user, create the
/etc/NetworkManager/conf.d/90-dns-none.conffile with the following content by using a text editor:[main] dns=none
[main] dns=noneCopy to Clipboard Copied! Toggle word wrap Toggle overflow Reload the
NetworkManagerservice:systemctl reload NetworkManager
# systemctl reload NetworkManagerCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteAfter you reload the service, NetworkManager no longer updates the
/etc/resolv.conffile. However, the last contents of the file are preserved.-
Optional: Remove the
Generated by NetworkManagercomment from/etc/resolv.confto avoid confusion.
Verification
-
Edit the
/etc/resolv.conffile and manually update the configuration. Reload the
NetworkManagerservice:systemctl reload NetworkManager
# systemctl reload NetworkManagerCopy to Clipboard Copied! Toggle word wrap Toggle overflow Display the
/etc/resolv.conffile:cat /etc/resolv.conf
# cat /etc/resolv.confCopy to Clipboard Copied! Toggle word wrap Toggle overflow If you successfully disabled DNS processing, NetworkManager did not override the manually configured settings.
Troubleshooting
Display the NetworkManager configuration to ensure that no other configuration file with a higher priority overrode the setting:
NetworkManager --print-config
# NetworkManager --print-config ... dns=none ...Copy to Clipboard Copied! Toggle word wrap Toggle overflow
23.2. Replacing /etc/resolv.conf with a symbolic link to manually configure DNS settings Copiar o linkLink copiado para a área de transferência!
By default, NetworkManager manages DNS settings in the /etc/resolv.conf file, and you can configure the order of DNS servers. Alternatively, you can disable DNS processing in NetworkManager if you prefer to manually configure DNS settings in /etc/resolv.conf. For example, NetworkManager does not automatically update the DNS configuration if /etc/resolv.conf is a symbolic link.
Prerequisites
-
The NetworkManager
rc-managerconfiguration option is not set tofile. To verify, use theNetworkManager --print-configcommand.
Procedure
-
Create a file, such as
/etc/resolv.conf.manually-configured, and add the DNS configuration for your environment to it. Use the same parameters and syntax as in the original/etc/resolv.conf. Remove the
/etc/resolv.conffile:rm /etc/resolv.conf
# rm /etc/resolv.confCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a symbolic link named
/etc/resolv.confthat refers to/etc/resolv.conf.manually-configured:ln -s /etc/resolv.conf.manually-configured /etc/resolv.conf
# ln -s /etc/resolv.conf.manually-configured /etc/resolv.confCopy to Clipboard Copied! Toggle word wrap Toggle overflow