Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the use of the ntpdate command in Linux

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the use of the ntpdate command in Linux. It is very detailed and has a certain reference value. Friends who are interested must finish reading it!

The Linux common command ntpdate command is used to set the local date and time. It takes some samples from each specified server and applies standard NTP clock filters and selection algorithms to select the best samples.

Ntpdate uses Network timing Protocol (NTP) to set the date and time

Add that this ntpdate command uses the following methods to adjust the time:

If it determines that the clock deviation is more than half a second, it sets the clock time by calling the settimeofday subroutine. This is the preferred method during boot time.

If it determines that the clock deviation is less than half a second, it adjusts the clock time by calling the adjtime subroutine and offset. This method tends to sacrifice some stability to keep the drift clock more accurate. When you run the ntpdate command regularly from the cron command rather than by running a daemon, execution every hour or two ensures sufficient travel time precision to avoid adjusting the clock.

The reliability and accuracy of ntpdate commands can be greatly improved by using many servers. Although you can use a single server, you can achieve better performance by providing at least three or four servers.

If a NTP server daemon similar to the xntpd daemon is running on the same host, the command rejects the ntpdate setting date.

You must have root permission to run this command on the host.

Syntax ntpdate [- b] [- d] [- s] [- u] [- aKeyid] [- eAuthenticationDelay] [- kKeyFile] [- oVersion] [- pSamples] [- tTimeOut] Server... Option-aKeyid uses Keyid to authenticate all packets. -b increases the clock time by calling the settimeofday subroutine. -d specifies the debugging method. Determine what results the ntpdate command will produce (no actual results). The results are reproduced on the screen. This flag uses an unprivileged port. -eAuthenticationDelay specifies the number of seconds to delay authentication processing. -kKeyFile specifies a different name for the file containing the key when the default / etc/ntp.keys file is not used. See the description of the file KeyFile. -oVersion specifies the NTP version implementation to use when polling its outgoing packets. The value of Version can be 1, 2, 2, 3. The default value is 3. -pSamples specifies the number of samples taken from each server. The value of Samples is between 1 and 8 and includes 1 and 8. Its default value is 4. -s specifies the use of the log operation syslog facility instead of using standard output. It is useful when running the ntpdate command and the cron command. -tTimeOut specifies the time to wait for a response. The value of the given TimeOut is rounded to a multiple of 0.2 seconds. The default value is 1 second. -u specifies that packets are sent using an unprivileged port. It is useful behind a firewall that blocks incoming traffic from 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 an external network. The above is all the content of the article "what is the use of ntpdate commands in Linux". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report