How do I add a DNS server via resolv.conf?
How do I add a DNS server via resolv.conf?
The Question: Is /etc/resolv.conf useless in http://en.wikipedia.org/wiki/
List_of_Ubuntu_releases#Ubuntu_12.04_LTS_.28Precise_Pangolin.29 (Precise
Pangolin)?
I see that the DNS server information is stored in http://en.wikipedia.org/
wiki/NetworkManager now. The nmcli command line tool can list that for you.
If I want to add one more http://en.wikipedia.org/wiki/Domain_Name_System
server, will adding it to /etc/resolv.conf by using the resolvconf package
help?
Solutions Sample (Please watch the whole video to see all solutions, in order of how many people found them helpful):
== This solution helped 8 people ==
Note: This answer was for a rather different, pre-merge version of the
Question, with a focus only on pre-pending a desired name-server.
This works pre-12.04:
Edit /etc/dhcp3/dhclient.conf and add :
prepend domain-name-servers 127.0.0.1;
(In fact, this line is already present ; all you need to do is un-comment it.)
== This solution helped 88 people ==
It sounds like you are talking about the resolvconf package.
Install the http://apt.ubuntu.com/p/resolvconf package.
Run
cd /etc/resolvconf/resolv.conf.d
sudo cp -p head head.orig #backup copy, always do this
sudo nano head
The top of the file is a scary warning. The file /etc/resolv.conf is
autogenerated from the contents of this file; the warning is there so it will
get put in /etc/resolv.conf when /etc/resolv.conf is generated. To the end of
the file, add
nameserver <ip_of_nameserver>
Press Ctrl x and answer yes to saving the file. To finish up, regenerate /etc/
resolv.conf so the changes are applied right now:
sudo resolvconf -u
Then check the contents of /etc/resolv.conf to see the line you added is now
there. Further, it will still be there the next time your machine boots or your
network service is restarted, whichever comes first.
== This solution helped 133 people ==
If /etc/resolv.conf contains nameserver 127.0.0.1 then adding entries to /etc/
resolvconf/resolv.conf.d/tail won’t really do anything useful.
If you are using NetworkManager then you should instead statically add
nameserver addresses via network indicator: Edit Connections… | Edit… |
IPv4 Settings | Additional DNS servers.
If you really want to add more entries to /etc/resolv.conf, create a /etc/
resolvconf/resolv.conf.d/tail and add them there.
As with every Ubuntu release, it’s recommended to read the Ubuntu Release
Notes, available here:
* https://wiki.ubuntu.com/PrecisePangolin/ReleaseNotes/UbuntuDesktop
The Desktop and Common Infrastructure sections contain a link to
* http://www.stgraber.org/2012/02/24/dns-in-ubuntu-12-04/ covering the
changes to the DNS infrastructure in 12.04.
With thanks & praise to God! With thanks to the many people who have made this project possible! | Content (except music & images) licensed under cc by-sa 3.0 | Music: https://www.bensound.com/royalty-free-music | Images: https://stocksnap.io/license & others | With thanks to user stgraber (https://askubuntu.com/users/24511), user Steven Collins (https://askubuntu.com/users/266326), user Roy Rogers (https://askubuntu.com/users/300419), user Randall Cook (https://askubuntu.com/users/61827), user PnotNP (https://askubuntu.com/users/59792), user Peter Mortensen (https://askubuntu.com/users/10883), user Mark (https://askubuntu.com/users/98061), user Kevin J. Rice (https://askubuntu.com/users/79004), user Joseph Mituzas (https://askubuntu.com/users/65689), user jdthood (https://askubuntu.com/users/29569), user Jase (https://askubuntu.com/users/52139), user Izzy (https://askubuntu.com/users/68291), user Ivan (https://askubuntu.com/users/141564), user guntbert (https://askubuntu.com/users/134729), user Frank Barcenas (https://askubuntu.com/users/32933), user enedil (https://askubuntu.com/users/170825), user Don Chai (https://askubuntu.com/users/141558), user Dan B (https://askubuntu.com/users/93708), user bshea (https://askubuntu.com/users/169878), user Braiam (https://askubuntu.com/users/169736), user belacqua (https://askubuntu.com/users/8844), user Azendale (https://askubuntu.com/users/9308), user Anne van Rossum (https://askubuntu.com/users/103423), user Adige72 (https://askubuntu.com/users/128044), and the Stack Exchange Network (http://stackoverflow.com/questions/130452). Trademarks are property of their respective owners. Disclaimer: All information is provided “AS IS” without warranty of any kind. You are responsible for your own actions. Please contact me if anything should be amiss at Roel D.OT VandePaar A.T gmail.com.
by Roel Van de Paar
linux dns server