Ubuntu 18.04 LTS has been released with a lot of change. Network configuration is now managed by NetPlan by default. In order to change the ubuntu network configuration, you have to know how to use NetPlan. What is NetPlan? Netplan is a utility for easily configuring networking on a linux system.
Working with Ubuntu 18.04 Server LTS. I am trying to find a way to check the DNS IP(s) that is actually being used when set via DHCP. The resolv.conf only will point to 127.0.0.53 now. /etc/systemd/network folder is empty. The NSLOOKUP output also always references the internal 127.0.0.53 IP.
Seems all the old tricks aren't working.The Ubuntu documentation is not updated yet as it still looks like the help for 16.04 referencing eth0, ifup and ifdown which are all deprecated on 18:I've tried setting a static adapter setup with Netplan via a custom.yaml. The settings work fine but I can't seem to find the DNS IP that I set anywhere. I expect it will be consistent between DHCP and static settings but I'm not sure where to look now.I would settle for either a C library call or a bash CLI method at this point. Does anyone have a way to check this on 18.04 Server? Another way is: cat /run/systemd/resolve/resolv.confThat file is dynamically generated by systemd-resolved, but contains the actual DNS servers instead of 127.0.0.53.In fact, if you want make that the default for /etc/resolv.conf, you simply create symlink for it. ( /etc/resolv.conf is a symlink that points to /run/systemd/resolve/stub-resolv.conf by default): sudo mv /etc/resolv.conf /etc/resolv.conf.origsudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.confSample /run/systemd/resolve/resolv.conf: # This file is managed by man:systemd-resolved(8). Do not edit.## This is a dynamic resolv.conf file for connecting local clients directly to# all known uplink DNS servers.
This file lists all configured search domains.## Third party programs must not access this file directly, but only through the# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,# replace this symlink by a static file or a different symlink.## See man:systemd-resolved.service(8) for details about the supported modes of# operation for /etc/resolv.conf.nameserver 10.1.2.3search host.domain.comFor more info.
I am suprised at this too. I am running Ubuntu 16.04 LTS and see something similar.If you issue a dig www.google.ca +trace grep 'Received'The first host in the response is the one doing the lookups for your server. $ dig www.google.ca +trace grep 'Received';; Received 525 bytes from 127.0.1.1#53(127.0.1.1) in 19 ms;; Received 42 bytes from 199.7.91.13#53(d.root-servers.net) in 32 msThis means that this box is doing it's own dns lookups directly to the root servers and following the path recursively to get my dns lookups.Found the issue is that dnsmasq is enabled. To disable it do as follows.edit the NetworkManager.conf file sudo gedit /etc/NetworkManager/NetworkManager.confcomment out the dnsmasq line #dns=dnsmasqrestart the network-manager service sudo /etc/init.d/network-manager restartthen verify that it is using the dns-server assigned via dhcp $ dig www.google.ca +trace grep 'Received';; Received 525 bytes from 192.168.30.1#53(192.168.30.1) in 18 ms;; Received 42 bytes from 198.41.0.4#53(a.root-servers.net) in 32 ms. Yes, Ubuntu has had an internal listening scheme on port 53 but it is supposed to use the DNS servers issued by DHCP. With the changes it looks like it now creates a new internal loopback IP of 127.0.0.53 as well for another loopback path.
Resolv.conf and other methods used to report the IP(s) being used. That is what I am looking for, the IP(s) the the DHCP has issued for the external DNS lookup.
I hope someone doesn't think that a device would always have an open connection to the internet and use the top level DNS servers that it might never be able to access.–May 14 '18 at 10:48.