Centos搭建NTP服务器

Centos搭建NTP服务器

#临时关闭selinux
setenforce 0
#永久关闭selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
#关闭防火墙
systemctl stop firewalld
#防火墙开机不启动
systemctl disable firewalld
[root@localhost ~]# yum install ntp -y

vi /etc/ntp.conf
#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
server s2m.time.edu.cn iburst
server s1b.time.edu.cn iburst
server ntp1.aliyun.com iburst
server ntp2.aliyun.com iburst
server 0.asia.pool.ntp.org iburst
server 1.asia.pool.ntp.org iburst
server 127.127.1.0 iburst local clock

[root@localhost ~]# systemctl start ntpd
[root@localhost ~]# systemctl enable ntpd
[root@localhost ~]# clock -w

[root@localhost vmware-tools-distrib]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 ns.pku.edu.cn   .INIT.          16 u    -   64    0    0.000    0.000   0.000
 202.112.1.34    .INIT.          16 u    -   64    0    0.000    0.000   0.000
 120.25.115.20   10.137.53.7      2 u    -   64    1   17.552  714.957   0.055
 203.107.6.88    100.107.25.114   2 u    1   64    1   28.449  716.770   0.563
 202.118.1.130   .INIT.          16 u    -   64    0    0.000    0.000   0.000
 x.ns.gin.ntt.ne 249.224.99.213   2 u    1   64    1   62.196  718.503   0.034
*LOCAL(0)        .LOCL.           5 l    5   64    1    0.000    0.000   0.000
#测试
C:\Users\admin>w32tm /stripchart /computer:10.130.16.12
正在跟踪 10.130.16.12 [10.130.16.12:123]。
当前时间是 2020/12/19 9:27:49。
09:27:49, d:+00.0334468s o:-02.2183781s  [                     *     |                           ]
09:27:51, d:+00.0358604s o:-02.2181364s  [                     *     |                           ]

你可能感兴趣的:(Linux,centos,ntp)