Hands-on Lab·Red Hat Certified System Administrator
Hostname and Name Resolution
One objective, and one tool choice that matters more than it looks: dig and host query DNS directly and ignore /etc/hosts, so they can report a failure for a name that resolves perfectly well. getent hosts uses the same path an application does.
Basic Networking Guide 50 of 67 Beginner
- OSRHEL 10.0
- Kernel6.12.0-55.9.1.el10_0
- dnf4.20.0
- Flatpak1.16.0
- TimeAbout 12 min
/etc/resolv.conf is generated by NetworkManager on RHEL. Editing it by hand works until the next connection change overwrites it. The durable setting is ipv4.dns on the connection profile.
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| RHCSA-A01 | 192.168.0.31 | RHEL 10.0 | Practice node (graded) - spare /dev/sda | 2 Core | 4 GB | 50 GB + 15 GB |
This guide includes
Use this for one objective where the tool choice matters more than it looks. This matters because a name can resolve for an application and not for the tool you tested with - they do not consult the same sources.
- reading and setting the hostname
- finding where a name is actually looked up
- using the tool that tells you the truth about this machine
- setting DNS from the connection profile
Before you start
- A sudo-capable account.
- The session appends one line to
/etc/hostsand removes it.
-
The hostname
-
Where a name is looked up
-
The tool that tells you the truth
-
DNS from the connection profile