好的,我尝试将 Windows 客户端时钟同步到我刚刚设置的 ubuntu ntp 服务器,但是尝试时出现超时。
因此我进入 ubuntu 服务器并查看了 syslog:
Apr 10 13:15:01 nyborg ntpd[10608]: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16
Apr 10 13:15:01 nyborg ntpd[10608]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
Apr 10 13:15:01 nyborg ntpd[10608]: Listen and drop on 1 v6wildcard :: UDP 123
Apr 10 13:15:01 nyborg ntpd[10608]: Listen normally on 2 lo 127.0.0.1 UDP 123
Apr 10 13:15:01 nyborg ntpd[10608]: Listen normally on 3 eth0 172.16.0.5 UDP 123
Apr 10 13:15:01 nyborg ntpd[10608]: Listen normally on 4 lo ::1 UDP 123
Apr 10 13:15:01 nyborg ntpd[10608]: Listen normally on 5 eth0 fe80::21a:a0ff:fe34:8837 UDP 123
Apr 10 13:15:01 nyborg ntpd[10608]: peers refreshed
Apr 10 13:15:01 nyborg ntpd[10608]: Listening on routing socket on fd #22 for interface updates
Apr 10 13:15:01 nyborg kernel: [187221.088756] audit: type=1400 audit(1428664501.995:42): apparmor="DENIED" operation="open" profile="/usr/sbin/ntpd" name="/etc/ldap/ldap.conf" pid=10608 comm="ntpd" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
显然有些地方出了问题,但到底是什么呢?我的 ntp.conf 如下所示:
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
driftfile /var/lib/ntp/ntp.drift
# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
# Specify one or more NTP servers.
# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
server ntp2v6.unixnet.dk iburst
server fw2.unixnet.dk iburst
server 0.dk.pool.ntp.org
server 1.dk.pool.ntp.org
server 2.dk.pool.ntp.org
server 3.dk.pool.ntp.org
# Use Ubuntu's ntp server as a fallback.
server 127.127.1.0
fudge 127.127.1.0 stratum 10
# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details. The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
# might also be helpful.
#
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.
# By default, exchange time with everybody, but don't allow configuration.
#restrict -4 default kod notrap nomodify nopeer noquery
#restrict -6 default kod notrap nomodify nopeer noquery
# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1
# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
restrict 172.16.0.0 mask 255.255.255.0 notrust nomodify notrap
# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)
#broadcast 172.16.0.255
# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines. Please do this only if you trust everybody on the network!
#disable auth
#broadcastclient
我将正在使用的日志文件移至新的日志文件,以获得更好的概览:
# cat /var/log/ntp.log
10 Apr 13:50:54 ntpd[1483]: proto: precision = 0.109 usec
10 Apr 13:50:54 ntpd[1483]: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16
10 Apr 13:50:54 ntpd[1483]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
10 Apr 13:50:54 ntpd[1483]: Listen and drop on 1 v6wildcard :: UDP 123
10 Apr 13:50:54 ntpd[1483]: Listen normally on 2 lo 127.0.0.1 UDP 123
10 Apr 13:50:54 ntpd[1483]: Listen normally on 3 eth0 172.16.0.5 UDP 123
10 Apr 13:50:54 ntpd[1483]: Listen normally on 4 lo ::1 UDP 123
10 Apr 13:50:54 ntpd[1483]: Listen normally on 5 eth0 fe80::21a:a0ff:fe34:8837 UDP 123
10 Apr 13:50:54 ntpd[1483]: peers refreshed
10 Apr 13:50:54 ntpd[1483]: Listening on routing socket on fd #22 for interface updates
编辑
当 WINDOWSCLIENT 尝试更新 dps 时,我从 cpdump -i any udp 中得到了此信息。其他服务器也尝试更新,但它们也遇到了一些问题:
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked), capture size 65535 bytes
13:13:18.526244 IP 172.16.0.184.17500 > 255.255.255.255.17500: UDP, length 115
13:13:18.526432 IP 172.16.0.184.17500 > 172.16.0.255.17500: UDP, length 115
13:13:19.242393 IP nyborg.mosek.intranet.46027 > braintree.mosek.intranet.0.16.172.in-addr.arpa.domain: 8414+ PTR? 255.255.255.255.in-addr.arpa. (46)
13:13:19.242879 IP braintree.mosek.intranet.0.16.172.in-addr.arpa.domain > nyborg.mosek.intranet.46027: 8414* 0/1/0 (109)
13:13:19.242971 IP nyborg.mosek.intranet.40335 > braintree.mosek.intranet.0.16.172.in-addr.arpa.domain: 26524+ PTR? 184.0.16.172.in-addr.arpa. (43)
13:13:19.243208 IP braintree.mosek.intranet.0.16.172.in-addr.arpa.domain > nyborg.mosek.intranet.40335: 26524 NXDomain* 0/1/0 (118)
13:13:19.243289 IP nyborg.mosek.intranet.33337 > braintree.mosek.intranet.0.16.172.in-addr.arpa.domain: 5477+ PTR? 255.0.16.172.in-addr.arpa. (43)
13:13:19.243535 IP braintree.mosek.intranet.0.16.172.in-addr.arpa.domain > nyborg.mosek.intranet.33337: 5477 NXDomain* 0/1/0 (118)
13:13:20.244690 IP nyborg.mosek.intranet.37520 > braintree.mosek.intranet.0.16.172.in-addr.arpa.domain: 23672+ PTR? 6.0.16.172.in-addr.arpa. (41)
13:13:20.245129 IP braintree.mosek.intranet.0.16.172.in-addr.arpa.domain > nyborg.mosek.intranet.37520: 23672* 1/1/1 PTR braintree.mosek.intranet.0.16.172.in-addr.arpa. (134)
13:13:22.280353 IP WINDOWSCLIENT.mosek.intranet.ntp > nyborg.mosek.intranet.ntp: NTPv3, Client, length 48
13:13:23.178671 IP lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns > nyborg.mosek.intranet.netbios-ns: NBT UDP PACKET(137): REGISTRATION; REQUEST; UNICAST
13:13:23.178771 IP nyborg.mosek.intranet.netbios-ns > lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns: NBT UDP PACKET(137): REGISTRATION; NEGATIVE; RESPONSE; UNICAST
13:13:23.248569 IP nyborg.mosek.intranet.41512 > braintree.mosek.intranet.0.16.172.in-addr.arpa.domain: 38558+ PTR? 187.0.16.172.in-addr.arpa. (43)
13:13:23.248990 IP braintree.mosek.intranet.0.16.172.in-addr.arpa.domain > nyborg.mosek.intranet.41512: 38558* 1/1/1 PTR WINDOWSCLIENT.mosek.intranet. (125)
13:13:23.249081 IP nyborg.mosek.intranet.34660 > braintree.mosek.intranet.0.16.172.in-addr.arpa.domain: 29792+ PTR? 24.0.16.172.in-addr.arpa. (42)
13:13:23.249285 IP braintree.mosek.intranet.0.16.172.in-addr.arpa.domain > nyborg.mosek.intranet.34660: 29792* 1/1/1 PTR lyngby.mosek.intranet.0.16.172.in-addr.arpa. (132)
13:13:25.816123 IP harbinger.mosek.intranet.17500 > 255.255.255.255.17500: UDP, length 208
13:13:25.816446 IP harbinger.mosek.intranet.17500 > 172.16.0.255.17500: UDP, length 208
13:13:26.252742 IP nyborg.mosek.intranet.41476 > braintree.mosek.intranet.0.16.172.in-addr.arpa.domain: 62713+ PTR? 179.0.16.172.in-addr.arpa. (43)
13:13:26.253174 IP braintree.mosek.intranet.0.16.172.in-addr.arpa.domain > nyborg.mosek.intranet.41476: 62713* 1/1/1 PTR harbinger.mosek.intranet. (121)
13:13:34.817328 IP nyborg.mosek.intranet.ntp > 80-71-132-103.u.parknet.dk.ntp: NTPv4, Client, length 48
13:13:35.263075 IP nyborg.mosek.intranet.60768 > braintree.mosek.intranet.0.16.172.in-addr.arpa.domain: 37714+ PTR? 103.132.71.80.in-addr.arpa. (44)
13:13:35.263525 IP braintree.mosek.intranet.0.16.172.in-addr.arpa.domain > nyborg.mosek.intranet.60768: 37714 1/13/0 PTR 80-71-132-103.u.parknet.dk. (295)
13:13:45.190397 IP lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns > nyborg.mosek.intranet.netbios-ns: NBT UDP PACKET(137): REGISTRATION; REQUEST; UNICAST
13:13:45.190502 IP nyborg.mosek.intranet.netbios-ns > lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns: NBT UDP PACKET(137): REGISTRATION; NEGATIVE; RESPONSE; UNICAST
13:13:46.095484 IP harbinger.mosek.intranet.ntp > nyborg.mosek.intranet.ntp: NTPv4, Client, length 48
13:13:46.192479 IP lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns > nyborg.mosek.intranet.netbios-ns: NBT UDP PACKET(137): REGISTRATION; REQUEST; UNICAST
13:13:46.192490 IP lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns > nyborg.mosek.intranet.netbios-ns: NBT UDP PACKET(137): REGISTRATION; REQUEST; UNICAST
13:13:46.192544 IP lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns > nyborg.mosek.intranet.netbios-ns: NBT UDP PACKET(137): REGISTRATION; REQUEST; UNICAST
13:13:46.192564 IP nyborg.mosek.intranet.netbios-ns > lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns: NBT UDP PACKET(137): REGISTRATION; NEGATIVE; RESPONSE; UNICAST
13:13:46.192599 IP lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns > nyborg.mosek.intranet.netbios-ns: NBT UDP PACKET(137): REGISTRATION; REQUEST; UNICAST
13:13:46.192626 IP lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns > nyborg.mosek.intranet.netbios-ns: NBT UDP PACKET(137): REGISTRATION; REQUEST; UNICAST
13:13:46.192641 IP nyborg.mosek.intranet.netbios-ns > lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns: NBT UDP PACKET(137): REGISTRATION; NEGATIVE; RESPONSE; UNICAST
13:13:46.192684 IP lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns > nyborg.mosek.intranet.netbios-ns: NBT UDP PACKET(137): REGISTRATION; REQUEST; UNICAST
13:13:46.192733 IP nyborg.mosek.intranet.netbios-ns > lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns: NBT UDP PACKET(137): REGISTRATION; NEGATIVE; RESPONSE; UNICAST
13:13:46.192736 IP lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns > nyborg.mosek.intranet.netbios-ns: NBT UDP PACKET(137): REGISTRATION; REQUEST; UNICAST
13:13:46.192742 IP lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns > nyborg.mosek.intranet.netbios-ns: NBT UDP PACKET(137): REGISTRATION; REQUEST; UNICAST
13:13:46.192807 IP nyborg.mosek.intranet.netbios-ns > lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns: NBT UDP PACKET(137): REGISTRATION; NEGATIVE; RESPONSE; UNICAST
13:13:46.192874 IP lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns > nyborg.mosek.intranet.netbios-ns: NBT UDP PACKET(137): REGISTRATION; REQUEST; UNICAST
13:13:46.192879 IP lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns > nyborg.mosek.intranet.netbios-ns: NBT UDP PACKET(137): REGISTRATION; REQUEST; UNICAST
13:13:46.192880 IP nyborg.mosek.intranet.netbios-ns > lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns: NBT UDP PACKET(137): REGISTRATION; NEGATIVE; RESPONSE; UNICAST
13:13:46.192882 IP lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns > nyborg.mosek.intranet.netbios-ns: NBT UDP PACKET(137): REGISTRATION; REQUEST; UNICAST
13:13:46.192885 IP lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns > nyborg.mosek.intranet.netbios-ns: NBT UDP PACKET(137): REGISTRATION; REQUEST; UNICAST
13:13:46.192904 IP lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns > nyborg.mosek.intranet.netbios-ns: NBT UDP PACKET(137): REGISTRATION; REQUEST; UNICAST
13:13:46.192951 IP nyborg.mosek.intranet.netbios-ns > lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns: NBT UDP PACKET(137): REGISTRATION; NEGATIVE; RESPONSE; UNICAST
13:13:46.192980 IP lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns > nyborg.mosek.intranet.netbios-ns: NBT UDP PACKET(137): REGISTRATION; REQUEST; UNICAST
13:13:46.193024 IP nyborg.mosek.intranet.netbios-ns > lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns: NBT UDP PACKET(137): REGISTRATION; NEGATIVE; RESPONSE; UNICAST
13:13:46.193097 IP nyborg.mosek.intranet.netbios-ns > lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns: NBT UDP PACKET(137): REGISTRATION; NEGATIVE; RESPONSE; UNICAST
13:13:46.193168 IP nyborg.mosek.intranet.netbios-ns > lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns: NBT UDP PACKET(137): REGISTRATION; NEGATIVE; RESPONSE; UNICAST
13:13:46.193240 IP nyborg.mosek.intranet.netbios-ns > lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns: NBT UDP PACKET(137): REGISTRATION; NEGATIVE; RESPONSE; UNICAST
13:13:46.193312 IP nyborg.mosek.intranet.netbios-ns > lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns: NBT UDP PACKET(137): REGISTRATION; NEGATIVE; RESPONSE; UNICAST
13:13:46.193384 IP nyborg.mosek.intranet.netbios-ns > lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns: NBT UDP PACKET(137): REGISTRATION; NEGATIVE; RESPONSE; UNICAST
13:13:46.193456 IP nyborg.mosek.intranet.netbios-ns > lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns: NBT UDP PACKET(137): REGISTRATION; NEGATIVE; RESPONSE; UNICAST
13:13:46.193528 IP nyborg.mosek.intranet.netbios-ns > lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns: NBT UDP PACKET(137): REGISTRATION; NEGATIVE; RESPONSE; UNICAST
13:13:48.597539 IP 172.16.0.184.17500 > 255.255.255.255.17500: UDP, length 115
13:13:48.597728 IP 172.16.0.184.17500 > 172.16.0.255.17500: UDP, length 115
13:13:50.155399 IP rungsted.mosek.intranet.51728 > 172.16.0.255.netbios-ns: NBT UDP PACKET(137): QUERY; REQUEST; BROADCAST
13:13:50.158336 IP hellerup.mosek.intranet.61275 > 172.16.0.255.netbios-ns: NBT UDP PACKET(137): QUERY; REQUEST; BROADCAST
13:13:50.280232 IP nyborg.mosek.intranet.49605 > braintree.mosek.intranet.0.16.172.in-addr.arpa.domain: 57245+ PTR? 116.0.16.172.in-addr.arpa. (43)
13:13:50.280516 IP braintree.mosek.intranet.0.16.172.in-addr.arpa.domain > nyborg.mosek.intranet.49605: 57245* 1/1/1 PTR rungsted.mosek.intranet. (120)
13:13:50.280599 IP nyborg.mosek.intranet.50498 > braintree.mosek.intranet.0.16.172.in-addr.arpa.domain: 31333+ PTR? 199.0.16.172.in-addr.arpa. (43)
13:13:50.280798 IP braintree.mosek.intranet.0.16.172.in-addr.arpa.domain > nyborg.mosek.intranet.50498: 31333* 1/1/1 PTR hellerup.mosek.intranet. (120)
13:13:50.812825 IP hellerup.mosek.intranet.64597 > 172.16.0.255.netbios-ns: NBT UDP PACKET(137): QUERY; REQUEST; BROADCAST
13:13:50.812859 IP nyborg.mosek.intranet.netbios-ns > hellerup.mosek.intranet.64597: NBT UDP PACKET(137): QUERY; POSITIVE; RESPONSE; UNICAST
13:13:51.147948 IP rungsted.mosek.intranet.50867 > 172.16.0.255.netbios-ns: NBT UDP PACKET(137): QUERY; REQUEST; BROADCAST
13:13:51.148020 IP nyborg.mosek.intranet.netbios-ns > rungsted.mosek.intranet.50867: NBT UDP PACKET(137): QUERY; POSITIVE; RESPONSE; UNICAST
13:13:51.165127 IP rungsted.mosek.intranet.netbios-ns > 172.16.0.255.netbios-ns: NBT UDP PACKET(137): QUERY; REQUEST; BROADCAST
13:13:51.167440 IP nyborg.mosek.intranet.netbios-ns > rungsted.mosek.intranet.netbios-ns: NBT UDP PACKET(137): QUERY; POSITIVE; RESPONSE; UNICAST
13:13:51.167737 IP rungsted.mosek.intranet.netbios-dgm > 172.16.0.255.netbios-dgm: NBT UDP PACKET(138)
13:13:51.167796 IP nyborg.mosek.intranet.netbios-dgm > rungsted.mosek.intranet.netbios-dgm: NBT UDP PACKET(138)
13:13:51.168005 IP rungsted.mosek.intranet.netbios-ns > nyborg.mosek.intranet.netbios-ns: NBT UDP PACKET(137): QUERY; REQUEST; UNICAST
13:13:51.168260 IP nyborg.mosek.intranet.netbios-ns > rungsted.mosek.intranet.netbios-ns: NBT UDP PACKET(137): QUERY; POSITIVE; RESPONSE; UNICAST
13:13:51.173059 IP hellerup.mosek.intranet.netbios-ns > 172.16.0.255.netbios-ns: NBT UDP PACKET(137): QUERY; REQUEST; BROADCAST
13:13:51.173115 IP nyborg.mosek.intranet.netbios-ns > hellerup.mosek.intranet.netbios-ns: NBT UDP PACKET(137): QUERY; POSITIVE; RESPONSE; UNICAST
13:13:51.174035 IP hellerup.mosek.intranet.netbios-dgm > 172.16.0.255.netbios-dgm: NBT UDP PACKET(138)
13:13:51.174091 IP nyborg.mosek.intranet.netbios-dgm > hellerup.mosek.intranet.netbios-dgm: NBT UDP PACKET(138)
13:13:51.174990 IP hellerup.mosek.intranet.netbios-ns > nyborg.mosek.intranet.netbios-ns: NBT UDP PACKET(137): QUERY; REQUEST; UNICAST
13:13:51.175106 IP nyborg.mosek.intranet.netbios-ns > hellerup.mosek.intranet.netbios-ns: NBT UDP PACKET(137): QUERY; POSITIVE; RESPONSE; UNICAST
13:13:53.176582 IP lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns > nyborg.mosek.intranet.netbios-ns: NBT UDP PACKET(137): REGISTRATION; REQUEST; UNICAST
13:13:53.176775 IP nyborg.mosek.intranet.netbios-ns > lyngby.mosek.intranet.0.16.172.in-addr.arpa.netbios-ns: NBT UDP PACKET(137): REGISTRATION; NEGATIVE; RESPONSE; UNICAST
13:13:53.957745 IP harbinger.mosek.intranet.17500 > 255.255.255.255.17500: UDP, length 208
13:13:53.958414 IP harbinger.mosek.intranet.17500 > 172.16.0.255.17500: UDP, length 208
答案1
您的 Ubuntu 计算机似乎有一些防火墙规则阻止传入的 NTP 流量。您可以发出命令iptables -F
并重新尝试同步 Windows 计算机吗?