Fedora Linux Support Community & Resources Center
Old 21st October 2012, 09:59 AM
toMeloos Offline
Registered User
Join Date: Jul 2012
Location: The Hague
Posts: 5
Permanently setting DNS servers


I'm traveling around Asia and am relying on WiFi connections in bars, restaurants, hotels as well as public hotspots. Unfortunately I have encountered everything from simply unreliable connections to outright censorship using DNS filtering.

To improve this I would like to permanently switch to OpenDNS and/or Google DNS servers. This setting should overrule the DNS servers assigned by WiFi routers through DHCP.

Question is: how do I do that in Fedora 17? Networkmanager overwrites /etc/resolv.conf if I'm not mistaken, so this is not an option considering I usually connect to several (new) networks every day. Is there some DNS prepend or overwrite option in a config file somewhere that I can use?

Thanks for your help!
Reply With Quote
Old 21st October 2012, 10:31 AM
turakas Offline
Registered User
Join Date: Sep 2012
Location: Estonia
Posts: 9
Re: Permanently setting DNS servers

Use networkmanager GUI to set up DNS servers or edit /etc/sysconfig/network-scripts/<your-interface> or system-config-network tool for that.
Reply With Quote
Old 22nd October 2012, 05:19 AM
toMeloos Offline
Registered User
Join Date: Jul 2012
Location: The Hague
Posts: 5
Re: Permanently setting DNS servers

I actually figured it out, and managed to do a whole bit more:

To overwrite DNS servers, all you have to do is create a config file. This is what to put in "/etc/dhcp/dhclient-wlan0.conf":
#supersede domain-name-servers,;
prepend domain-name-servers,;
Those IP addresses are the OpenDNS servers. You'll have to create this file for every network interface (eth0, wlan0, etc.) that you want to override. Supersede would actually override the DNS servers provided by the DHCP server, prepend prioritizes these DNS servers before the ones provided by the DHCP server. There's an append option too, see the dhclient.conf man page for more info.

What I did next is to use DNSMASQ (which turned out to be installed on my computer already) to do DNS caching, which improves my browsing speed significantly. Here's the settings:

#supersede domain-name-servers,,;
prepend domain-name-servers,,;
server=    # Forward to OpenDNS's servers
So all DNS requests are routed through the dnsmasq caching nameserver (whith direct querying of the OpenDNS servers in case dnsmasq ceashes). Dnsmasq queries the OpenDNS servers and caches for better performance.

Hope this helps others that want to try to do the same thing.
Reply With Quote

dns, permanently, servers, setting

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
setting enviroment variables (permanently) saibaggins Using Fedora 6 15th March 2006 01:26 PM
setting default GW permanently hcclnoodles Servers & Networking 4 15th September 2005 09:44 PM
Setting Env var permanently luca Using Fedora 1 20th October 2004 11:38 AM

Current GMT-time: 04:21 (Monday, 21-08-2017)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat