Link to home
Start Free TrialLog in
Avatar of Alexandre Takacs
Alexandre TakacsFlag for Switzerland

asked on

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 ?
Avatar of Sjizzel
Sjizzel
Flag of Netherlands image

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

Avatar of Alexandre Takacs

ASKER

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".
Avatar of legolasthehansy
legolasthehansy

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
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].
ASKER CERTIFIED SOLUTION
Avatar of Alexandre Takacs
Alexandre Takacs
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Self solved