Set date and time using Network Timing Protocol (NTP)
ntpdate command is used to set the local date and time. It obtains a number of samples from each server specified and applies standard NTP clock filters and selection algorithms to select the best samples.
The ntpdate command uses the following methods for time adjustment:
Using many servers can greatly improve the reliability and accuracy of the ntpdate command. Although a single server is possible, you can get better performance by provisioning at least three or four servers.
If an NTP server daemon like the xntpd daemon is running on the same host, the command will deny the ntpdate set date.
You must have root privileges to run this command on the host.
ntpdate [ -b] [ -d] [ -s] [ -u] [ -aKeyid] [ -eAuthenticationDelay] [ -kKeyFile] [ -oVersion] [ -pSamples] [ -tTimeOut] Server...
-aKeyid # Use Keyid to authenticate all packets.
-b # Increase the clock time by calling the settimeofday subroutine.
-d #Specify debugging mode. Determines what the ntpdate command will produce (no actual results will be produced). The results are reproduced on the screen. This flag uses an unprivileged port.
-eAuthenticationDelay # Specify the number of seconds to delay authentication processing.
-kKeyFile # Specify a different name for the file containing the keys when not using the default /etc/ntp.keys file. See the description of the file KeyFile.
-oVersion # Specifies the NTP version implementation to use when polling for its outgoing packets. The value of Version can be 1, 2, 3. The default value is 3.
-pSamples # Specify the number of samples to obtain from each server. The value of Samples is between 1 and 8, inclusive. Its default value is 4.
-s # Specify the use of the syslog facility for logging operations instead of using standard output. It is useful when running ntpdate command and cron command.
-tTimeOut #Specify the time to wait for a response. The value of the given TimeOut is rounded to multiples of 0.2 seconds. The default value is 1 second.
-u # Specify an unprivileged port to send packets. This is useful when behind a firewall that blocks incoming traffic on privileged ports, and wants to synchronize with the host outside the firewall. A firewall is a system or computer that controls access to a private network from the outside.
-q # For query only, no time is set.