Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

We used to get current DNS settings by:

  cat /etc/resolv.conf

But Ubuntu 12.04 has changed to use the resolvconf framework. The above commond will only give me this:

  # 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
  nameserver 127.0.0.1

And that is not the current DNS settings of my machine.

So, is there any kind of file or command I can refer to?

share|improve this question
2  
Is that a desktop or a server? –  mikewhatever Oct 6 '12 at 8:23
    
Can we a solution for a none desktop environment? –  Pierre Thibault Apr 1 at 4:29
    
You may like [NetworkManager - Community Help Wiki][1] [1]: askubuntu.com/questions/152593/command-line-to-list-dns-servers –  Pierre Thibault Apr 1 at 4:34

3 Answers 3

up vote 18 down vote accepted

Let's assume that NetworkManager is managing your network configurations.

Run in terminal

nm-tool | tail -n 8

(Here tail is optional, just for your convenience.) This will tell you your connection information, similar to ipconfig.

share|improve this answer
1  
This works! I got the prefix, gateway, and DNS information of my current connection. I used to get all these by various commands (route -n, cat /etc/resolv.conf). Now nm-tools is the way. Great! Thanks! –  Koala Yeung Oct 8 '12 at 3:45
1  
Why are you using tail? If IPv6 is enabled, which it is on almost all modern distros, this strips off the DNS info the OP is explicitly looking for... –  Cerin Apr 28 at 15:51
1  
magnifico, if you are using a home office, the ip of the dns-server may very well be the same ip of the default gateway, which is often the router such as a belkin router. –  JohnMerlino Jul 11 at 18:45

In 12.04, NetworkManager is the manager of network connections by default.

This is why you have only the loopback address in resolv.conf.

Instead of looking into this file, check each of your network connections details in the following folder :

ls /etc/NetworkManager/system-connections/

and choose the connection you want to configure. For example I have "Wireless" connection in that folder

sudo vi /etc/NetworkManager/system-connections/Wireless
share|improve this answer
1  
This only show the configurations about the network. Not the leased IP and running DNS settings I get from DHCP. –  Koala Yeung Oct 8 '12 at 3:43
1  
The reason the loopback address is in resolv.conf is not just that NetworkManager is used. The reason is that a local nameserver is used. In Ubuntu 12.04 NetworkManager by default starts a dnsmasq process which listens on 127.0.0.1 to handle DNS queries. (In Ubuntu 12.10 the address is 127.0.1.1.) So the question is not what address the glibc resolver is using. The question is: To what addresses is the dnsmasq process forwarding its queries? It is this question which was correctly answered by idgar. –  jdthood Oct 29 '12 at 8:45

Go to the network connections next to the volume icon in the taskbar and click on Connection Information

Connection Information Screenshot

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.