Method 1:
Sync with a known time server
The code is as follows:
Ntpdate time.nist.gov
Where time.nist.gov is a time server.
Delete local time and set the time zone to Shanghai
The code is as follows:
Rm-rf/etc/localtime
Ln-s/usr/share/zoneinfo/asia/shanghai/etc/localtime
Method 2:
Linux Automatic sync time
Vi/etc/crontab
Add a sentence:
The code is as follows:
0 1 * * Root rdate-s time.nist.gov
Configure Time server configuration (192.168.10.1)
The 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
Join a line:
The code is as follows:
Restrict 192.168.10.0 mask 255.255.255.0 notrust nomodify
3), # Vi/etc/ntp/step-tickers
Join a line:
pool.ntp.org
This will automatically connect to the international Standard Time server each time the ntpd is started;
4), # service NTPD start
5), # Netstat-an |grep 123
Make sure that the port is open in UDP
Time Client Configuration (192.168.10.2)
1), # ntpdate 192.168.10.2
Should show sync success
2), # CROND-E
Join
The code is as follows:
0-59/10 * * * */usr/sbin/ntpdate 192.168.10.1
Sync time every 10 minutes