28

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?

4

3 Answers 3

28

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.

6
  • 3
    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! Oct 8, 2012 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, 2014 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. Jul 11, 2014 at 18:45
  • 1
    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
    – user12205
    Jan 8, 2015 at 12:53
  • 3
    nm-tool seems to be gone in 15.04. nmcli dev show gives similar information.
    – itsadok
    Apr 30, 2015 at 17:44
16

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

Connection Information Screenshot

2

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
2
  • 1
    This only show the configurations about the network. Not the leased IP and running DNS settings I get from DHCP. Oct 8, 2012 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, 2012 at 8:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .