Linux basic commands --- ntpdate network time server

ntpdate

ntpdate command parameters Network Time Protocol server (NTP) server to set the local date and time designated by polling to determine the correct time.

Scope of this command: RedHat, RHEL, Ubuntu, CentOS, Fedora.

 

1 , grammar

ntpdate [ options] server

 

2 , the list of options

Options

Explanation

-a

Enable the authentication function and specify the key identifier to be used for authentication. Keys and key identifiers must match key file in the client and server key files. Disabling authentication default settings

-B

Always use adjtime force trim system call time (even if the measured offset is greater than ± 128ms). System when using clock_settime ± 12.8ms offset is greater than the default setting of the step time call

-b

Clock_settime mandatory use of system calls to step time, rather than using adjtime time to fine-tune the system call (default value). If you call from a startup file at boot time, you should use this option

-d

Enable debug mode, in which ntpdate will go through all the steps, but not adjust the local clock. There will also be output can be used for general debugging information

-e

The process performs the authentication function of delay as the value authdelay (in seconds and fraction, for more information, see xntpd (1M)). While specifying a value may improve the accuracy of travel time on very slow CPU, but the number is usually very small, even in most cases can be ignored

-k

The authentication key path to the file specified as a string keyfile. The default value is /etc/ntp.keys. The file format should be used in xntpd

-The

The outgoing NTP packet as the integer version version (which may be 1 or 2). The default value is 3. It allows ntpdate to be used in conjunction with earlier versions of NTP

-p

The number of sample acquired from each server specified as an integer sample value ranging from 1 to 8 (both inclusive numbers). The default value is 4

-q

输出偏移量测量结果、服务器层次以及延迟测量结果,但不调整本地时钟。它类似于“-d”选项,后者提供更为详细的调试信息

-s

将日志记录输出从标准输出(默认)转移到系统syslog (请参阅syslog(3C))工具。它主要是为方便使用cron脚本而设计

-t

将等待服务器响应的最长时间指定为超时值,以秒及其分数为单位。该值将四舍五入成0.2秒的倍数。默认值是1秒,该值适用于轮询局域网

-u

指示ntpdate将无特权的端口用于外发的数据包。在防火墙后,如果阻塞向特权端口的传入流量,并且希望与防火墙后的主机进行同步,则该选项极为有用。请注意,“-d” 选项始终使用无特权的端口

-v

输出NTP版本号和偏移量测量信息

 

3、实例

同步时间

[root@localhost wj]# ntpdate 202.112.29.82

16 Aug 10:13:21 ntpdate[20212]: adjust time server 202.112.29.82 offset 0.006454 sec

 

     

      做了一个Linux学习的平台,目前出来一个雏形,各位可以参考使用
      链接:https://pan.baidu.com/s/1GOLVU2CbpBNGtunztVpaCQ 密码:n7bk 

      



Guess you like

Origin blog.51cto.com/9888479/2444031