Linux中ntp时间同步

联网状态下与互联网上提供的时钟服务器进行同步

同步命令 : ntpdate ntp4.aliyun.com (阿里云提供的免费时间服务器)

配置离线状态下的时钟同步

1、设置时钟同步服务器的时间(node03 2012-12-12 12:12:12)

将node01 node02时间与node03同步

2、修改第一个配置文件 /etc/ntp.conf

添加如下内容

restrict 192.168.100.0 mask 255.255.255.0 nomodify notrap ​ server 127.127.1.0 # localclock ​ fudge 127.127.1.0 stratum 10

注释以后的服务器

#server 0.centos.pool.ntp.org iburst ​ #server 1.centos.pool.ntp.org iburst ​ #server 2.centos.pool.ntp.org iburst ​ #server 3.centos.pool.ntp.org iburst

3、修改第二个配置文件 vi /etc/sysconfig/ntpd

添加如下内容

SYNC_HWLOCK=yes

4、重启ntp服务

/etc/init.d/ntpd restart

5、时钟同步

在node01 node02节点进行同步

命令 ntpdate node03 (时钟服务器)

ntpdate 192.168.100.133(时钟服务器)

猜你喜欢

转载自blog.csdn.net/Dreamy_zsy/article/details/103010961