Using Google Public DNS - How?

Using Google Public DNS - How?

Postby Owdy » Jan 7th, '12, 19:49

http://code.google.com/speed/public-dns/

Where do i change that setting in Mageia?
Owdy
 
Posts: 39
Joined: Nov 26th, '11, 12:29

Re: Using Google Public DNS - How?

Postby pnunn » Jan 9th, '12, 03:00

edit /etc/resolv.conf and add the name server in there.

Peter.
pnunn
 
Posts: 97
Joined: Jun 20th, '11, 14:22

Re: Using Google Public DNS - How?

Postby Ken-Bergen » Jan 9th, '12, 03:49

pnunn wrote:edit /etc/resolv.conf and add the name server in there.

Peter.
Not! :shock:
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
from
Code: Select all
cat /etc/resolv.conf
In the network configuration tool use Manual instead of Automatic, you'll have to set your IP address, Gateway, Netmask and DNS server.
Ken
Ken-Bergen
 
Posts: 1019
Joined: Mar 30th, '11, 02:45
Location: Chilliwack, BC, Canada

Re: Using Google Public DNS - How?

Postby tallship » Mar 24th, '12, 19:18

Ken-Bergen wrote:
pnunn wrote:edit /etc/resolv.conf and add the name server in there.

Peter.
Not! :shock:
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
from
Code: Select all
cat /etc/resolv.conf
In the network configuration tool use Manual instead of Automatic, you'll have to set your IP address, Gateway, Netmask and DNS server.


Actually, it is perfectly safe to edit the file like so:

Code: Select all
vim /etc/resolv.conf


And then you affect the following changes so that your resolv.conf looks like this:

Code: Select all
search .
nameserver 8.8.4.4
nameserver 8.8.8.8


That should suffice nicely... until you reboot, and then (IF and ONLY IF it is a DHCP client) resolv.conf will be overwritten.

It's not advisable to suggest that someone choose static IPs/mask/netblock/etc., when they are already a DHCP client (And we're not sure that the OP is - we only know that Ken's computer is a DHCP client.

But...

If the OP is running as a DHCP client, then there are all sorts of official workarounds, depending upon your flavor of Unices.

A simple one is to edit that file and put in the two nameservers each time. An alternative is to put the code above into a file called /etc/resolv.skel and then:

Code: Select all
# cp -v /etc/resolv.skel /etc/resolv.conf


There's also /etc/resolv.conf.tail and /etc/resolv.conf.head, DHclient, etc.

Well I hope that helps, and don't forget to mark a thread solved once someone (or yourself) a working solution has been arrived at.

Kindest regards,

.
Registered Linux User #190795

- "Ask Bill why the string in [MS-DOS] function 9 is terminated by a dollar sign. Ask him, because he can't answer. Only I know that." - Dr. Gary Kildall.
User avatar
tallship
 
Posts: 14
Joined: Apr 6th, '11, 10:35
Location: On the Beaches of Super Sunny Southern California USA

Re: Using Google Public DNS - How?

Postby obgr_seneca » Mar 24th, '12, 21:37

What about opening the network center in the mcc and setting the dns manually?

But of course you can choose a more difficult way as well :D

Oliver
Linux - free choice for free people
User avatar
obgr_seneca
 
Posts: 156
Joined: Mar 16th, '11, 17:35
Location: Southwest of Germany

Re: Using Google Public DNS - How?

Postby viking60 » Apr 16th, '12, 23:44

Just to add to the difficulty you can add your nameservers on top of your existing /etc/resolv.conf so it prepends existing content.
Code: Select all
 OpenDNS nameservers
nameserver 208.67.222.222
nameserver 208.67.220.220
domain 10.0.0.1
nameserver 10.0.0.1

And you should probably write protect the file afterwords to avoid overwriting from Network managers.
Image Flexibility is good and inxi is good... install both!
User avatar
viking60
 
Posts: 255
Joined: Mar 19th, '11, 22:26

Re: Using Google Public DNS - How?

Postby obgr_seneca » Apr 16th, '12, 23:56

Config files are written by root, and root can overwrite write protected files iirc.

But why not use drakconf, since you can set the dns there?
Linux - free choice for free people
User avatar
obgr_seneca
 
Posts: 156
Joined: Mar 16th, '11, 17:35
Location: Southwest of Germany

Re: Using Google Public DNS - How?

Postby viking60 » Apr 17th, '12, 12:22

obgr_seneca wrote:Config files are written by root, and root can overwrite write protected files iirc.

Wouldn't
Code: Select all
chattr +i /etc/resolv.conf
do it?
obgr_seneca wrote:But why not use drakconf, since you can set the dns there?


No reason I can think off. I did say that I was adding to the difficulty :D
But who am I to deny people the freedom of scratching their head with their toes? They might have legitimate reasons for it.
In general I'll admit to the world: You should listen to obgr_seneca here since none of us can find a reason for not using drakconf.
Image Flexibility is good and inxi is good... install both!
User avatar
viking60
 
Posts: 255
Joined: Mar 19th, '11, 22:26

Re: Using Google Public DNS - How?

Postby doktor5000 » Apr 17th, '12, 19:01

Well, maybe the info at the top of that file should give you a small hint:

Code: Select all
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN


Also this has nothing to do with networkmanager, this shouldn't be done on a default setup in the way you proposed it. Next time you want to change your DNS servers via control center and forgot about that manual change, or that you set that file immutable and MCC will just error out? I don't say this wouldn't be a valid way to change DNS servers, but it's probably one of the worst ever (and most evil too) :twisted:
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18017
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Using Google Public DNS - How?

Postby viking60 » Apr 18th, '12, 13:04

To much bad influence and black magic I tell you.
For a while there I was sadistically imagening you giving support to a guy that had forgotten the edit - I am that bad ( you know who is worse).
After an excorsism I have now seen the light and I will therefore throw in a pic of MCC where this can be properly handled:
Image
(And to make a stubborn point I consider Drakconf to be a network manager - My evilness was that out of control)
Edit:
We might get back to this when DNScrypt hits the standard repos I dunno Image
If you have write protected your /etc/resolv.conf with
Code: Select all
chattr +i /etc/resolv.conf
you can undo it with
Code: Select all
chattr -i /etc/resolv.conf

You will then be able to edit the file again.
Image Flexibility is good and inxi is good... install both!
User avatar
viking60
 
Posts: 255
Joined: Mar 19th, '11, 22:26

Re: Using Google Public DNS - How?

Postby tallship » Apr 24th, '12, 14:13

obgr_seneca wrote:What about opening the network center in the mcc and setting the dns manually?


Because it doesn't address the issue. You only get to choose between static and dynamic allocation. The matter at hand deals with how to change your resolver to use Google DNS on a DHCP client.

obgr_seneca wrote:But of course you can choose a more difficult way as well :D


Yes you could, but why would you? And that's why I showed the simple way to do this.

Regarding the later responses above that suggest making the file immutable w/chattr, yes, you can do that too, but I would caution against "Setting it and forgetting it". If you know that wherever you go, that's the way you want the file to be, then yes, go ahead, I would feel more comfortable using either dhclient or the /etc/resolv.conf.head and /etc/resolv.conf.tail files I mentioned above, which are designed precisely for this very purpose.

Valid entries in /etc/resolv.conf also include *search*, and *domain* directives, but those are outside the scope of the OP's question, and further, "OpenDNS" is NOT a valid entry. I suspect that what viking60 intended was to have that line read "# OpenDNS nameservers"

Manipulating /etc/resolv.conf is indeed the quickest and easiest way to affect the use of Google DNS, and chattr will lock it for you (but you might forget you did that when/if it causes a problem at a WiFi hotspot that enforces a captive portal system for initial permission to surf the Internet),

I recommend the following read which will show you how to set up your machine to accept a dynamic IP address, while allowing you to keep your hostname/domain of choice, and choose the DNS servers that you prefer: https://calomel.org/dhclient.html

I hope that helps :)

Kindest regards,

.
Registered Linux User #190795

- "Ask Bill why the string in [MS-DOS] function 9 is terminated by a dollar sign. Ask him, because he can't answer. Only I know that." - Dr. Gary Kildall.
User avatar
tallship
 
Posts: 14
Joined: Apr 6th, '11, 10:35
Location: On the Beaches of Super Sunny Southern California USA

Re: Using Google Public DNS - How?

Postby doktor5000 » Apr 27th, '12, 20:42

tallship wrote:
obgr_seneca wrote:What about opening the network center in the mcc and setting the dns manually?


Because it doesn't address the issue. You only get to choose between static and dynamic allocation. The matter at hand deals with how to change your resolver to use Google DNS on a DHCP client.


Seems you're mixing up DHCP and DNS here. It's dead-easy to untick the checkbox "Receive DNS-servers via DHCP" and manually supply any DNS servers you want. But feel free to make your life more difficult.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18017
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Using Google Public DNS - How?

Postby codegazer » Dec 24th, '12, 00:52

If your machine gets it's IP address automatically from a DHCP server then you need to update the DHCP server's config to include 8.8.8.8 and/or 8.8.4.4 for DHCP clients.
Typical home wireless access points are DHCP servers and it's a matter of connecting to the administrative interface of the WAP and configuring DHCP server.

If you have no permission to modify the DHCP server config then you can modify the client side to ignore the DNS config sent out by the DHCP server.
For example, if you are connected on ethernet (device is "eth0"), you can edit /etc/sysconfig/network-scripts/ifcfg-eth0 and set PEERDNS=no.
Then edit /etc/resolv.conf and insert:

nameserver 8.8.8.8
nameserver 8.8.4.4

However, setting PEERDNS=no means that as you move, say your laptop, from network to network it will ignore whatever DNS config the DHCP server has to offer.
This may lead to confusion if you moved from a home network to an organization's Intranet network (because the Google DNS servers will have no DNS data for the internal network of the organization).

If you just edit etc/resolv.conf only then when the DHCP lease expires and is renewed the your edit of /etc/resolv.conf will be automatically overwritten (with default "PEERDNS=yes").
User avatar
codegazer
 
Posts: 22
Joined: Mar 30th, '11, 00:48

Re: Using Google Public DNS - How?

Postby tallship » Dec 24th, '12, 01:05

Those are some very good points not yet covered in this thread :)

Thanks for the contrib @codegazer!

Kindest regards,

.
Registered Linux User #190795

- "Ask Bill why the string in [MS-DOS] function 9 is terminated by a dollar sign. Ask him, because he can't answer. Only I know that." - Dr. Gary Kildall.
User avatar
tallship
 
Posts: 14
Joined: Apr 6th, '11, 10:35
Location: On the Beaches of Super Sunny Southern California USA


Return to Networking

Who is online

Users browsing this forum: No registered users and 1 guest