How to Check DNS IP Server Settings in Ubuntu 18.04 Server

Dec 03, 2025 · Programming · 14 views · 7.8

Keywords: Ubuntu 18.04 Server | DNS | systemd-resolved | check method

Abstract: This article provides a comprehensive guide on checking DNS IP server settings in Ubuntu 18.04 Server, focusing on the impact of the systemd-resolved service that renders traditional methods obsolete. Presented in a technical blog style, it offers solutions using command-line tools and file inspection, including the systemd-resolve --status command and examining the /run/systemd/resolve/resolv.conf file, applicable to both DHCP and static network configurations for accurate DNS verification.

Introduction

In Ubuntu 18.04 Server, the integration of the systemd-resolved service has changed how DNS settings are managed, causing traditional methods like checking /etc/resolv.conf to often point only to the local address 127.0.0.53. This can be confusing when trying to verify actual DNS server IPs configured via DHCP or Netplan.

Using the systemd-resolve --status Command

The primary method for checking DNS servers is using the systemd-resolve --status command. This command displays detailed information about DNS servers organized by network links, including configured IP addresses.

systemd-resolve --status

The output includes a section labeled 'DNS Servers' under each link, showing the actual DNS server IPs. This approach works for both dynamic and static settings, effectively replacing older techniques.

Alternative Method: Examining the /run/systemd/resolve/resolv.conf File

Another method involves inspecting the dynamically generated file /run/systemd/resolve/resolv.conf. This file contains the actual DNS server addresses instead of the stub resolver.

cat /run/systemd/resolve/resolv.conf

To make this file the default for /etc/resolv.conf, you can create a symbolic link:

sudo mv /etc/resolv.conf /etc/resolv.conf.orig
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf

This provides a more direct access path but requires awareness of system management changes. Sample file content might look like this, showcasing actual DNS servers and search domains:

# 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.3
search host.domain.com

Conclusion

In summary, Ubuntu 18.04 Server uses the systemd-resolved service for DNS management, and checking DNS IP settings requires modern methods such as systemd-resolve --status or file inspection. These approaches ensure accurate verification of DNS configurations, adapting to system updates and providing reliable solutions for administrators.

Copyright Notice: All rights in this article are reserved by the operators of DevGex. Reasonable sharing and citation are welcome; any reproduction, excerpting, or re-publication without prior permission is prohibited.