三台服务器的时间同步-Linux

192.168.1.30    做服务器时间

192.168.1.40   同步30

192.168.1.50  同步30

step1.在30机器上修改ntp.conf

添加:

restrict  192.168.1.0 mask  255.255.255.0  nomodify notrap

说明:根据自己的该啊

注销:

#server 0.rhel.pool.ntp.org iburst
#server 1.rhel.pool.ntp.org iburst
#server 2.rhel.pool.ntp.org iburst
#server 3.rhel.pool.ntp.org iburst

添加:

server  127.127.1.0  #  local clock
fudge   127.127.1.0  stratum  10

保证BIOS(主板)与系统时间同步

vim  /etc/sysconfig/ntpd    

添加:SYNC_HWLOCK=yes

启动ntpd的运行进程

service  ntpd start

service  ntpd status   --保证服务启动

在40机器上:

[root@saver1 ~]# ntpdate -u  192.168.1.30

28 Jul 13:03:37 ntpdate[2698]: step time server 192.168.1.30 offset 14401.695083 sec

在50机器上:

[root@saver2 ~]# ntpdate -u  192.168.1.30

28 Jul 13:03:51 ntpdate[2663]: step time server 192.168.1.30 offset 14401.690938 sec

date 查看时间已经同步

配置定时器,定时每分钟与时钟服务器进行同步

crontab  -e

*/1 * * * * /usr/sbin/ntpdate 192.168.1.30

《完》

猜你喜欢

转载自www.cnblogs.com/hello-wei/p/11258625.html