Time synchronization problem under Linux


Synchronize time 1:
rm -rf /etc/localtime remove local time
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime enable Shanghai time
/usr/sbin/ntpdate time.nist.gov Synchronize time

Method 2 :
linux automatically synchronizes time
vi /etc/crontab
with a sentence:


copy the code The
code is as follows:
00 0 1 * * root rdate -s time.nist.gov

configure the time server configuration (192.168.10.1)


copy the code The
code is as follows:

1), # rpm -ivh ntp-4.1.2-4.EL3.1.i386.rpm
2), # vi /etc/ntp.conf

Comment a line:
restrict default ignore
Add a line:


copy the code The
code is as follows:
restrict 192.168.10.0 mask 255.255 .255.0 notrust nomodify notrap

3), # vi /etc/ntp/step-tickers
add a line:
pool.ntp.org
In this way, every time ntpd starts, it will automatically connect to the international standard time server;

4), # service ntpd start

5), # netstat -an |grep 123
to ensure that the port is open in udp mode

Time client configuration (192.168.10.2)
1 ), # ntpdate 192.168.10.2
should show that the synchronization is successful
2), # crond -e is
added to


copy code The
code is as follows:
0-59/10 * * * * /usr/sbin/ntpdate 192.168.10.1 The

time is synchronized every 10 minutes

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326440309&siteId=291194637