Names and Name Servers in Linux

Name resolution is the process of turning a hostname into an IP address. When a Linux machine cannot reach a host by name, check DNS settings before assuming the network itself is down.

Check resolver configuration

cat /etc/resolv.conf

This shows the name servers currently being used by the system. On many modern distributions this file may be managed by NetworkManager or systemd-resolved.

Test DNS lookup

getent hosts example.com
nslookup example.com
dig example.com

getent hosts is useful because it follows the system name-service configuration, not just DNS.

Local host entries

cat /etc/hosts

Use /etc/hosts carefully. It is useful for local overrides, but stale entries can also hide DNS changes.

Leave a Comment