Chapter 21. Manually configuring the /etc/resolv.conf file
Chapter 21. 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 . Note Alternatively, if you require a specific order of DNS servers in /etc/resolv.conf , see Configuring the order of DNS servers . 21.1. Disabling DNS processing in the NetworkManager configuration 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.conf file with the following content by using a text editor: Reload the NetworkManager service: Note After you reload the service, NetworkManager no longer updates the /etc/resolv.conf file. However, the last contents of the file are preserved. Optional: Remove the Generated by NetworkManager comment from /etc/resolv.conf to avoid confusion. Verification Edit the /etc/resolv.conf file and manually update the configuration. Reload the NetworkManager service: Display the /etc/resolv.conf file: 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: Additional resources NetworkManager.conf(5) man page on your system Configuring the order of DNS servers using NetworkManager 21.2. Replacing /etc/resolv.conf with a symbolic link to manually configure DNS settings 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-manager configuration option is not set to file . To verify, use the NetworkManager --print-config command. 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.conf file: Create a symbolic link named /etc/resolv.conf that refers to /etc/resolv.conf.manually-configured : Additional resources resolv.conf(5) and NetworkManager.conf(5) man pages on your system Configuring the order of DNS servers using NetworkManager
[main] dns=none systemctl reload NetworkManager systemctl reload NetworkManager cat /etc/resolv.conf NetworkManager --print-config dns=none rm /etc/resolv.conf ln -s /etc/resolv.conf.manually-configured /etc/resolv.conf