NTP Server: Network Timeprotocol
BIOS the intrinsic characteristics of the internal chip can easily cause BIOS Time and UTC There are differences in global standard time. Time synchronization (Synchronize) is an effective way to avoid the time skew caused by the host's long running time.
NTP principle:
-
1. NTP server open listening port number 123 UDP )
2. Client to NTPserver message to send proofing time
3. NTP Server reply to the current standard time to Client ()
4. Client received from NTPserver after the reply, adjust your own time
Client can automatically calculate the delay in the transmission process; Server If the load is too heavy, you can use Master/slave Architecture provides network time-of-school.
most NTP server in foreign countries, there is a second level of NTP Server (210.72.154.44) , directly connected to the Taiwan can.
Configuration NTP Time Synchronization
1. Preparation Environment: two host computers
172.17.220.145 : As a third-level time server ntpd , for use with level two standard time servers 210.72.154.44 Sync Time
172.17.220.224 : NTP client, used with 172.17.220.145 Sync Time
2. Setting up a firewall
Vi/etc/sysconfig/iptables
in the "-ainput-p tcp-m State--state new-m TCP--dport 22-j ACCEPT" after the increase
-ainput-p udp-m State--state new-m UDP--dport 123-j ACCEPT
3.rpm Package Check
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/84/2D/wKiom1eHZ5jjlkThAAAxczLDl0k881.jpg-wh_500x0-wm_3 -wmp_4-s_710871788.jpg "title=" 1.jpg "alt=" Wkiom1ehz5jjlkthaaaxczldl0k881.jpg-wh_50 "/>
if not installed, you can Yum Install NTP installation.
4. Set the system boot and start service
Centos7 By default chronyd service for clock synchronization
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/84/2D/wKiom1eHZ6uDhhFeAABIp_jKdR0286.png-wh_500x0-wm_3 -wmp_4-s_1263247780.png "title=" 2.png "alt=" Wkiom1ehz6udhhfeaabip_jkdr0286.png-wh_50 "/>
We close chronyd service and enable it to boot without self-booting ntpd and add it to power-on self-start
[15:57:[email protected] ~]# systemctl stop chronyd[15:59:[email protected] ~]# systemctl disable chronyd [15:59:[email PR Otected] ~]# Systemctl enable Ntpd[15:59:[email protected] ~]# systemctl start ntpd
5. Modify the configuration file
vi/etc/ntp.conf#5.1 setting restrictions on clients restrict172.17.220.0 mask 255.255.255.0 nomodify:<< ' restrict parameters
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M01/84/2C/wKioL1eHZ_SSiFCvAACTk5Yzgps630.jpg-wh_500x0-wm_3 -wmp_4-s_2722788199.jpg "title=" 22.JPG "alt=" Wkiol1ehz_ssifcvaactk5yzgps630.jpg-wh_50 "/>
5.2 Set Self time server source comment out system default, try to pass IP settings (reduce DNS resolution Time) ' #server 0.centos.pool.ntp.org iburst#server1.centos.pool.ntp.org iburst#server2.centos.pool.ntp.org iburst#server3.centos.pool.ntp.org iburstserver110.75.190.198 perferserver202.108.6.95server202.112.29.82#5.3 set itself to Level 3 NTPserverfudge172.17.220.145 stratum 3
6. Restart ntpd and view
Systemctlrestart ntpd : Restart ntpd
ntpq–p View ntpd
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/84/2D/wKiom1eHaBKxiJubAAAvB27Sj5w422.png-wh_500x0-wm_3 -wmp_4-s_3513341644.png "title=" 4.png "alt=" Wkiom1ehabkxijubaaavb27sj5w422.png-wh_50 "/>
7. Setting up the NTP client
7.1 Test ntpd whether the installation was successful
ntpdate 172.17.220.145 # from ntpd (172.17.220.145) Get current Time
date; Hwclock–r # gets the current time, by Hwclock–r Write BIOS Time
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/84/2C/wKioL1eHaCvC3ya_AAAvfI4bMSc727.png-wh_500x0-wm_3 -wmp_4-s_1640372115.png "title=" 5.png "alt=" Wkiol1ehacvc3ya_aaavfi4bmsc727.png-wh_50 "/>
7.2 set up automatic synchronization ( update time every three hours )
CRONTAB–E0 */1 * * */usr/sbin/ntpdate192.168.0.240;/sbin/hwclock–w crontab–l
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/84/2C/wKioL1eHaELzTUoLAAAeEijnWyw146.png-wh_500x0-wm_3 -wmp_4-s_3608103317.png "title=" 6.png "alt=" Wkiol1ehaelztuolaaaeeijnwyw146.png-wh_50 "/>
Commands to modify the time zone
#cd/usr/share/zoneinfo #进入查找所有时区 # timedatectl set-timezone asia/shanghai# timedatectl Status
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/84/2D/wKiom1eHaFbSzzTmAABALVi7yXs332.png-wh_500x0-wm_3 -wmp_4-s_965576919.png "title=" 7.png "alt=" Wkiom1ehafbszztmaabalvi7yxs332.png-wh_50 "/>
Centos7.1 for NTP server configuration