Practical steps to name your machine and make name resolution reliable on modern Linux systems. 15.11.2025 | reading time: 3 min Give your Linux host a correct name and reliable DNS and services will find it; get this wrong and troubleshooting eats time. This short guide shows concrete commands and file edits to set a static hostname, add local host mappings, and inspect or set DNS servers on systems using systemd. Hands-on lab Try this sequence on a test VM to see changes immediately. ```bash # set a static hostname sudo hostnamectl set-hostname web01.example.local # verify the static hostname hostnamectl status --static Static hostname: web01.example.local # add a local host mapping so the name resolves without DNS echo "192.168.1.10 web01.example.local web01" | sudo tee -a /etc/hosts # inspect DNS as managed by systemd-resolved resolvectl status Global LLMNR setting: no MulticastDNS setting: no DNSOverTLS setting: no Global DNS Servers: 8.8.8.8 Link 2 (eth0) Current Scopes: DNS DNS Servers: 192.168.1.1 ``` Practical variations Static, transient and pretty hostnames exist; use `hostnamectl` for static names and transient names last only until reboot. Put IP-to-name pairs in `/etc/hosts` for local overrides; rely on DHCP when you want centrally managed DNS and use `resolvectl` or `nmcli` to inspect or set per-link DNS on systemd/NetworkManager systems. When things diverge If `/etc/resolv.conf` is a symlink to systemd files, edit the resolver configuration via systemd-resolved or NetworkManager rather than editing `/etc/resolv.conf` directly; check `/etc/nsswitch.conf` to see whether hosts lookups prefer files, dns, or mdns. DNS caching services like dnsmasq or nscd can hide changes, so restart them when results look stale. Other tools worth using Use `dig` or `host` to test DNS resolution and `ping` or `getent hosts` to verify name-to-IP mapping; `nmcli` configures connections when NetworkManager is present; `resolvectl` is the right tool on systemd-resolved systems. Final perspective A predictable hostname and clear DNS configuration cut troubleshooting time and make automation reliable; start small, test locally, then integrate DHCP and management tools. Keep exploring Linux networking—consider formalizing skills with certifications like CompTIA Linux+ or LPIC-1 and intensive exam preparation at bitsandbytes.academy. Join Bits & Bytes Academy First class LINUX exam preparation. network setup troubleshooting