# For more information about this file, see the man pages # ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).
driftfile /var/lib/ntp/drift
# Permit time synchronization with our time source, but do not # permit the source to query or modify the service on this system. restrict default nomodify notrap nopeer noquery
# Permit all access over the loopback interface. This could # be tightened as well, but to do so would effect some of # the administrative functions. restrict 127.0.0.1 restrict ::1
# Hosts on local network are less restricted. #restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
# Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). server 0.cn.pool.ntp.org server 1.cn.pool.ntp.org server 2.cn.pool.ntp.org server 3.cn.pool.ntp.org
# Key file containing the keys and key identifiers used when operating # with symmetric key cryptography. keys /etc/ntp/keys
# Specify the key identifiers which are trusted. #trustedkey 4 8 42
# Specify the key identifier to use with the ntpdc utility. #requestkey 8
# Specify the key identifier to use with the ntpq utility. #controlkey 8
# Enable writing of statistics records. #statistics clockstats cryptostats loopstats peerstats
# Disable the monitoring facility to prevent amplification attacks using ntpdc # monlist command when default restrict does not include the noquery flag. See # CVE-2013-5211 for more details. # Note: Monitoring will not be disabled with the limited restriction flag. disable monitor
● ntpd.service - Network Time Service Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled) Active: active (running) since Sun 2019-03-31 14:33:27 CST; 23min ago Main PID: 14926 (ntpd) CGroup: /system.slice/ntpd.service └─14926 /usr/sbin/ntpd -u ntp:ntp -g
Mar 31 14:33:27 ntp-server systemd[1]: Starting Network Time Service... Mar 31 14:33:27 ntp-server systemd[1]: Started Network Time Service. Mar 31 14:33:27 ntp-server ntpd[14926]: proto: precision = 0.054 usec Mar 31 14:33:27 ntp-server ntpd[14926]: 0.0.0.0 c01d 0d kern kernel timesync enabled
验证
1 2 3 4 5 6 7
[root@ntp-server ~]# ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== ntp1.ams1.nl.le 130.133.1.10 2 u 309 128 104 286.324 -30.954 2.799 *electrode.felix 89.231.96.83 2 u 79 128 177 245.661 -4.341 11.315 118.190.21.209 .STEP. 16 u - 1024 0 0.000 0.000 0.000 biisoni.miuku.n .STEP. 16 u - 1024 0 0.000 0.000 0.000
1 2
[root@ntp-server ~]# date -R Sun, 31 Mar 2019 15:06:12 +0800
查询ntp服务:
1 2 3 4 5 6
[root@ntp-server ~]# ntpdate -q 0.cn.pool.ntp.org server 78.46.102.180, stratum 2, offset -0.004452, delay 0.25752 server 51.15.238.170, stratum 0, offset 0.000000, delay 0.00000 server 199.182.204.197, stratum 0, offset 0.000000, delay 0.00000 server 94.130.49.186, stratum 3, offset -0.021914, delay 0.32487 31 Mar 15:09:05 ntpdate[24663]: adjust time server 78.46.102.180 offset -0.004452 sec