The Network Time Protocol (NTP) is a protocol used to synchronize computer system clock automatically over a networks. The machine can have the system clock use Coordinated Universal Time (UTC) rather than local time.
The most common method to sync system time over a network in Linux desktops or servers is by executing the ntpdate command which can set your system time from an NTP time server. In this case, the ntpd daemon must be stopped on the machine where the ntpdate command is issued.
In most Linux systems, the ntpdate command is not installed by default. To install it, execute the below command.
$ sudo apt-get install ntpdate [On Debian/Ubuntu] $ sudo yum install ntpdate [On CentOS/RHEL] $ sudo dnf install ntpdate [On Fedora 22+]
The example of ntpdate command as shown.
$ sudo ntpdate 1.ro.pool.ntp.org
In order to just query the server and not set the clock and use an unprivileged port to send the packets from, in order to bypass firewalls, issue ntpdate with the below flags.
$ sudo ntpdate -qu 1.ro.pool.ntp.org
Always try to query and sync the time with the closest NTP servers available for your zone. The list of the NTP server pools can be found at the following address:
In newer Linux distributions that ship with Systemd, you can also sync time via timesyncd.conf file. Just open the file for editing.
$ sudo nano /etc/systemd/timesyncd.conf
And add or uncomment the following lines after [Time] statement, as illustrated in the below excerpt:
[Time] NTP=0.ro.pool.ntp.org 1.ro.pool.ntp.org FallbackNTP=ntp.ubuntu.com 0.arch.pool.ntp.org
After editing the file, issue the timedatectl command to activate the NTP client build in systemd.
$ sudo timedatectl set-ntp true $ timedatectl status