AIX中使用NTP服务知识讲解.docx
《AIX中使用NTP服务知识讲解.docx》由会员分享,可在线阅读,更多相关《AIX中使用NTP服务知识讲解.docx(11页珍藏版)》请在冰豆网上搜索。
AIX中使用NTP服务知识讲解
AIX中使用NTP服务
在AIX中使用NTP服务
在AIX中使用NTP服务
内容提要:
NTP协议简介
AIX对NTP的支持
配置AIX成为NTP服务器(使用系统时钟)
配置AIX成为NTP服务器(使用Internet标准时间服务器)
配置AIX成为NTP服务器(使用其它系统作为时间服务器)
配置AIX成为NTP服务器的客户端
配置AIX成为NTP转发器
配置AIX成为NTP转发器的客户端
xntpd命令参考
说明:
NTP协议简介
NTP协议全称网络时间协议(NetworkTimeProcotol)。
它的目的是在国际互联网上传递统一、标准的时间。
具体的实现方案是在网络上指定若干时钟源网站,为用户提供授时服务,并且这些网站间应该能够相互比对,提高准确度。
NTP最早是由美国Delaware大学的Mills教授设计实现的,从1982件最初提出到现在已发展了将近20年,2001年最新的NTPv4精确度已经达到了200毫秒。
对于实际应用,又有确保秒级精度的SNTP(简单的网络时间协议)。
本项目使用网上时间传递格式NTPv3公布于1992年,当前几乎所有的授时网站都是基于NTPv3的。
NTP所建立起的网络基本结构是分层管理的类树形结构。
网络中的节点有两种可能:
时钟源或客户。
每一层上的时钟源或客户可向上一层或本层的时钟源请求时间校正。
第0层为官方时钟所保留。
第一层为一级时钟源层,其上没有任何客户,只有主钟源,这些钟源之间相互不允许校正。
一级钟源的任务就是将时间信息向第二层的钟源或客户发布。
第二层及以下层除层数不同、时间质量不一样外没有本质上的区别。
第N层上的时钟源的时间来自第N-1层或第N层,并向第N层上的时钟源和第N+1层上的客户提供校时服务。
最常用的NTP的工作模式为客户/服务器模式和广播模式。
客户/服务器模式:
与主/被动模式基本相同。
唯一区别在于,客户方可被服务器同步,但服务器不能被客户同步。
广播模式:
一对多的连接,服务器不论客户工作在何种模式下,主动发出时间信息,客户由此信息调整自己的时间。
AIX对NTP的支持
AIX操作系统包括了xntpd程序。
xntpd守护进程是根据RFC1035定义的网络计时协议(NTP)版本3标准的完整实现,同时也保持与根据RFC1059和RFC1119分别定义的版本1和版本2服务器的兼容性。
xntpd守护进程用定点算法进行所有的计算,并不需要浮点代码。
除了xntpd以外,AIX操作系统也支持ntpq,ntpdate,xntpdc等相关命令。
另外,AIX还支持使用lssrc-ls命令检查xntpd的运行状态,以及使用ntptrace命令跟踪远程时间服务器。
在AIX操作系统中,xntpd的配置文件是/etc/ntp.conf。
配置AIX成为NTP服务器(使用系统时钟)
1、编辑/etc/ntp.conf文件:
server127.127.1.0prefer
driftfile/etc/ntp.drift
tracefile/etc/ntp.trace
2、启动xntpd服务:
#startsrc-sxntpd
3、使用lssrc-lsxntpd命令检测xntpd的运行状态,并且等待时间层数(stratum)变为16以下的数(通常是3)。
xntpd服务器初始化完成前:
#lssrc -ls xntpd
Program name:
/usr/sbin/xntpd
Version:
3 Leap indicator:
11 (Leap indicator is insane.) =========>初始化未完成
Sys peer:
no peer, system is insane
=========>初始化未完成
Sys stratum:
16=========>初始化未完成
Sys precision:
-17
Debug/Tracing:
DISABLED
Root distance:
0.000000
Root dispersion:
0.000000
Reference ID:
no refid, system is insane
=========>初始化未完成
Reference time:
no reftime, system is insane
=========>初始化未完成
xntpd服务器初始化完成后:
#lssrc -ls xntpd
Program name:
/usr/sbin/xntpd
Version:
3
Leap indicator:
00 (No leap second today.)
Sys peer:
127.127.1.0
Sys stratum:
4
Sys precision:
-17
Debug/Tracing:
DISABLED
Root distance:
0.000000
Root dispersion:
0.885010
Reference ID:
127.127.1.0
Reference time:
c6e1d5c0.f7506000 Mon, Sep 26 2005 10:
04:
48.966
配置AIX成为NTP服务器(使用Internet标准时间服务器)
1、编辑/etc/ntp.conf文件:
servertime-b.timefreq.bldrdoc.govprefer#Internet时间服务器地址
server127.127.1.0
driftfile/etc/ntp.drift
tracefile/etc/ntp.trace
2、和Internet时间服务器同步时间:
#ntpdatetime-b.timefreq.bldrdoc.gov
3、启动xntpd服务:
#startsrc-sxntpd
4、使用lssrc-lsxntpd命令检测xntpd的运行状态,并且等待时间层数(stratum)变为16以下的数。
如果选择和一级Internet时间服务器进行同步,系统初始化完成后的stratum应该为2,syspeer应为Internet时间服务器:
#lssrc -ls xntpd
Program name:
/usr/sbin/xntpd
Version:
3
Leap indicator:
00 (No leap second today.)
Sys peer:
time-b.timefreq.bldrdoc.gov
======> SYS PEER
Sys stratum:
2 ======> STRATUM
Sys precision:
-18
Debug/Tracing:
DISABLED
Root distance:
0.000519
Root dispersion:
0.135208
Reference ID:
time-b.timefreq.bldrdoc.gov
Reference time:
c6e1d74e.073d8000 Mon, Sep 26 2005 10:
11:
26.028
Broadcast delay:
0.003906 (sec)
Auth delay:
0.000122 (sec)
System flags:
pll monitor filegen
System uptime:
1634385 (sec)
Clock stability:
0.000107 (sec)
Clock frequency:
0.000000 (sec)
Peer:
127.127.1.0
flags:
(configured)(refclock)
stratum:
3, version:
3
our mode:
client, his mode:
server
Peer:
time-b.timefreq.bldrdoc.gov
flags:
(configured)(sys peer)(preferred)
stratum:
1, version:
3
our mode:
client, his mode:
server
Subsystem Group PID Status
xntpd tcpip 503932 active
配置AIX成为NTP服务器(使用其它系统作为时间服务器)
此配置的关键是调高系统时钟的层数,以使xntpd优先使用指定的外部时钟服务。
1、编辑/etc/ntp.conf文件:
serverdumpprefer#本地时间服务器地址
server127.127.1.0
fudge127.127.1.0stratum6#将系统时钟层数调整为6
driftfile/etc/ntp.drift
tracefile/etc/ntp.trace
2、和本地时间服务器同步时间:
#ntpdatedump
3、启动xntpd服务:
#startsrc-sxntpd
4、使用lssrc-lsxntpd命令检测xntpd的运行状态,并且等待时间层数(stratum)变为16以下的数。
如果选择和4层时间服务器进行同步,系统初始化完成后的stratum应该为5,syspeer应为本地时间服务器:
#lssrc -ls xntpd
Program name:
/usr/sbin/xntpd
Version:
3
Leap indicator:
00 (No leap second today.)
Sys peer:
dump ============>Sys peer为本地时间服务器,stratum=4
Sys stratum:
5
Sys precision:
-18
Debug/Tracing:
DISABLED
Root distance:
0.000473
Root dispersion:
0.010193
Reference ID:
9.181.159.11
Reference time:
c6e1d94b.be672000 Mon, Sep 26 2005 10:
19:
55.743
Broadcast delay:
0.003906 (sec)
Auth delay:
0.000122 (sec)
System flags:
pll monitor filegen
System uptime:
1634898 (sec)
Clock stability:
0.000107 (sec)
Clock frequency:
0.000000 (se