Build ntp service on centos Server
1. Preparations before installation
View the time zone set above the system
[Root @ linux-node1 ~] # Cat/etc/sysconfig/clock ZONE = "Asia/Shanghai" Thought: how to modify the solution on a linux host: change the time zone vim/etc/sysconfig/clockZONE = "Asia/Shanghai" UTC = trueARC = false to overwrite the system time file cp-a/usr/share/zoneinfo/Asia/Shanghai/etc/ localtime #2. Start to install the ntp server using yum/rpm to install yum install ntp-y to check whether the installation is successful [root @ linux-node1 ~] # Rpm-qa ntpntp-4.2.6p5-10.el6.centos.1.x86_64
3. Start configuring the ntp server.
Vim/etc/ntp. the/etc/ntp file under conf is modified by me. conf configuration file. the following explains the meaning of some parameters: # Permit time synchronization with our time source, but do not # permit the source to query or modify the service on this system. restrict default kod nomodify notrap nopeer noquery # the default is to reject all ntp connections restrict-6 default kod nomodify notrap nopeer noquery # reject the ntp connection of the IP-V6 # Permit all access over the loopback interface. this cocould # be tightened as well, but to do so wocould effect some of # the administrative functions. restrict 127.0.0.1 # The service restrict-6: 1 # Hosts on local network are less restricted. restrict 192.168.20.mask limit 255.0 nomodify notrap # which network segments can Use this ntp pair for the service # Use public servers from the pool.ntp.org project. # Please consider joining the pool ( http://www.pool.ntp.org/join.html ). # Server route iburst # server 1.centos.pool.ntp.org iburst # server route iburstserver 2.cn.pool.ntp.org # Upper-layer ntp server time.nist.gov preferserver 1.cn.pool.ntp.org
4. operations on the time synchronization server
[Root @ linux-node1 ~] #/Etc/init. d/ntpd restartShutting down ntpd: [OK] Starting ntpd: [OK] [root @ linux-node1 ~] # Ntpq-p remote refid st t when poll reach delay offset jitter ==================== ========================================================== ================+ panel. gerardope 116.49.102.213 2 u 24 64 1 211.688-17.119 0.122 * time-d.nist.gov. ACTS. 1 u 22 64 1 348.603 3.607 0.122 static-5-103-12. GPS. 1 u 22 64 1 311.951-16.711 0.122 meaning: * indicates the upper-layer NTP + number in use. It indicates that the connection has been established successfully and a backup time synchronization server can be provided.
5. operations on the client
View the current time [root @ linux-node2 ~] # DateWed Jan 11 00:08:37 CST 2017 Update time [root @ linux-node2 ~] # Ntpdate 192.168.17.2323 Jan 20:33:13 ntpdate [27191]: step time server 192.168.17.23 offset 1110147.826055 sec Update time successful [root @ linux-node2 ~] # DateMon Jan 23 20:33:15 CST 2017
6. operate on a Windows Server
As shown in: