6

So the Ubuntu server is configured with netplan and the renderer is: networkd.

How does one see the active DNS Server ? i.e. there is no NetworkManager.

3 Answers3

10

When using netplan (17.10 Artful Ardvark on) and the renderer is: networkd, there is no NetworkManager so the nmcli commands do not apply. The cat /etc/resolv.conf simply shows the nameserver to be 127.0.0.53, not very helpful really ;-)

To get the nameservers.

ubuntu@ub-17-10:~$ systemd-resolve --status | sed -n '/DNS Servers/,/^$/p'
         DNS Servers: 192.168.92.201
                      8.8.8.8
          DNS Domain: netlabsug.tst
0

An alternative is to use

netplan ip leases eno1

where eno1 is your interface name.

# This is private data. Do not parse.
ADDRESS=192.168.a.b
NETMASK=255.255.255.0
ROUTER=192.168.a.d
SERVER_ADDRESS=192.168.a.d
NEXT_SERVER=192.168.a.d
T1=10800
T2=18900
LIFETIME=21600
DNS=192.168.a.d
NTP=192.168.a.d
CLIENTID=...
0

You can type this if netplan is used :

$ netplan get | sed -n '/nameservers:/,$ p'
      nameservers:
        addresses:
        - X.Y.Z.T
        search:
        - myLAN.lan
      gateway4: A.B.C.D
SebMa
  • 2,291