美文网首页
Ubuntu16搭建NTP时间服务器

Ubuntu16搭建NTP时间服务器

作者: 小手冰冰凉啊 | 来源:发表于2018-11-08 17:48 被阅读0次

    服务端配置:
    1、安装chrony软件

    root@B-OPS-75-1:~# apt install chrony –y
    

    2、修改配置文件

    
    #pool 2.debian.pool.ntp.org offline iburst    #注释此行
    
    server time1.aliyun.com iburst        #并添加时间服务器,此处选择的是阿里的时间服务器
    server time2.aliyun.com iburst
    server time3.aliyun.com iburst
    server time4.aliyun.com iburst
    server time5.aliyun.com iburst
    server time6.aliyun.com iburst
    server time7.aliyun.com iburst
    allow 10.2.75.0/16                 #打开允许同步的IP段
    

    3、启动,查看状态,查看同步源

    root@B-OPS-75-1:~# systemctl restart chrony
    root@B-OPS-75-1:~# systemctl status chrony
    ● chrony.service - LSB: Controls chronyd NTP time daemon
       Loaded: loaded (/etc/init.d/chrony; bad; vendor preset: enabled)
       Active: active (exited) since Mon 2018-10-08 21:59:18 EDT; 1min 57s ago
         Docs: man:systemd-sysv-generator(8)
    
    Oct 08 21:59:18 B-OPS-75-1 systemd[1]: Starting LSB: Controls chronyd NTP time daemon...
    Oct 08 21:59:18 B-OPS-75-1 chrony[5172]: Invalid command at line 20 in file /etc/chrony/chrony.conf
    Oct 08 21:59:18 B-OPS-75-1 systemd[1]: Started LSB: Controls chronyd NTP time daemon.
    root@B-OPS-75-1:~# chronyc sources
    210 Number of sources = 1
    MS Name/IP address         Stratum Poll Reach LastRx Last sample
    ===============================================================================
    ^* 203.107.6.88                  2   6     7     0  +8787ns[  -53us] +/-   23ms
    root@B-OPS-75-1:~# vim /etc/chrony/chrony.conf
    root@B-OPS-75-1:~# chronyc sources
    210 Number of sources = 1
    MS Name/IP address         Stratum Poll Reach LastRx Last sample
    ===============================================================================
    ^* 203.107.6.88                  2   6   377    11   -227us[ -730us] +/-   19ms
    

    客户端配置:
    1、安装服务

    root@B-OPS-75-2:~# apt install chrony –y
    

    2、修改配置文件

    root@B-OPS-75-2:~# vim /etc/chrony/chrony.conf
    
    #pool 2.debian.pool.ntp.org offline iburst   #注释此行
    server 10.2.75.1 iburst     #添加同步源
    

    3、启动服务并查看同步源

    root@B-OPS-75-2:~# service chrony restart
    root@B-OPS-75-2:~# chronyc sources
    210 Number of sources = 1
    MS Name/IP address         Stratum Poll Reach LastRx Last sample
    ===============================================================================
    ^* 10.2.75.1                     3   6    37    32   +730ns[ +811us] +/-   27ms
    

    相关文章

      网友评论

          本文标题:Ubuntu16搭建NTP时间服务器

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