Method 1:
Synchronizing with a known time server
Copy CodeThe code is as follows:ntpdate time.nist.govwhere time.nist.gov is a time server.
Delete local time and set time zone to Shanghai
Copy CodeThe code is as follows:rm-rf/etc/localtime ln-s/usr/share/zoneinfo/asia/shanghai/etc/localtime
Method 2: Linux automatic synchronization time Vi/etc/crontab plus one sentence:
Copy CodeThe code is as follows:XX 0 1 * * Root rdate-s time.nist.govConfiguring the time server Configuration (192.168.10.1)Copy CodeThe code is as follows:1), # RPM-IVH ntp-4.1.2-4.el3.1.i386.rpm 2), # vi/etc/ntp.conf
Comment Line: Restrict default ignore joins a line:
Copy CodeThe code is as follows:Restrict 192.168.10.0 mask 255.255.255.0 notrust nomodify notrap3), # Vi/etc/ntp/step-tickers Join a line: pool.ntp.org so every time ntpd start, will automatically connect to the international Standard Time server;
4), # service NTPD start
5), # Netstat-an |grep 123 Ensure that the port is open in UDP mode
Time Client Configuration (192.168.10.2) 1), # ntpdate 192.168.10.2 should show synchronization success 2), # CROND-E Join
Copy CodeThe code is as follows:0-59/10 * * * * /usr/sbin/ntpdate 192.168.10.1synchronize time every 10 minutes
Two ways to share time synchronization under Linux