ITNuvoAkademiya
Academy homePackagesPlaylistsToolsSubnet calculatorSearchGlossary
CiscoCCNA · CCNA: networking fundamentals1. Introduction2. Network Fundamentals3. Network Access4. IP Connectivity5. IP Services6. IPv67. Security Fundamentals8. AutomationCCNP: Enterprise networks · coming soon
LinuxLinux: system administrator üçün · Linux for system administrators1. Getting to know Linux2. Working with text3. Users and permissions4. Processes and packages5. Inside the system6. Monitoring and logs7. NetworkingRed Hat Enterprise Linux · Red Hat Enterprise Linux: from beginner to advanced1. Getting started2. Packages3. Users and permissions4. SELinux5. Services6. Storage7. Networking8. Building services9. Boot and recovery10. DevOps11. Security and monitoring
FortinetFortiGate Administrator · FortiGate Administrator: from first login to ZTNA1. Getting to know FortiGate2. Routing, policy and NAT3. Security profiles4. Users and logs5. Resilience, SD-WAN and automation6. VDOM7. VPN and ZTNA8. Proxy9. DMZ
MonitoringZabbix · Zabbix: from installation to alerts1. Introduction2. Installation and the database3. Basics: groups, templates, users4. Connecting devices5. Alerts, Grafana and the API
VirtualizationProxmox VE · coming soonVMware ESXi · coming soon
My account / Sign in
AZENRU
← itnuvo.com

Hostname, /etc/hosts, chrony (time)

Lesson 7.27 minIntermediateDecember 1, 2026
Open

This lesson is open to everyone. The other lessons open with a package: sign in or sign up, then choose a package.

Key points

  • hostnamectl set-hostname srv-web01.itnuvo.local — a permanent name (written to /etc/hostname).
  • Write your own name and important neighbours in /etc/hosts: 10.20.0.15 srv-web01.itnuvo.local srv-web01.
  • RHEL's time service is chronyd; its configuration is /etc/chrony.conf: server ntp.itnuvo.local iburst.
  • Checking: chronyc sources -v (^* — the selected source), chronyc tracking, timedatectl.
  • timedatectl set-timezone Asia/Baku; timedatectl set-ntp true turns synchronisation on.

Hostname

srv-web01
[ali@srv-web01 ~]$ hostnamectl
 Static hostname: srv-web01.itnuvo.local
       Icon name: computer-vm
         Chassis: vm
      Machine ID: 4b1c0e2a9d7f4e3c8a6b5d2e1f0a9c8b
         Boot ID: 9c8b7a6f5e4d3c2b1a0f9e8d7c6b5a4f
  Virtualization: kvm
Operating System: Red Hat Enterprise Linux 9.4 (Plow)
          Kernel: Linux 5.14.0-427.13.1.el9_4.x86_64
    Architecture: x86-64
[ali@srv-web01 ~]$ sudo hostnamectl set-hostname srv-web01.itnuvo.local
[ali@srv-web01 ~]$ cat /etc/hostname
srv-web01.itnuvo.local

hostnamectl set-hostname takes effect immediately and is written to /etc/hostname — no reboot needed. The prompt shows the new name in a new session. In the simulator, the ITNuvo badge stays next to the name.

A change with the hostname command (hostname new-name) is temporary — in RHCSA always use hostnamectl.

/etc/hosts

srv-web01
[ali@srv-web01 ~]$ cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.20.0.15  srv-web01.itnuvo.local srv-web01
10.20.0.20  srv-db01.itnuvo.local  srv-db01
10.20.0.50  client01.itnuvo.local  client01
[ali@srv-web01 ~]$ getent hosts srv-db01
10.20.0.20      srv-db01.itnuvo.local srv-db01

Format: IP full_name short_name. Write the full name first, then the alias — hostname -f takes the full name from here. Useful so important servers can find each other until DNS is set up, or when DNS fails.

chrony: time synchronisation

On RHEL the NTP client and server is chronyd (the old ntpd is gone):

srv-web01
[ali@srv-web01 ~]$ timedatectl
               Local time: Tue 2026-12-01 15:42:10 +04
           Universal time: Tue 2026-12-01 11:42:10 UTC
                 RTC time: Tue 2026-12-01 11:42:10
                Time zone: Asia/Baku (+04, +0400)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no
[ali@srv-web01 ~]$ grep -E "^(server|pool)" /etc/chrony.conf
pool 2.rhel.pool.ntp.org iburst

In a company, servers usually connect to an internal NTP server rather than the internet pool. The RHCSA task: "the server must get its time from ntp.itnuvo.local":

srv-web01
[ali@srv-web01 ~]$ sudo sed -i 's/^pool /#pool /' /etc/chrony.conf
[ali@srv-web01 ~]$ echo "server ntp.itnuvo.local iburst" | sudo tee -a /etc/chrony.conf
[ali@srv-web01 ~]$ sudo systemctl restart chronyd
[ali@srv-web01 ~]$ chronyc sources -v
  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current best, '+' = combined, '-' = not combined,
| /             'x' = may be in error, '~' = too variable, '?' = unusable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||      Reachability register (octal) -.           |  xxxx = adjusted offset,
||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
||                                \     |          |  zzzz = estimated error.
||                                 |    |           \
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^* ntp.itnuvo.local              2   6    17    12   -214us[ -310us] +/-   18ms
ColumnMeaning
^*A server, the currently selected source — synchronisation works
^?Unreachable — a DNS, firewall or server problem
StratumThe source's "depth": 1 — a server tied to an atomic clock
ReachSuccess of the last 8 queries (octal); 377 — all succeeded
Last sampleThe offset and error
srv-web01
[ali@srv-web01 ~]$ chronyc tracking | grep -E "Reference ID|System time|Leap status"
Reference ID    : 0A14000A (ntp.itnuvo.local)
System time     : 0.000214 seconds slow of NTP time
Leap status     : Normal

iburst — send several queries quickly at the start so synchronisation is fast.

Making chrony an NTP server

One server can be the NTP server for the internal network:

srv-web01
[ali@srv-web01 ~]$ echo "allow 10.20.0.0/24" | sudo tee -a /etc/chrony.conf
[ali@srv-web01 ~]$ sudo systemctl restart chronyd
[ali@srv-web01 ~]$ sudo firewall-cmd --permanent --add-service=ntp && sudo firewall-cmd --reload

Without allow, chronyd is only a client.

Time zone

srv-web01
[ali@srv-web01 ~]$ timedatectl list-timezones | grep -i baku
Asia/Baku
[ali@srv-web01 ~]$ sudo timedatectl set-timezone Asia/Baku
[ali@srv-web01 ~]$ sudo timedatectl set-ntp true

Some servers run in UTC (so logs are easy to compare) — that depends on company policy. What matters is that they are all in sync.

Lab: name and time

In the Red Hat simulator and on your own VM:

  1. Set srv-web01's full name to srv-web01.itnuvo.local and check with hostnamectl.
  2. Write the three machines' lines in /etc/hosts and check with getent hosts srv-db01.
srv-web01
[ali@srv-web01 ~]$ sudo hostnamectl set-hostname srv-web01.itnuvo.local
[ali@srv-web01 ~]$ hostnamectl | head -n 1
[ali@srv-web01 ~]$ getent hosts srv-db01
  1. (On your own VM) comment out the pool in /etc/chrony.conf, add server ntp.itnuvo.local iburst (or your company's NTP), run systemctl restart chronyd and see ^* in chronyc sources.
  2. Set the time zone to Asia/Baku.

Check: hostname → srv-web01.itnuvo.local; ^* in chronyc sources; timedatectl → synchronized: yes.

Check yourself

5 questions · answers are shown instantly · 3 correct answers complete the lesson

1Which command changes the hostname permanently?

The hostname command is temporary.

2Which service synchronises time on RHEL?

The configuration file is /etc/chrony.conf.

3What does ^* mean in chronyc sources?

^? means unreachable.

4What does chronyd need to serve time to other servers?

Without allow, chronyd is only a client.

5What is the right order of names in an /etc/hosts line?

hostname -f takes the full name from the first name.
Was this lesson useful?

Comments

Sign in to comment.