使用NTP时间同步

安装ntp

1.安装软件

># yum install ntp

2.配置ntp启动项

># chkconfig ntpd on

3.同步时间

># ntpdate pool.ntp.org

4.启动ntpd服务

># /etc/init.d/ntpd start

配置时间源

># vi /etc/ntp.conf

 server pool.ntp.org   #可选择其他优先服务器
 server 0.pool.ntp.org
 server 1.pool.ntp.org
 server 2.pool.ntp.org

配置是否为其他PC提供时间服务

># vi /etc/ntp.conf
 restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

验证ntp服务已经运行

># pgrep ntpd

初始同步

># ntpdate -u time.lib.tsinghua.edu.cn

确认同步成功

># ntpq -p

同时建议修改一下 /etc/sysconfig/ntpd 文件

># vi /etc/sysconfig/ntpd
SYNC_HWCLOCK=yes
# 改成yes,这样主机BIOS的时间也会跟着一起改变的!

修改时区

复制相应的时区文件,替换CentOS系统时区文件;或者创建链接文件

># cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

附NTP时间服务器:

210.72.145.44(中国国家授时中心服务器IP地址)

ntp.fudan.edu.cn 为复旦大学的网络时间服务器

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容