All | 43 Folders | Accessibility | BoingBoing | Books | Computer Related | Family | Films | General | Hacking | Hobbies | Humor | Java | Links | Omni | OpenSolaris | Puzzles and Games

« Thaw Before Use | Main | LEGO Mindstorms »
20051129 Tuesday November 29, 2005

Time Synchronization Software

After starting to read Faster by James Gleick, an interesting book on how virtually everything we do nowadays has been accelerated, primarily due to the acceleration of new technology, I thought it was about time to try to setup something to automatically adjust the clocks on my computers, so that they are all synchronized with a time server on the Internet.

For years and years, this used to be really easy on my Solaris box at work. I just had to run (as root):

  # rdate datehost
The datehost machine seems to have now gone away.

So I started with a goggle for "time synchronization software" and saw that there was basically two good places to start: the ntp.org website or the NIST website. I decided to go with the latter.

I was able to download a simple Windows executable that allowed me to easily sync the time on my computer over the Internet with an NIST server:

I now needed a solution for my Solaris boxes at work. NIST also has an ftp site with various source code. I downloaded a read.me file, a Makefile, two source files ( sw.c and tcp_time_client.c).

Running:

  % make nistime

made the executable (after I'd fixed up the Makefile to include the missing libraries that are now needed to build simple network software such as this). When I tried to run it (as root), the connection was refused. We have a firewall here, so I simply ran it in conjunction with a script that would let me tunnel it through a SOCKS proxy. I then set it up with a cron job, so that this synchronization will automatically occur each night.

I should be able to compile and run the same program on my Mac and do something similar there.

But why is this so involved? Aren't we at an age now where all major OS software should have this time synchronisation software automatically installed and readily available?

Perhaps I'm just missing something obvious...

[]

[]

[]

( Nov 29 2005, 07:17:52 AM PST ) [Listen] Permalink Comments [12]

Comments:

Doesn't solaris come with xntpd ? Theres even a SMF service for it:

$ svcs -a | grep ntp
disabled        9:19:16 svc:/network/ntp:default
$ 

Posted by Sean on November 29, 2005 at 07:38 AM PST #

FYI, a default install of Ubuntu linux already time syncs with ntp.ubuntulinux.org on boot. Windows XP machines also attempt to sync with time.windows.com.

Posted by Ashley Hooper on November 29, 2005 at 07:54 AM PST #

Mac OS X has built-in support for NTP too, the server to sync with can be configured in the date/time preferences section. (The default NTP server is time.{,asia,euro}.apple.com, depending on your region.)

Posted by Bart on November 29, 2005 at 08:31 AM PST #

Windows XP does synchronize the clock with time.windows.com. Ubuntu, Fedora, OpenSuse, Mandrake and just about every major linux distribution I've tried use ntp at boot time to sync the clock. So yes, it's a pretty standard feature these days. That your Solaris boxes don't have it is rather surprising to me (I only know very little about Solaris). Cheers, Carlos

Posted by Carlos on November 29, 2005 at 08:35 AM PST #

Thanks everyone. It looks like it was obvious (some more obvious than others) and that it is there.

I actually did a "man -k ntp" on Solaris and that turned up nothing. Guess I should have done "man xntpd".

Posted by Rich Burridge on November 29, 2005 at 09:02 AM PST #

# ntpdate pool.ntp.org

Posted by ajax on November 29, 2005 at 09:39 AM PST #

You've already received several comments regarding this, but this didn't seem to be mentionned. You can still use rdate as you were before:
`rdate -s time.mit.edu`
I'm not sure if there are differences between rdate on solaris, however.

Posted by Chris Irwin on November 29, 2005 at 09:41 AM PST #

Thanks ajax, Chris. Both of these work nicely on Solaris (rdate doesn't support the -s option), if I bring my laptop on our wireless network (i.e. outside the firewall).

If I try them from behind the firewall (and try to tunnel through with the SOCKS proxy), I get:

# /export/home/richb/bin/runsocks rdate time.mit.edu
Host name time.mit.edu not found: node name or service name not known

# /export/home/richb/bin/runsocks ntpdate pool.ntp.org
29 Nov 10:05:10 ntpdate[1965]: no server suitable for synchronization found

What we really need is a time synchonisation server inside the firewall.

Posted by Rich Burridge on November 29, 2005 at 10:13 AM PST #

Thanks to Dave Anderson, I now know what I need to do on Solaris to make this work nicely from behind the firewall.

To enable this service, I need to (as root):

  # cp /etc/inet/ntp.client /etc/inet/ntp.conf

Then to actually run the date/time synchronisation, I need to (as root):

  # svcadm enable network/ntp

Somewhere on this side of the firewall, is an NTP server that's responding to my request.

Sure would be nice if there was something as simple at the Mac OS X Preferences -> Date & Time -> "Set date and time automatically" checkbox.

Posted by Rich Burridge on November 29, 2005 at 10:55 AM PST #

If you don't have an NTP server on your local network that responds to your broadcast, you can configure any ntp server by: 1. Finding a network-accessible NTP server that you can use (i.e. through the ntp.org server pool). 2. Configuring it through 'echo "server <my.favourite.server.domain>" > /etc/inet/ntp.conf' 3. Starting the ntp service through 'svcadm enable ntp' You can then observe the synchronization progress with 'ntpq -p'. Yes, a nice gnome-compliant tool to specify the preferred time server would be indeed a good idea.

Posted by Constantin Gonzalez on November 30, 2005 at 04:13 AM PST #

rdate is still there in Solaris, as /usr/bin/rdate. <p/> The linux version of rdate takes a server passed with the -s arguments, but the Solaris version does not. Just a simple
rdate $host
will work. <p/> For a server, I use time.nist.gov [192.43.244.18]. <p/> rdate will use TCP, and if your firewall allows return traffic to established connections, then runnning
rdate 192.43.244.18
will work for you. If you're behind a firewall, or on a network, that doesn't allow resolution of external DNS specify IP address, since they don't resolve external hosts, except through the webcaches. <p/> If it doesn't, and you have access to a server running ssh, with netcat installed, that lives outside your firewall, you could set up a dynamic ssh-tunnel to the remote host, to allow for a tunneled 'proxy' of your rdate traffic. I do this sometimes, for certain types of traffic.

Posted by TK on November 30, 2005 at 06:42 AM PST #

You can try this Network time synchronization software. Our office evaluates this one. Please notice, it's for Windows only. I guess it helps you.

Posted by Serge on December 12, 2005 at 12:53 PM PST #

Post a Comment:

Comments are closed for this entry.