In Linux, you can use the Network Time Protocol (NTP) to keep the system accurate over the Network. NTP is a Protocol used to keep the system synchronized with a precise Time source. The best way is to create at least one time server in your managed network to synchronize local time, which makes it easier to process and collect logs and manage them on different systems. Of course, there are also many free NTP clients for Windows. The available public time server address list can be queried at: http://ntp.isc.org/bin/view/servers/ntppoolservers. You can also set up your own time server.
1. Use a public time server
If you have used the public time service for synchronization, you only need to set a task in/etc/crontab to enable the server to automatically synchronize the public time server.
[Root @ localhost ~] $ Vi/etc/crontab
Add: 00 0 1 ** root rdate-s cn.pool.ntp.org --cn.pool.ntp.org as the public time server.
Ii. Use the local time server
Server Configuration
To use the local time server, you need to install the NTP package. You can obtain the installation package from the network and system installation CD. First, check whether the NTP package is installed on the server.
[Root @ localhost ~] $ Rpm-qa | grep ntp
/Etc/ntp. conf is the main configuration file of NTP. You can modify this file to set the domain name or IP address of the public time server synchronized by the local time server.
[Root @ localhost ~] $ Vi/etc/ntp. conf
Comment out the default restrict default nomodify notrap noquery line in the configuration file with "#" and add a line based on the local LAN information. For example, restrict 192.168.0.0 mask 255.255.0 nomodify notrap in this example, the mask address is extended to 255, so the NTP server can be used to synchronize time from the computer 192.168.0.1 -- 192.168.0.254, if ntp. if the conf contains the restrict default ignore line, comment it out. Otherwise, the configured local time server can only communicate with itself.
By default, the NTP server we configured does not synchronize the time from the time source, so we need to modify the/etc/ntp/step-tickers file and add it to our time Source: 0.pool.ntp.org. the time is automatically updated when the d/ntpd starts the service. NTP service startup command: service ntpd start
Client Configuration
[Root @ localhost ~] $ Ntpdate NTP server ip Address
[Root @ localhost ~] $ Crontab-e
Add: 0-59/10 * root/usr/sbin/ntpdate NTP server ip Address indicates the synchronization time every 10 minutes