How To Synchronize System Time In Linux?


Time is important for systems because all work done according to time and logs get their timestamps. Normally server hardware provides time but it can be false over time because the hardware clock is not precise.

Ntp is a protocol designed to get time info from network. Ntp can also provide time information to other servers as a daemon. Ntp full name is Network Time Protocol.

Install Ntpdate

Ntpdate is simple and fast ntp client used to get information about time.

CentOS, Fedora

Ubuntu, Debian

Get Time From Ntp Server

We can use ntpdate client to get current time from ntp server. We will specify ntp server as parameter to the ntpdate.

We need root privileges to use ntpdate to sync clock

Check Current Time From Local Server

We can list current time in server by using date command.

Enable Firewall For Ntp Related Ports

We may need to open ports about ntp like below by using iptables

Get Current Time Info

ntpdate is an old tool and deprecated we can use datetimectl according to ntpdate

LEARN MORE  How To Update VMs with Libguestfs Tools

We see that our time is synchronized with ntp with “NTP synchronized” line.

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)