I am trying to setup my Debian 6 (Squeeze) VM to act as a local time server for my network. I have it set to sync with tock.usno.navy.mil which is a stratum 1 server.

I am having some problems finding any information on how to setup the ntp daemon to serve the time to clients requesting the time. I have looked through the ntpd man page and that was probably the best doc I found. support.ntp.org was pretty much useless to me, the documentation I found was talking more about how NTP works not how to configure a server.

I also noticed I am not getting anything in my logs about being synced with the server that I am listed.

Any help anyone can offer would be great, I am not sure what is wrong. I am sure it is something I am doing. I had a previous time server running but my SAN blew up and I was not making backups since it was for testing. So I have no old config to look at.

Here is a copy of ntp.conf since there is nothing in here that has a any personal information I thought posting might help.

# /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 mask notrap nomodify

# Local users may interrogate the ntp server more closely.
restrict ::1

# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
#restrict mask notrust

# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)

# 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

Here the output from 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

Output from 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


When I remove the line restrict mask notrap nomodify from my config ntp seems to spring to life. This is what I see now when I look at ntpq -p

     remote           refid      st t when poll reach   delay   offset  jitter
-barricade.rack9   2 u   39   64  377   37.887  -2977.7   3.180
*gallifrey.chpc.    2 u   26   64  377   68.155  -2969.0   3.024
+clock.trit.net    2 u    2   64  377   83.146  -2972.0   3.756
+ntp1.Housing.Be  3 u   63   64  377  105.803  -2972.6   2.698

Test Desktop ifconfig output (requested by MadHatter)

eth0      Link encap:Ethernet  HWaddr 08:00:27:59:2d:3a  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::a00:27ff:fe59:2d3a/64 Scope:Link
          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:  Mask:
          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)
  • As it does to some other posters, your NTP config seems fine to me, so I suspect firewalling. Could we get the output of iptables -L -n -v on the server and on the client that can't do an ntpdate? ifconfig -a from the client that can't ntpdate would also be helpful, just for completeness' sake. – MadHatter Apr 14 '11 at 6:33
  • added the iptables output – ianc1215 Apr 14 '11 at 6:37
  • I use a pfsense box to keep things out of my LAN. Even with my windows boxes I only run a LAN firewall if I see a reason. For Linux I keep it default. Mainly because I am still figuring things out. – ianc1215 Apr 14 '11 at 6:39
  • Linux default can be fairly tightly tied-down, depending on the distro. I presume the above iptables is from the server, could we get it from the debian desktop that failed to do "ntpdate"? Also, the ifconfig output from the desktop, as requested. – MadHatter Apr 14 '11 at 8:11
  • Well thats the thing the ntpdate on the desktop works fine as long I don't try to sync to my LAN server (The one that is not working). If I sync to time-a.nist.gov it works fine. If you still think a ifconfig output would help I will post it. – ianc1215 Apr 14 '11 at 8:33

You need to insure that udp port 123 is open inbound to your server from your LAN and back out to your LAN from your server.

Also, you can check the status of your server's sync by running

"ntpq -p"

I'd recommend adding at least three upstream servers to your config.

Try pointing one of your clients to your server via "ntpdate servername" and see what happens.

|improve this answer|||||
  • When I run ntpdate on my Debian 6 Desktop I get "14 Apr 02:22:51 ntpdate[6601]: no server suitable for synchronization found" – ianc1215 Apr 14 '11 at 6:24
  • I added the output from ntpq -p to my question – ianc1215 Apr 14 '11 at 6:26
  • firewall config on the server? – dmourati Apr 14 '11 at 6:36
  • I added the firewall output, there are no rules in it. Unless they are hidden or something. – ianc1215 Apr 14 '11 at 7:00
  • Stop ntpd, run ntpdate time.nist.gov. Your sync is off. You may need to run ntpdate twice. Add more ntp servers to your server then restart ntpd. Keep running ntpq -p until you see signs your server has optained a proper sync. See: man ntpq section on peers. Once you get that, try ntpdate from your client again. – dmourati Apr 14 '11 at 7:17

I agree with dmourati's answer. Your configuration seems correct. The only additional thing I'd recommend checking is whether your ntpd process is running at all.

With regard to documentation: I have recently set up a Meinberg GPS time card, and found their documentation quite helpful. For your use case, you'd just have to ignore all references to dedicated PCI cards and use a proper server name instead of the pseudo IP address that's used to refer to the PCI card.

However, I think you may be losing quite some precision by putting your local time server on a virtual machine. If you need sub-second precision on your network, be sure to measure the precision of your local server. The Time Nuts page may be a good starting point to look for approaches to this.

|improve this answer|||||
  • I don't need crazy actuate time, I am just using a time server to keep my entire network in sync with one clock. I could just sync to a server on the outside but this way I reduce the amount of traffic I am sending out. – ianc1215 Apr 14 '11 at 7:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.