NTP协议以及ntpclinet使用 From Evernote: NTP协议以及ntpclinet使用 NTP全称是Network Time Protocol,是用来让计算机之间实现时间同步的协议
2014-04-16 17:31
615 查看
NTP全称是Network Time Protocol,是用来让计算机之间实现时间同步的协议。发布这种校对时间的服务器,就是NTP Server;而在Internet中的任何主机上都可以使用NTP客户端程序从NTP Server上读取时间,以实现网络时间同步的功能。
国内的NTP Server基本都属于科研教育机构所有,普通社会组织发布的NTP Server并不多,以下是搜集的一些国内可用的NTP Server:
1.cn.pool.ntp.org
2.cn.pool.ntp.org
3.cn.pool.ntp.org
0.cn.pool.ntp.org
cn.pool.ntp.org
tw.pool.ntp.org
0.tw.pool.ntp.org
1.tw.pool.ntp.org
2.tw.pool.ntp.org
3.tw.pool.ntp.org
ntpclient是可在类Unix系统上运行的ntp客户端程序,用于从网络上的NTP服务器上读取时间并设置到本地主机上。源码的下载地址为:http://doolittle.icarus.com/ntpclient/。
ntpclient的使用方法:
pavel@pavel-desktop ~/test/ntpclient-2010 $ ./ntpclient
Usage: ./ntpclient [-c count] [-d] [-f frequency] [-g goodness] -h hostname
[-i interval] [-l] [-p port] [-q min_delay] [-r] [-s] [-t]
主要选项说明:
-h hostname:NTP Server地址
-c count:从NTP Server上读取时间的执行次数
-i:执行多次校时操作的时间间隔,默认为600s
-s:读取到时间后设置到本地主机中
-g goodness:当读取时间与本地时间的差值精确度好于goodness(以ms为单位)时程序退出,否则一直执行。goodness默认为0,表示一直执行
-p port:ntpclient访问ntp服务器时所使用的本地UDP端口,默认为任何可用的端口
-d:打印调试信息,该特性可在编译时禁止掉
ntpclient应用程序的执行说明:
$ sudo ./ntpclient -h 114.80.81.1 -c 10 -i 10 -s
以上调用表示NTP服务器地址为114.80.81.1,连续执行10次,每次间隔时间为10s,从NTP服务器上读取到时间后设置到本地主机中。
pavel@pavel-desktop ~/test/ntpclient-2010 $ sudo ./ntpclient -h 114.80.81.1 -c 10 -i 10 -s
day second elapsed stall skew dispersion freq
40678 20520.811 49937.0 31.5 7163.7 41885.4 0
其中:
day,second:表示当前时间距离1900年1月1日的时间,分别为天数和秒
elapsed:表示从发出读取时间命令到时间信息收到总共花费的时间,以us为单位
skew:表示服务器时间与本地主机时间的偏差,以us为单位
国内的NTP Server基本都属于科研教育机构所有,普通社会组织发布的NTP Server并不多,以下是搜集的一些国内可用的NTP Server:
1.cn.pool.ntp.org
2.cn.pool.ntp.org
3.cn.pool.ntp.org
0.cn.pool.ntp.org
cn.pool.ntp.org
tw.pool.ntp.org
0.tw.pool.ntp.org
1.tw.pool.ntp.org
2.tw.pool.ntp.org
3.tw.pool.ntp.org
ntpclient是可在类Unix系统上运行的ntp客户端程序,用于从网络上的NTP服务器上读取时间并设置到本地主机上。源码的下载地址为:http://doolittle.icarus.com/ntpclient/。
ntpclient的使用方法:
pavel@pavel-desktop ~/test/ntpclient-2010 $ ./ntpclient
Usage: ./ntpclient [-c count] [-d] [-f frequency] [-g goodness] -h hostname
[-i interval] [-l] [-p port] [-q min_delay] [-r] [-s] [-t]
主要选项说明:
-h hostname:NTP Server地址
-c count:从NTP Server上读取时间的执行次数
-i:执行多次校时操作的时间间隔,默认为600s
-s:读取到时间后设置到本地主机中
-g goodness:当读取时间与本地时间的差值精确度好于goodness(以ms为单位)时程序退出,否则一直执行。goodness默认为0,表示一直执行
-p port:ntpclient访问ntp服务器时所使用的本地UDP端口,默认为任何可用的端口
-d:打印调试信息,该特性可在编译时禁止掉
ntpclient应用程序的执行说明:
$ sudo ./ntpclient -h 114.80.81.1 -c 10 -i 10 -s
以上调用表示NTP服务器地址为114.80.81.1,连续执行10次,每次间隔时间为10s,从NTP服务器上读取到时间后设置到本地主机中。
pavel@pavel-desktop ~/test/ntpclient-2010 $ sudo ./ntpclient -h 114.80.81.1 -c 10 -i 10 -s
day second elapsed stall skew dispersion freq
40678 20520.811 49937.0 31.5 7163.7 41885.4 0
其中:
day,second:表示当前时间距离1900年1月1日的时间,分别为天数和秒
elapsed:表示从发出读取时间命令到时间信息收到总共花费的时间,以us为单位
skew:表示服务器时间与本地主机时间的偏差,以us为单位
相关文章推荐
- 网络时间协议简介-----NTP(Network Time Protocol)
- 网络时间协议Network Time Protocol(NTP)
- C++使用Boost实现Network Time Protocol(NTP)客户端
- Linux之通过NTP协议实现服务器时间同步的源码
- 使用协议Protocol实现ViewController之间传值
- NTP协议网络时间同步 ios中应用 实现秒杀倒计时
- 网络时间协议(Network Time Protocal, NTP)学习笔记
- Cloudera 建议使用 NTP 使 Hadoop 群集实现时间同步
- Cloudera 建议使用 NTP 使 Hadoop 群集实现时间同步
- 使用NTP协议服务器时间同步
- android—DatePicker 和TimePicker显示日期以及使用TimePickerDialog,DatePickerDialog来专门实现时间选择对话框
- RTP 与RTCP 解释. 含同步时间戳 RTP协议是real-time transport protocol的缩写,被设计来传输流媒体数据,有着广泛的应用,其它相关介绍自己去看RFC,我不打算
- openstack-mitaka安装文档-Network Time Protocol (NTP)安装
- Golang 奇葩的时间包之Json与struct对象之间互相转换,JsonDate和JsonTime自定义类型如何实现json编码和解码(二)
- 通过NTP协议进行时间同步
- swift protocol 协议代理的使用以及解决循环引用问题
- 关于ntp(时间同步协议)服务端和客户端的配置说明
- mysql 时间戳格式化函数from_unixtime使用说明
- Linux上搭建ntp服务,实现时间同步
- 通过NTP协议进行时间同步