Method 1:
Synchronizing with a known time server
Copy the code code as follows:
Ntpdate time.nist.gov
Where time.nist.gov is a time server.
Delete local time and set time zone to Shanghai
Copy the code code as follows:
Rm-rf/etc/localtimeln-s/usr/share/zoneinfo/asia/shanghai/etc/localtime
Method 2:
Linux Auto Sync time
Vi/etc/crontab
Add one sentence:
Copy the code code as follows:
XX 0 1 * * Root rdate-s time.nist.gov
Where Rdate itself is used to obtain time on the remote time server, with the-s parameter, you can apply the acquired time to the local system.
Configuring the Time server configuration (18.40.33.30)
Copy the code code as follows:
1), # RPM-IVH ntp-4.1.2-4.el3.1.i386.rpm
2), # vi/etc/ntp.conf
Comment Line:
Restrict default Ignore
Add a line:
Copy the code code as follows:
Restrict 18.40.33.0 mask 255.255.255.0 notrust nomodify notrap
3), # Vi/etc/ntp/step-tickers
Add 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
Ensure that the port is open in UDP mode
Time Client Configuration (18.40.33.36)
1), # ntpdate 18.40.33.36
Synchronization should be displayed successfully
2), # CROND-E
Join
Copy the code code as follows:
0-59/10 * * * */usr/sbin/ntpdate 192.168.10.1
Synchronize time every 10 minutes
This article is from "Operation and maintenance record Mei Ling" blog, please be sure to keep this source http://meiling.blog.51cto.com/6220221/1652675
Linux under Time synchronization