Skip to main content

Testing DNS Resolution

Hands-On Lab


Photo of Kenny Armstrong

Kenny Armstrong

Linux Training Architect II in Content





A Linux system administrator is expected to know how to configure a system's DNS settings. Nearly all modern Linux distributions use NetworkManager to handle a host's DNS settings. In this learning activity, we will utilize the nmcli utility to configure our DNS resolution.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Testing DNS Resolution


In this hands-on lab, we will utilize the nmcli utility to configure our DNS resolution.


Open a terminal session, and log in via SSH using the credentials provided on the lab page.

Review Current DNS Configuration

  1. See if the system can resolve hostnames to IP addresses:


    Note that the command times out.

  2. Check to see what DNS server entries we have in the /etc/resolv.conf file:

    cat /etc/resolv.conf

    Note that we do not have any DNS entries listed.

  3. Review our network connections:

    nmcli con show
  4. Our default connection name should be System eth0. Review our DNS IP settings:

    nmcli -f ipv4.dns con show "System eth0"

    This system obviously does not have any DNS servers configured for use.

Configure Your System to Use Your Network's DNS

  1. Modify the system's default connection to use the network's DNS server:

    sudo nmcli con mod "System eth0" ipv4.dns ""
  2. Verify the settings using the nmcli command and then checking the /etc/resolv.conf file:

    nmcli -f ipv4.dns con show "System eth0"
    cat /etc/resolv.conf
  3. We need to reactivate the system's network connection for the change to take effect:

    sudo nmcli con up "System eth0"
  4. Verify our settings once more:

    cat /etc/resolv.conf
  5. Now, attempt to resolve a hostname to an IP address:


    Our system should be able to resolve an IP address for the domain name.


Congratulations on completing this hands-on lab!