How to setup dns resolver in Ubunut 12 server ?

My first Precise Pangolin deployment.

I'm having issues with dns resolution not working - turns out /etc/resolv.conf is not anymore the place to manage this.

I tried to add “dns-nameservers”, “dns-search” and “dns-domain” entries in /etc/network/interfaces but they don't seem to work either (no server could be reached error, although I can ping those listed with dns-nameservers.

My interfaces files reads

auto eth0
iface eth0 inet static
address 172.16.200.50
netmask 255.255.255.0
gateway 172.16.200.1
dns-nameservers 172.16.200.25 172.16.100.5
dns-search mydomain.local

If I do a host xxx.domain.com 172.16.200.25 it works - it's just that there is a config problem with default resolvers.

What am I missing ?
LVL 1
Alexandre TakacsCTOAsked:
Who is Participating?
 
Alexandre TakacsConnect With a Mentor CTOAuthor Commented:
I managed to have it working by creating /etc/resolvconf/resolv.conf.d/tail file and manually inserting "nameserver x.x.x.x". This is being carried over into the "dynamically assembled" resolv.conf and allows for successful dns resolution. Obviously not the intended behavior but at least I can get things moving now...
0
 
SjizzelCommented:
can you please post the contents of your /etc/resolv.conf file?

should be something like

nameserver 172.16.200.25
search mydomain.local

Open in new window


can you also post the output of the command 'dig'?
should be something like:


; <<>> DiG 9.8.1-P1 <<>>
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55303
;; flags: qr rd ra; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;.                              IN      NS

;; ANSWER SECTION:
.                       2816    IN      NS      f.root-servers.net.
.                       2816    IN      NS      j.root-servers.net.
.                       2816    IN      NS      m.root-servers.net.
.                       2816    IN      NS      e.root-servers.net.
.                       2816    IN      NS      h.root-servers.net.
.                       2816    IN      NS      a.root-servers.net.
.                       2816    IN      NS      c.root-servers.net.
.                       2816    IN      NS      l.root-servers.net.
.                       2816    IN      NS      d.root-servers.net.
.                       2816    IN      NS      g.root-servers.net.
.                       2816    IN      NS      b.root-servers.net.
.                       2816    IN      NS      k.root-servers.net.
.                       2816    IN      NS      i.root-servers.net.

;; Query time: 3 msec
;; SERVER: 172.16.200.25#53(172.16.200.25)
;; WHEN: Thu Aug 16 12:19:16 2012
;; MSG SIZE  rcvd: 228

Open in new window

0
 
Alexandre TakacsCTOAuthor Commented:
The  /etc/resolv.conf reads "#DO NOT EDIT THIS FILE" and has one entry "dns-search mydomain.local" (presumably carried over from the interfaces directives).

As for "dig" it times out with an error "no servers could be reached".
0
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

 
legolasthehansyCommented:
Wow - They changed the location of the resolvers on Ubuntu?
According to this file, you are right on the money on making changes to /etc/network/interfaces according to this link
http://www.stgraber.org/2012/02/24/dns-in-ubuntu-12-04/

Is your DNS server up?
Can you try putting 8.8.8.8 on this file and see if DNS works first
0
 
Alexandre TakacsCTOAuthor Commented:
Yes my DNS are working ok if I specify them in a "host" lookup. Just that somehow - despite my settings above - the system does not seem to know how to resolve by itself. Although a server it does not have BIND installed and don't really plan to.

As an aside what was the rationale behind removing support for /etc/resolv.conf ? I'm sure it's not just to annoy long time users... [Edited: ok I have followed some of the links above and better understand the change although not 100% convinced].
0
 
Alexandre TakacsCTOAuthor Commented:
Self solved
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.