Slackware HowTo

Configure hostname and /etc/hosts on Slackware

Set a consistent host name and clean local resolution for services, shells, and logs.

1. When to use it

Useful when the server shows inconsistent names between prompt, logs, local DNS, and network applications.

HOSTNAME | hosts | FQDN | getent | ping

2. Base setup

echo "server01" > /etc/HOSTNAME
printf '127.0.0.1 localhost\n127.0.1.1 server01.example.lan server01\n' > /etc/hosts
hostname server01

Adjust host names, IPs, interfaces, paths, and versions to the real system before making the change persistent.

3. Quick verification

hostname
hostname -f
getent hosts server01

Confirm that the output matches the expected state before considering the intervention complete.

4. Operational notes

Keep the same FQDN in internal DNS, mail, and monitoring to avoid ambiguity.

Quick checklist

[ ] Steps completed\n[ ] Config updated\n[ ] Tests executed\n[ ] Rollback ready\n[ ] Logs checked

Back to Linux HowTo