美文网首页
使用NTP时间同步

使用NTP时间同步

作者: boskt | 来源:发表于2019-01-30 17:12 被阅读0次

    安装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 为复旦大学的网络时间服务器

    相关文章

      网友评论

          本文标题:使用NTP时间同步

          本文链接:https://www.haomeiwen.com/subject/uoucsqtx.html