Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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)

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
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 '14 at 4:29
You may like [NetworkManager - Community Help Wiki][1] [1]: – Pierre Thibault Apr 1 '14 at 4:34
A similar question for Ubuntu 14.04 and later:… – Koala Yeung Jun 18 '15 at 5:13
up vote 27 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
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
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 '14 at 15:51
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 '14 at 18:45
Instead of tail I would pipe it through grep DNS. tail would not work if you have multiple network interfaces but only using one of them. E.g. if you have wlan0 and eth0, but only using wlan0 – ace Jan 8 '15 at 12:53
nm-tool seems to be gone in 15.04. nmcli dev show gives similar information. – itsadok Apr 30 '15 at 17:44

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

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
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
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 to handle DNS queries. (In Ubuntu 12.10 the address is 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

Your Answer


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.