# Generated by NetworkManager
search Home
nameserver 8.8.8.8
nameserver 4.4.4.4
Configuring resolv.conf in Fedora 30
Intro
I’ve recently configured a DNS server at home and I’d like to resolve all server names through it. For that every time I try to resolve any domain name I have to make sure the first DNS hit is mine.
resolv.conf
Normally my linux distro (Fedora 30) will look into the /etc/resolv.conf file and ask the servers put in there in order from top to bottom:
So the idea is to add a nameserver entry on top of the rest and that’s it. I can do that, but the problem is that this file is generated everytime the system reboots, so I’d be happy just until I shutdown the system.
NetworkManager.conf
In order to make my system stop regenerating the /etc/resolv.conf file is to tell it so in the /etc/NetworkManager/NetworkManager.conf. You only need to add dns=none inside the [main] section.
[main]
dns=none
Now go back to your resolv.conf file and add the new DNS entry:
search Home
nameserver 192.168.1.89
nameserver 8.8.8.8
nameserver 4.4.4.4
Remember to add it on top of the rest nameserver entries |
Finally the only thing remaining to see the changes is to restart the network.
Restart network
In Fedora you can just restart your network service by executing:
nmcli con reload eth0
Where eth0 is the name of the network interface you’re reloading
Resources
-
How to set DNS resolver in Fedora [https://unix.stackexchange.com/questions/90035/how-to-set-dns-resolver-in-fedora-using-network-manager]