1. Configure NTP on zzsrv1 1.1. Install NTP
# Yum list | grep NTP
Ntpdate. x86_64 4.2.6p5-18. el7.centos @ anaconda
Fontpackages-devel.noarch 1.44-8. el7 Base
Fontpackages-filesystem.noarch 1.44-8. el7 Base
Fontpackages-tools.noarch 1.44-8. el7 Base
NTP. x86_64 4.2.6p5-18. el7.centos Base
Ntp-doc.noarch 4.2.6p5-18. el7.centos Base
Ntp-perl.noarch 4.2.6p5-18. el7.centos Base
SNTP. x86_64 4.2.6p5-18. el7.centos Base
# Rpm-Qa | grep NTP
Ntpdate-4.2.6p5-18.el7.centos.x86_64
Manually check the time. There is a clock server 192.168.1.11 in the current production environment.
# Ntpdate 192.168.1.11
11 Aug 20:01:57 ntpdate [2450]: adjust time server 192.168.1.11 offset-0.082365 Sec
# Hwclock -- systohc
# Yum-y install NTP
Autogen-libopts-5.18-5.el7.x86_64.rpm
Ntp-4.2.6p5-18.el7.centos.x86_64.rpm
1.2. Configuration
# Rpm-QC NTP
/Etc/NTP. conf
/Etc/NTP/crypto/PW
/Etc/sysconfig/ntpd
# Cd/etc/
# Cp NTP. conf NTP. conf. Origin
# Vi NTP. conf
Delete all content. Only the upstream server is retained.
Server 0.centos.pool.ntp.org
Server 1.centos.pool.ntp.org
Server 2.centos.pool.ntp.org
Server 3.centos.pool.ntp.org
# Service ntpd start
Redirecting to/bin/systemctl start ntpd. Service
View logs
Systemd: Starting Network Time Service...
NTPD [2622]: NTPD [email protected] wed Jun 18 21:20:36 UTC 2014 (1)
NTPD [2623]: PROTO: Precision = 0.203 USEC
NTPD [2623]: 0.0.0.0 c01d 0d Kern Kernel Time sync Enabled
NTPD [2623]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
NTPD [2623]: Listen and drop on 1 v6wildcard: UDP 123
NTPD [2623]: Listen normally on 2 lo 127.0.0.1 UDP 123
NTPD [2623]: Listen normally on 3 eno16777728 192.168.188.11 UDP 123
NTPD [2623]: Listen normally on 4 lo: 1 udp 123
NTPD [2623]: Listen normally on 5 eno16777728 fe80: 20c: 29ff: fea4: 2e39 UDP 123
NTPD [1, 2623]: listening on routing socket on FD #22 for interface updates
Systemd: started Network Time Service.
NTPD [2623]: 0.0.0.0 c016 06 restart
NTPD [2623]: 0.0.0.0 c012 02 freq_set kernel 0.000 ppm
NTPD [2623]: 0.0.0.0 c011 01 freq_not_set
NTPD [2623]: 0.0.0.0 c614 04 freq_mode
# Systemctl enable ntpd
Ln-s '/usr/lib/systemd/system/ntpd. service'/etc/systemd/system/multi-user.target.wants/ntpd. Service'
# Netstat-an | grep 123
UDP 0 0 192.168.188.11: 123 0.0.0.0 :*
UDP 0 0 127.0.0.1: 123 0.0.0.0 :*
UDP 0 0 0.0.0.0: 123 0.0.0.0 :*
UDP6 0 0 fe80: 20c: 29ff: fea4: 123 :::*
UDP6 0 0: 1: 123 :::*
UDP6 0 0: 123 :::*
UNIX 3 [] stream connected 12323.
UNIX 3 [] stream connected 16123.
UNIX 3 [] stream connected 12324/run/systemd/Journal/stdout
1.3. Test
On another Linux server
# Ntpdate 192.168.188.11
11 Aug 20:18:15 ntpdate [12840]: adjust time server 192.168.188.11 offset 0.004473 Sec
When the school is completed on windows
Set automatic calibration
# Rpm-QC crontabs
/Etc/crontab
/Etc/sysconfig/run-Parts
Write daily school script
# Cd/etc/cron. daily/
# Ll
Total 16
-Rwxr-XR-X. 1 Root 332 Jun 27 :07 0yum-daily.cron
-Rwx ------. 1 Root 180 Jul 31 2013 logrotate
-Rwxr-XR-X. 1 Root 618 mar 18 man-db.cron
-Rwxr-x ---. 1 Root 192 Jan 27 2014 mlocate
# Vi checktime. Sh
Ntpdate 192.168.188.11
Hwclock -- systohc
# Chmod + x checktime. Sh
Test script
#./Checktime. Sh
11 Aug 20:25:49 ntpdate [12897]: adjust time server 192.168.188.11 offset 0.003041 Sec
# Ll
Total 20
-Rwxr-XR-X. 1 Root 332 Jun 27 :07 0yum-daily.cron
-Rwxr-XR-x 1 Root 41 Aug 11 20:25 checktime. Sh
-Rwx ------. 1 Root 180 Jul 31 2013 logrotate
-Rwxr-XR-X. 1 Root 618 mar 18 man-db.cron
-Rwxr-x ---. 1 Root 192 Jan 27 2014 mlocate
This article from the "Liu Qiong @ Tiandao reward diligence" blog, please be sure to keep this source http://lqiong.blog.51cto.com/8170814/1559078
Eight centos project instances-NTP clock Server Configuration