2

I want to change my DNS nameserver to GoogleDNS on fedora 25. I edited /etc/resolv.conf from

search fritz.box
nameserver 192.168.1.1

to

nameserver 8.8.8.8
nameserver 8.8.8.4

But if I reconnect to router, the file will revert back to my router's DNS nameserver. I followed this https://developers.google.com/speed/public-dns/docs/using this link's tutorial for debian part. But it isn't working.

Can I change nameserver to google's DNS permanently?

P.S: I do not have access to the router.

3 Answers 3

2

The issue is you are getting the DNS server from the router and overriding what you set. To fix this, you must edit /etc/dhclient.conf.

Add this line to make sure that it does not override the default DNS servers:

supersede domain-name-servers 8.8.8.8, 8.8.4.4;

Alternatively, you can instruct the DHCP client to not request a DNS server address.

More information can be found with the man dhclient.conf command.

1

Below Solution Worked in my box (Fedora release 25)

/etc/sysconfig/network-scripts/ifcfg-eno1

Added below entries to above file at the bottom.

PEERDNS=NO
DNS1=8.8.8.8
DNS2=8.8.4.4

And restarted network (service network restart) to ensure that the entries are not modified in /et/resolv.conf

0

I solved this by going to network manager and editing my connection in IPv4 tab, sliding automatic to manual for DNS and then setting server address to the one I need. (GNOME) Or I could edit resolve.conf and then change its attribute with option i, like `chattr +i resolv.conf . Therefore stopping DHCP from editing it again. I observed that in xfce4​ - network manager we have to change the DHCP in IPv4 to automatic address but manual DNS in options.

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.