您的位置:首页 > 大数据 > 人工智能

设置linux时间同步于AIX (很实用:ntp服务器的架设)

2011-02-14 15:10 483 查看
一、在AIX设置时间主服务器

设置NTP服务器(MASTER) ,其它NTP客户服务器以此服务器的时间为准,与其进行时间同步.

1.编辑/etc/ntp.conf文件,内容如下:

----------------------------
#broadcastclient
server 127.127.1.0
driftfile /etc/ntp.drift
tracefile /etc/ntp.trace
----------------------------
请注意文件中的server 127.127.1.0这一行,此处的127.127.1.0是一特殊的地址,表示NTP主服务器是与自身的系统时钟同步.
2.编辑好/etc/ntp.conf后,启动xntpd守护进程

# smitty xntpd
3. xntpd状态查询,使用#lssrc -ls xntpd

刚启动xntpd时, sys peer为'insane',表明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
...
等待6 - 10分钟后, sys peer就不再是'insane'了.
#lssrc -ls xntpd
Program name: /usr/sbin/xntpd
Version: 3
Leap indicator: 00 (No leap second today.)
Sys peer: 127.127.1.0
...
二、在linux上同步时间

1.建立一个文件date.cron (/usr/local/bin)

vi date.cron加入下面要运行的命令和要定期执行的时间,每隔一分钟
*/1 * * * * /usr/sbin/ntpdate 172.16.100.26
2.使用crontab命令来安装这个文件,使之成为该用户的crontab文件。键入:

crontab date.cron
3.使用命令:

crontab -l (查看安排的作业序列)可以看到刚才的作业
可以用date命令查看时间是否同步了

注:可以把 linux server 设置成 主机(192.168.1.1),其他的机器,不管 aix ,还是 linux 都同步这台机器。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: