1, install NTP service, to use time synchronization, then the server and client need to use the following command to install the NTP package
[root@5201351 ~]# Yum Install ntp-y
2, if only as a client, the configuration can be very simple, edit the/etc/ntp.conf file, comment out the default for the following default 4 lines
Plus the IP address or domain name of our time sync server, where the prefer option indicates the priority to use the time synchronization servers
#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//Where Iburst: When a transport NTP server is unavailable, it sends a series of concurrent packets for detection.
server 192.168.0.2
server 192.168.0.1 prefer
logfile/var/log/ntpd.log//Add log information, this is not a must option
3, and then restart the Ntpd.service service, you can to the superior NTP server for time synchronization
========NTP for service-side configuration >>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>
4, of course, in the work, perhaps we have more to configure their own server for NTP time synchronization server, so that other clients to synchronize
5, the same first step is also the need to install NTP services, as the NTP server, we need to add those IP can be time synchronization, here edit/etc/ntp.conf
Restrict 192.168.0.3///After the default restrict 127.0.0.1, add this to the Restrict 192.168.0.0 mask 255.255.255.0 the nomodify notrap
// You can also add it in this format
6, and finally restart the Ntpd.service service, you can let the designated network host and network segment for two steps.
#########################################################
A description of some other options in the configuration file is as follows:
Restrict default Kod nomodify notrap nopeer noquery//Deny IPV4 user, which defaults to no Kod restrict-6 defaulted kod
nomodify notrap n Opeer noquery//Deny IPV6 user restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap
//release specified segment
#########################################################
Finally, I will add the knowledge about the time in Linux >>>>>>>>
1, Linux time is divided into system time and hardware time, the system time can be viewed by the date command
And the hardware time needs to be viewed using the Hwclock or HWCLOCK-R command
2, set the system time: date-s "2016-01-15 15:58:00"
Set hardware time: Hwclock--set--date "2016-01-15 15:58:00"
3, System time--> sync to--> hardware time: hwclock-w
4, Hardware time--> sync to--> system time: Hwclock-s
The above is a small set to introduce the Linux time synchronization NTP service installation and configuration, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!