How to Set Up and Synchronize NTP Across Multiple Linux Web Servers
This guide walks you through checking NTP status, viewing peers, manually syncing time, starting and enabling the NTP daemon at boot, verifying auto‑start, and customizing NTP servers to keep clocks consistent across many web servers.
Why synchronize time across web servers
When you operate several web servers, their system clocks must stay aligned; the Network Time Protocol (NTP) service ensures consistent timestamps for logs, authentication, and distributed processes.
Step 1: Check NTP status
Run ntpstat. If the output is Unable to talk to NTP daemon. Is it running? , the daemon is not running and should be configured to start on boot. If you see lines such as synchronised to NTP server (198.55.111.5) at stratum 3 , the service is already working. If the output contains unsynchronised , restart the daemon with service ntpd restart to re‑establish synchronization.
Step 2: View NTP peer list
Use ntpq -p to display the list of NTP servers the host is contacting.
Step 3: Manually synchronize time
Execute ntpdate. If you receive the NTP socket is in use. exiting , stop the running daemon first: service ntpd stop, then run ntpdate cn.pool.ntp.org. A successful run prints messages such as adjust time server xxx .
Step 4: Start the NTP service
Start the daemon with service ntpd start. The command should return [ OK ]. To ensure the service starts automatically after a reboot, enable it with chkconfig ntpd on.
Step 5: Verify auto‑start configuration
Run chkconfig --list ntpd. The output should indicate that ntpd is enabled for runlevels 2, 3, 4, and 5 (e.g., ntpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off ), confirming correct boot‑time activation.
Step 6: Customize NTP servers
Edit the NTP configuration file (commonly /etc/ntp.conf) to add or replace server entries with the addresses of preferred time sources. After editing, restart the daemon to apply changes.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
ITPUB
Official ITPUB account sharing technical insights, community news, and exciting events.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
