The NTP service configuration may report a "localhost.localdomain timeout" error due to several reasons, such as incorrect NTP server settings, network connectivity issues, or misconfigured hostname resolution.
Incorrect NTP Server Configuration
localhost.localdomain as the server, it may fail because localhost typically refers to the local machine, which is not an NTP server unless the NTP daemon (ntpd or chronyd) is running locally.localhost.localdomain with a valid NTP server address (e.g., pool.ntp.org or a public NTP server like time.google.com).Example (for ntpd):
Edit /etc/ntp.conf and replace:
server localhost.localdomain
With:
server pool.ntp.org
Example (for chronyd):
Edit /etc/chrony.conf and replace:
server localhost.localdomain
With:
server pool.ntp.org
Network or DNS Resolution Issues
localhost.localdomain or connect to the NTP server due to network restrictions, the timeout occurs./etc/resolv.conf).ping or telnet to the NTP server (e.g., telnet pool.ntp.org 123).Local NTP Service Not Running
localhost.localdomain was mistakenly used as a placeholder for a local NTP server, but ntpd or chronyd is not running, the timeout occurs.systemctl start ntpd # For ntpd
systemctl start chronyd # For chronyd
Using Tencent Cloud NTP Service (Recommended for Cloud Environments)
time.tencent.com) for better synchronization and reliability.ntpd):server time.tencent.com
Example (for chronyd):
server time.tencent.com
After making changes, restart the NTP service:
systemctl restart ntpd # For ntpd
systemctl restart chronyd # For chronyd
Verify synchronization with:
ntpq -p # For ntpd
chronyc sources -v # For chronyd