文章目录
文件系统安装ntpdate
ntpdate -u 210.72.145.44 ——网络时间同步命令
注意:若不加上-u参数, 会出现以下提示:no server suitable for synchronization found
-u:从man ntpdate中可以看出-u参数可以越过防火墙与主机同步;
210.72.145.44:中国国家授时中心的官方服务器。
ntp常用服务器
中国国家授时中心:210.72.145.44
NTP服务器(上海) :ntp.api.bz
美国:time.nist.gov
复旦:ntp.fudan.edu.cn
微软公司授时主机(美国) :time.windows.com
台警大授时中心(台湾):asia.pool.ntp.org
经测试中国国家授时中心与NTP上海服务器可以正常同步时间,注意需要加上-u参数!
报错分析解决
运行命令后若出现
26 Jan 03:50:36 ntpdate[2699]: no servers can be used, exiting
没有开启网络,请开启网络
运行命令后若出现
26 Jan 03:51:21 ntpdate[2719]: no server suitable for synchronization found
210.72.145.44服务器同步不了,换个服务器
用ntpdate同步没有改对时间,因为时区不对, 用链接的方法,确定时区。
时区修改
未修改时区效果图
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime // 用软连接也行
//用软连接方法(便于复制)
rm /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
ls -l /etc/localtime
修改时区后效果图