我试图设置我的Debian 6(Squeeze)虚拟机作为我的networking本地时间服务器。 我已经设置为tock.usno.navy.mil这是一个层1服务器同步。
我有一些问题find有关如何设置ntp守护程序服务时间的客户请求时间的任何信息。 我已经浏览了ntpd手册页,这可能是我find的最好的文档。 support.ntp.org对我来说几乎是无用的,我发现的文档更多地讨论了NTP如何工作,而不是如何configuration服务器。
我也注意到我没有得到任何关于与我列出的服务器同步的日志。
任何人可以提供的帮助将是伟大的,我不知道什么是错的。 我相信这是我正在做的事情。 我以前有一台服务器正在运行,但是我的SAN爆炸了,我没有做备份,因为它是用来testing的。 所以我没有旧的configuration来看看。
这里是一个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 # You do need to talk to an NTP server or two (or three). #server ntp.your-provider.example # pool.ntp.org maps to about 1000 low-stratum NTP servers. Your server will # pick a different set every time it starts up. Please consider joining the # pool: <http://www.pool.ntp.org/join.html> server tock.usno.navy.mil iburst # 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 restrict 10.0.0.0 mask 255.255.255.0 notrap nomodify # 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 192.168.123.0 mask 255.255.255.0 notrust # If you want to provide time to your local subnet, change the next line. # (Again, the address is an example only.) #broadcast 192.168.123.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
这里来自ntpq -p的输出
root@ns01:/home/ns01# ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== ntp1.usno.navy. .USNO. 1 u 43 64 1 34.747 -2891.0 1669.51
从iptables输出
Output from `iptables -L -n -v` Chain INPUT (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes) pkts bytes target prot opt in out source destination
更新
当我删除线restrict 10.0.0.0 mask 255.255.255.0 notrap nomodify从我的configurationntp restrict 10.0.0.0 mask 255.255.255.0 notrap nomodify似乎spring的生活。 这是我看到ntpq -p时所看到的
remote refid st t when poll reach delay offset jitter ============================================================================== -barricade.rack9 209.51.161.238 2 u 39 64 377 37.887 -2977.7 3.180 *gallifrey.chpc. 92.113.67.127 2 u 26 64 377 68.155 -2969.0 3.024 +clock.trit.net 204.34.198.41 2 u 2 64 377 83.146 -2972.0 3.756 +ntp1.Housing.Be 169.229.128.214 3 u 63 64 377 105.803 -2972.6 2.698
testing桌面ifconfig输出(由MadHatter请求)
eth0 Link encap:Ethernet HWaddr 08:00:27:59:2d:3a inet addr:10.0.0.21 Bcast:10.0.0.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe59:2d3a/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:62103 errors:0 dropped:0 overruns:0 frame:0 TX packets:51822 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:10339609 (9.8 MiB) TX bytes:7249927 (6.9 MiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:56 errors:0 dropped:0 overruns:0 frame:0 TX packets:56 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:5066 (4.9 KiB) TX bytes:5066 (4.9 KiB)
您需要确保udp端口123从您的LAN打开到您的服务器的入站,并从您的服务器返回到您的LAN。
另外,您可以通过运行来检查服务器的同步状态
“ntpq -p”
我build议添加至less三个上游服务器到您的configuration。
尝试通过“ntpdate servername”将你的客户端指向你的服务器,看看会发生什么。
我同意dmourati的回答。 你的configuration看起来正确。 我build议检查的唯一的额外的事情是你的ntpd进程是否在运行。
关于文件:我最近build立了一个Meinberg GPS时间卡,并发现他们的文件相当有帮助。 对于您的用例,您只需忽略对专用PCI卡的所有引用,并使用适当的服务器名称而不是用于引用PCI卡的伪IP地址。
但是,我认为你可能会失去一些精度,把你的本地时间服务器放在虚拟机上。 如果您的networking需要亚秒级精度,请务必测量本地服务器的精度。 时间坚果页面可能是寻找解决方法的一个很好的起点。