输入ntpdate time.nist.gov同步网络时间
如果未安装:yum install ntpdate
结果:3 Jun 15:42:39 ntpdate[4721]: adjust time server 211.115.194.21 offset -0.005885 sec
出现上述结果代表时间同步成功,上面的大致意思为调整时间为服务器211.115.194.21的时间,相差-0.005885秒的时间
如果上面time.nist.gov服务器同步不了,可以换下面几个时间服务器试试:time.nist.govtime.nuri.net0.asia.pool.ntp.org1.asia.pool.ntp.org2.asia.pool.ntp.org3.asia.pool.ntp.org
同步时间成功后调整硬件时间
#hwclock -w
执行成功后, 查看系统硬件时间(不出意外的话,现在date和hwclock现实的时间均为internet时间)
#date
#hwclock
执行上述命令,显示的时间应该一样的
定时执行时间同步任务,所以我们利用crontab -e 来添加定时任务
#* */1 * * * root ntpdatetime.nuri.net;hwclock -w
即:每隔一个小时同步一下internet时间。
或者在vi /etc/crontab 中添加
以下是一些可用的NTP服务器地址:
Name
|
IP |
Location |
210.72.145.44 |
210.72.145.44 |
中国(国家授时中心) |
133.100.11.8 |
133.100.11.8 |
日本(福冈大学) |
time-a.nist.gov |
129.6.15.28 |
NIST,Gaithersburg,Maryland |
time-b.nist.gov |
129.6.15.29 |
NIST,Gaithersburg,Maryland |
time-a.timefreq.bldrdoc.gov |
132.163.4.101 |
NIST,Boulder,Colorado |
time-b.timefreq.bldrdoc.gov |
132.163.4.102 |
NIST,Boulder,Colorado |
time-c.timefreq.bldrdoc.gov |
132.163.4.103 |
NIST,Boulder,Colorado |
utcnist.colorado.edu |
128.138.140.44 |
UniversityofColorado,Boulder |
time.nist.gov |
192.43.244.18 |
NCAR,Boulder,Colorado |
time-nw.nist.gov |
131.107.1.10 |
Microsoft,Redmond,Washington |
nist1.symmetricom.com |
69.25.96.13 |
Symmetricom,SanJose,California |
nist1-dc.glassey.com |
216.200.93.8 |
Abovenet,Virginia |
nist1-ny.glassey.com |
208.184.49.9 |
Abovenet,NewYorkCity |
nist1-sj.glassey.com |
207.126.98.204 |
Abovenet,SanJose,California |
nist1.aol-ca.truetime.com |
207.200.81.113 |
TrueTime,AOLfacility,Sunnyvale,California |
nist1.aol-va.truetime.com |
64.236.96.53 |
TrueTime,AOLfacility,Virginia |
|