Thursday, May 9, 2024
 Popular · Latest · Hot · Upcoming
17
rated 0 times [  17] [ 0]  / answers: 1 / hits: 19175  / 1 Year ago, wed, may 24, 2023, 5:48:46

I sometimes switch DNS servers, using the NetworkManager indicator in the taskbar; this worked fine with previous versions, and actually works fine with 12.04, too, except for one thing: I use Conky to display some system information, including the DNS address, and I noticed that it is now always displaying 127.0.0.1.



I looked in resolv.conf, which is where it gets this address, and sure enough, that's what it always says. I has a single line, with the admonishment not to edit the file by hand:



nameserver 127.0.0.1


The only way I know to check the DNS server address now is to open the network manager GUI to check the info page. So, where is this information stored now?


More From » 12.04

 Answers
7

The information is managed internally by Network Manager. You can get this information on the command line using the included nmcli tool.



You can retrieve Network Manager's information for a particular network interface with the following command:



nmcli dev list iface eth0


(replace eth0 with the interface you are connecting with). The output will include information about the interface and the currently active connection on that interface:



GENERAL.DEVICE:                         eth0
GENERAL.TYPE: 802-3-ethernet
...
IP4.DNS[1]: 192.168.0.1
...


It shouldn't be too difficult to extract the information you are after from this output.



If you need a programmatic method of accessing this data that doesn't rely on the output of nmcli, this information should also be available from Network Manager's D-Bus interface.


[#38882] Wednesday, May 24, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
impisaso

Total Points: 423
Total Questions: 106
Total Answers: 104

Location: Virgin Islands (U.S.)
Member since Tue, Feb 2, 2021
3 Years ago
;