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?

Koala Yeung
  • 1,001

3 Answers3

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.

jdthood
  • 12,467
idgar
  • 2,890
  • 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!

    – Koala Yeung Oct 08 '12 at 03: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 '14 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 '14 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 08 '15 at 12:53
  • 3
    nm-tool seems to be gone in 15.04. nmcli dev show gives similar information. – itsadok Apr 30 '15 at 17:44
  • As ace mentioned, tail will often not show what you want. Either use grep, or less to see everything. Maybe the answer should be edited. – mivk Nov 05 '15 at 15:06
16

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

Connection Information Screenshot

Vipin Verma
  • 5,454
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
Peachy
  • 7,117
  • 10
  • 38
  • 46
  • 1
    This only show the configurations about the network. Not the leased IP and running DNS settings I get from DHCP. – Koala Yeung Oct 08 '12 at 03: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 08:45