arch linux 同步时间,linux – Arch ntpd / ntpdate不同步时钟
运行Arch的我的raspi没有用NTPD更新时间.我在跑
[root@fatpi ~]# cat /proc/version
Linux version 3.10.28-1-ARCH (nobody@root-armv6-copy) (gcc version 4.8.2 20131219 (prerelease) (GCC) ) #1 PREEMPT Tue Jan 28 15:46:05 MST 2014
所以我停止服务并尝试使用ntpdate更新,但“ntpdate -sb”将无法正常工作,奇怪的是“ntpdate -qd”将输出正确的日期&偏移:
[root@fatpi ~]# ntpdate -dq time.nist.gov
31 Dec 18:09:13 ntpdate[299]: ntpdate 4.2.6p5@1.2349-o Sat Jan 11 17:42:10 UTC 2014 (1)
Looking for host time.nist.gov and service ntp
host found : nist1-chi.ustiming.org
transmit(216.171.120.36)
receive(216.171.120.36)
transmit(216.171.120.36)
receive(216.171.120.36)
transmit(216.171.120.36)
receive(216.171.120.36)
transmit(216.171.120.36)
receive(216.171.120.36)
server 216.171.120.36, port 123
stratum 1, precision -29, leap 00, trust 000
refid [ACTS], delay 0.07671, dispersion 0.00000
transmitted 4, in filter 4
reference time: d69d8005.439fdedc Wed, Feb 5 2014 21:29:09.264
originate timestamp: d69d800c.753a297e Wed, Feb 5 2014 21:29:16.457
transmit timestamp: 83aa80af.2239d5e4 Wed, Dec 31 1969 18:09:19.133
filter delay: 0.07681 0.07671 0.07689 0.07681
0.00000 0.00000 0.00000 0.00000
filter offset: 13916567 13916567 13916567 13916567
0.000000 0.000000 0.000000 0.000000
delay 0.07671, dispersion 0.00000
offset 1391656797.298671
31 Dec 18:09:19 ntpdate[299]: step time server 216.171.120.36 offset 1391656797.298671 sec
当我的ntpd服务运行时,这是“ntpq”输出,refid不会从INIT状态改变,并且到达始终为0.
ntpq> peers
remote refid st t when poll reach delay offset jitter
==============================================================================
nist1.ny.certic .INIT. 16 u - 64 0 0.000 0.000 0.000
elara.mysnip.de .INIT. 16 u - 64 0 0.000 0.000 0.000
dsl-201-120-53- .INIT. 16 u - 64 0 0.000 0.000 0.000
golem.canonical .INIT. 16 u - 64 0 0.000 0.000 0.000
ntpq> as
ind assid status conf reach auth condition last_event cnt
===========================================================
1 22183 8011 yes no none reject mobilize 1
2 22184 8011 yes no none reject mobilize 1
3 22185 8011 yes no none reject mobilize 1
4 22186 8011 yes no none reject mobilize 1
ntpq>
我的/var/log/ntp.log读取:(没什么有趣的)
31 Dec 18:00:18 ntpd[124]: Deferring DNS for time.nist.gov 1
31 Dec 18:00:18 ntpd[124]: Deferring DNS for 0.pool.ntp.org 1
31 Dec 18:00:18 ntpd[124]: Deferring DNS for 1.pool.ntp.org 1
31 Dec 18:00:18 ntpd[124]: Deferring DNS for 2.pool.ntp.org 1
31 Dec 18:00:18 ntpd[124]: Deferring DNS for ntp.ubuntu.com 1
31 Dec 18:00:18 ntpd[132]: signal_no_reset: signal 17 had flags 4000000
31 Dec 18:00:20 ntpd[132]: host name not found: time.nist.gov
31 Dec 18:00:20 ntpd[132]: host name not found: 0.pool.ntp.org
31 Dec 18:00:20 ntpd[132]: host name not found: 1.pool.ntp.org
31 Dec 18:00:20 ntpd[132]: host name not found: 2.pool.ntp.org
31 Dec 18:00:20 ntpd[132]: host name not found: ntp.ubuntu.com
31 Dec 18:00:30 ntpd[124]: Listen normally on 2 eth0 192.168.0.104 UDP 123
31 Dec 18:00:30 ntpd[124]: peers refreshed
31 Dec 18:00:30 ntpd[124]: new interface(s) found: waking up resolver
31 Dec 18:00:32 ntpd[132]: DNS time.nist.gov -> 216.171.120.36
31 Dec 18:00:32 ntpd[132]: DNS 0.pool.ntp.org -> 201.120.27.5
31 Dec 18:00:32 ntpd[132]: DNS 1.pool.ntp.org -> 201.120.27.5
31 Dec 18:00:32 ntpd[132]: DNS 2.pool.ntp.org -> 201.120.27.5
31 Dec 18:00:32 ntpd[132]: DNS ntp.ubuntu.com -> 91.189.94.4
我已经改变了我的ntp.conf文件数十亿次,目前:
server time.nist.gov iburst
server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst
server 2.pool.ntp.org iburst
server ntp.ubuntu.com iburst
restrict default noquery nopeer
restrict 127.0.0.1
restrict ::1
driftfile /var/lib/ntp/ntp.drift
logfile /var/log/ntp.log
我的ntpd.service文件读取:
[Unit]
Description=Network Time Service
After=network.target nss-lookup.target
[Service]
Type=forking
PrivateTmp=true
PIDFile=/var/run/ntpd.pid
ExecStart=/usr/bin/ntpd -g -u ntp:ntp -p /var/run/ntpd.pid
Restart=always
[Install]
WantedBy=multi-user.target
我也安装了假hwclock但没有帮助(应该没关系,因为我的ntpd使用-g运行)
ntpd -q输出:
[root@fatpi ~]# ntpd -qd
ntpd 4.2.6p5@1.2349-o Sat Jan 11 17:42:09 UTC 2014 (1)
31 Dec 18:02:42 ntpd[296]: proto: precision = 1.000 usec
event at 0 0.0.0.0 c01d 0d kern kernel time sync enabled
Finished Parsing!!
31 Dec 18:02:42 ntpd[296]: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16
31 Dec 18:02:42 ntpd[296]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
31 Dec 18:02:42 ntpd[296]: Listen normally on 1 lo 127.0.0.1 UDP 123
restrict: op 1 addr 127.0.0.1 mask 255.255.255.255 mflags 00003000 flags 00000001
31 Dec 18:02:42 ntpd[296]: Listen normally on 2 eth0 192.168.0.104 UDP 123
restrict: op 1 addr 192.168.0.104 mask 255.255.255.255 mflags 00003000 flags 00000001
31 Dec 18:02:42 ntpd[296]: peers refreshed
31 Dec 18:02:42 ntpd[296]: Listening on routing socket on fd #19 for interface updates
restrict: op 1 addr 0.0.0.0 mask 0.0.0.0 mflags 00000000 flags 00000050
restrict: op 1 addr :: mask 0.0.0.0 mflags 00000000 flags 00000050
restrict: op 1 addr 127.0.0.1 mask 255.255.255.255 mflags 00000000 flags 00000000
31 Dec 18:02:42 ntpd[296]: restrict: error in address '::1' on line 12. Ignoring...
key_expire: at 0 associd 21204
peer_clear: at 0 next 1 associd 21204 refid INIT
event at 0 64.250.229.100 8011 81 mobilize assoc 21204
newpeer: 192.168.0.104->64.250.229.100 mode 3 vers 4 poll 6 10 flags 0x101 0x1 ttl 0 key 00000000
key_expire: at 0 associd 21205
peer_clear: at 0 next 2 associd 21205 refid INIT
event at 0 132.248.81.123 8011 81 mobilize assoc 21205
newpeer: 192.168.0.104->132.248.81.123 mode 3 vers 4 poll 6 10 flags 0x101 0x1 ttl 0 key 00000000
key_expire: at 0 associd 21206
peer_clear: at 0 next 3 associd 21206 refid INIT
event at 0 91.189.94.4 8011 81 mobilize assoc 21206
newpeer: 192.168.0.104->91.189.94.4 mode 3 vers 4 poll 6 10 flags 0x101 0x1 ttl 0 key 00000000
event at 0 0.0.0.0 c016 06 restart
event at 0 0.0.0.0 c012 02 freq_set kernel 0.000 PPM
event at 0 0.0.0.0 c011 01 freq_not_set
transmit: at 1 192.168.0.104->64.250.229.100 mode 3 len 48
auth_agekeys: at 1 keys 1 expired 0
transmit: at 2 192.168.0.104->132.248.81.123 mode 3 len 48
transmit: at 3 192.168.0.104->91.189.94.4 mode 3 len 48
transmit: at 66 192.168.0.104->64.250.229.100 mode 3 len 48
transmit: at 68 192.168.0.104->132.248.81.123 mode 3 len 48
transmit: at 69 192.168.0.104->91.189.94.4 mode 3 len 48
transmit: at 131 192.168.0.104->64.250.229.100 mode 3 len 48
transmit: at 133 192.168.0.104->91.189.94.4 mode 3 len 48
transmit: at 135 192.168.0.104->132.248.81.123 mode 3 len 48
transmit: at 197 192.168.0.104->91.189.94.4 mode 3 len 48
transmit: at 197 192.168.0.104->64.250.229.100 mode 3 len 48
transmit: at 202 192.168.0.104->132.248.81.123 mode 3 len 48
transmit: at 262 192.168.0.104->91.189.94.4 mode 3 len 48
transmit: at 263 192.168.0.104->64.250.229.100 mode 3 len 48
transmit: at 267 192.168.0.104->132.248.81.123 mode 3 len 48
transmit: at 327 192.168.0.104->91.189.94.4 mode 3 len 48
transmit: at 327 192.168.0.104->64.250.229.100 mode 3 len 48
transmit: at 331 192.168.0.104->132.248.81.123 mode 3 len 48
^C31 Dec 18:09:12 ntpd[296]: ntpd exiting on signal 2
[root@fatpi ~]#
但! ntpdate -buv WORKS !!!!
[root@fatpi ~]# ntpdate -bv ntp.ubuntu.com
31 Dec 18:11:18 ntpdate[299]: ntpdate 4.2.6p5@1.2349-o Sat Jan 11 17:42:10 UTC 2014 (1)
31 Dec 18:11:27 ntpdate[299]: no server suitable for synchronization found
[root@fatpi ~]# date
Wed Dec 31 18:11:52 CST 1969
[root@fatpi ~]# ntpdate -buv ntp.ubuntu.com
31 Dec 18:11:54 ntpdate[303]: ntpdate 4.2.6p5@1.2349-o Sat Jan 11 17:42:10 UTC 2014 (1)
6 Feb 14:31:00 ntpdate[303]: step time server 91.189.94.4 offset 1391717938.800589 sec
[root@fatpi ~]# date
Thu Feb 6 14:31:02 CST 2014
我想让它工作的是ntpdate的-u,它使用非特权端口.我读了ntpdate的-u选项的手册页,它说-d总是使用这个选项,这就是为什么我在我的ntpdate -dq命令上看到发送/接收/发送/接收 – 好吧,大NOPE!
我想端口udp 123转发是我现在应该检查的?
解决方法:
看起来NTP太远不同步(1391656797.298671)并且需要强制同步.
在ntpdate中使用-d选项时,它只是调试.它经历了所有步骤,但实际上并没有强制同步.
执行以下操作之一:
ntpd -q
要么
ntpdate -buv ntp.ubuntu.com
标签:linux,ntp,raspberry-pi,arch-linux,ntpd
来源: https://codeday.me/bug/20190809/1634280.html
arch linux 同步时间,linux – Arch ntpd / ntpdate不同步时钟相关推荐
- linux同步时间命令
linux同步时间命令: 1.hwclock命令,可以让系统时间和硬件时间的同步,例"hwclock -w"或"hwclock -s": 2.ntpdate命令 ...
- Linux同步时间chrony替换NTP简单好用
Linux同步时间chrony替换NTP简单好用 1.介绍 Chrony是一个开源自由的网络时间协议 NTP 的客户端和服务器软软件.它能让计算机保持系统时钟与时钟服务器(NTP)同步,因此让你的计算 ...
- arch linux 同步时间,ArchLinux 设置系统时间
ArchLinux是一个十分优秀的Linux发行版本,笔者曾经是Ubuntu Linux用户,最终放弃转型成ArchLinux,最近使用中发现ArchLinux的系统时间总是显示的不正确.但在安装的时 ...
- linux ntp端口 修改,Linux时间配置(修改时间 修改日期 ntpd ntpdate NTP socket exiting)...
修改linux的时间可以使用date指令 修改日期: 时间设定成2013年11月1日的命令如下: #date -s 01/11/2013 修改时间: 将系统时间设定成上午10点18分0秒的命令如下. ...
- Linux同步时间命令ntpdate
转自:http://orgcent.com/linux-ntpdate/ 由于要同步Linux服务器的时间,为了保证时间的高度准确性,放弃date命令而转向ntpdate(同步时间命令). 方案如下: ...
- linux ntpdate 查看同步时间,linux ntp ntpdate 同步时间
ntp同步时间实验 服务端IP 192.168.1.101 客户端 192.168.1.88 一.登录server端 1.首先配置ntpd服务 vi /etc/ntp.conf 配置文件中一般有res ...
- linux系统怎么样同步时间,Linux系统时间同步
在Linux环境下可以通过自带的NTP(Network Time Protocol)协议通过网络使系统保持精确时间, NTP是用来使系统和一个精确的时间源保持时间同步的协议.最好的方法是在自己管理的网 ...
- Linux同步时间的方法
方法一:非生产时使用 第一种是在所有机器上,使用连接工具的并发命令功能,同时运行修改时间命令,比如执行date -s "2019-05-25 17:00:00" ,这个方法适合自己 ...
- 每天凌晨2点同步时间linux,linux时间同步的几种方法
方法1:与一个已知的时间服务器同步 复制代码 代码如下: ntpdate time.nist.gov 其中 time.nist.gov 是一个时间服务器. 删除本地时间并设置时区为上海 复制代码 代码 ...
最新文章
- 预测----三个原则
- 广东2021高考成绩查询6,2021全国高考6月10日全部结束 预计最快6月23日可查高考成绩...
- AI“入侵”华尔街 高端职位也不保
- 腾讯GaiaStack容器平台负责人罗韩梅:All on GaiaStack
- iPhone开发【一】从HelloWorld開始
- java.线程池 线程数_如何在线程“ main”中修复异常java.lang.NoClassDefFoundError:Java中的org / slf4j / LoggerFactory...
- 【渝粤教育】国家开放大学2018年春季 0283-21T广告创意与表现(二) 参考试题
- instagram架构_如何为亚马逊,Instagram,Zalando和天猫生成产品图像
- LeetCode 5381. 查询带键的排列
- 生成指定位数的坐标方法-2优化版本--建议使用的版本
- 想起JDK1.4的死机事故
- MFC OpenCasCade – 实现View中的实体对象与右边属性窗口的关联
- python实现词语填空_Python实践练习:疯狂填词
- 入门vue+springboot项目
- 阿里 卫哲谈阿里人力招聘价值观
- Python-docx实战:同事要我帮忙补写178份日报!别吧
- 易捷行云超大规模云计算中心巡检“零干预”
- 一、ArcGIS Server篇:利用ArcGIS Server发布动态地图服务
- Python的字符串比较
- 程序人生(四):洋哥差点被开除的经历
热门文章
- 猴子吃桃c语言程序到第n天,猴子吃桃问题之《C语言经典案例分析》
- 编写一个程序,分别使用字符流和字节流拷贝一个文本文件。
- 参与国际化项目需遵循的java命名规范
- 【简单又有趣】Python五个迷你小项目,即学即用,还不赶紧码住(附源码)
- echarts:Cannot read property '0' of undefined / coords[i] is undefined / a[o] is undefined
- 云云网的谷歌系团队套现走人背后,可能是理想落地的痛苦转型
- C++:超市货架管理系统
- java+springboot+vue高校学生医疗保险管理系统
- 关于架构师和架构设计的一些常见误解
- Python下载文件到指定文件夹