ubuntu vps同步网络时间的方法

最近发现购买的linux vps运行一段时间以后就会发生时间不准的情况。

可以利用ntp服务与网络时间进行同步,下面的方法适用于ubuntu系统。

方法:

 

网上同步时间

1.  安装ntpdate工具

# sudo apt-get install ntpdate

2.  设置系统时间与网络时间同步

# ntpdate cn.pool.ntp.org

3.  将系统时间写入硬件时间

# hwclock –systohc

注明:cn.pool.ntp.org是位于中国的公共NTP服务器,用此时间来同步本机的系统时间。

 

因为系统架构的原因,部分linux vps默认是不允许在客户在vps自行自行同步网络时间,当执行同步时间的操作时,会出现下列错误:

 

# ntpdate cn.pool.ntp.org

20 Aug 23:47:44 ntpdate[17991]: sendto(202.118.1.199): Operation not permitted

20 Aug 23:47:44 ntpdate[17991]: sendto(114.80.81.13): Operation not permitted

20 Aug 23:47:52 ntpdate[17991]: no server suitable for synchronization found

 

注:本文首发于度外网络官方博客:http://www.duwaiweb.com/blog/20120821_d584addf-bc39-43f8-bf21-d265fc638285.html

posted @ 2012-08-23 18:16  小查查  阅读(474)  评论(0编辑  收藏  举报