Setting Up NTP for Time Sync

Discussion in 'Linux Networking' started by W. Watson, Jan 5, 2005.

  1. W. Watson

    prg Guest

    I'm off to run some errands, but thought I would drop this note real
    quick.

    I've been reading more closely the MS docs I linked to (and doing some
    googling) and you need to make sure that your XP registry has been set
    up according to these MS instructions:

    http://support.microsoft.com/?kbid=314054#EXTERNAL

    Except for one entry/value pair they are the same entries required for
    W2K3 Server -- which makes since as the SP2 update was meant to update
    XP Pro to be a "complete" client/workstation for a W2K3 domain.

    Also, in your /etc/ntp.conf file locate your server entry and add the
    version switch:

    server 192.168.0.3 version 3

    May or may not help -- I can't confirm.

    Also, if XP has two nics, make sure the w32time (ntpd) server is
    listening for traffic on the Linux nic (not sure if this could be a
    problem or not) and make sure that your XP firewall (if you're running
    one) allows UDP traffic on port 123 for the ntpd service.

    Since you can get a synch on RH9 via the redhat servers, we know that
    Linux is OK. At this stage don't make too many changes at once or a
    boo-boo can be _very_ hard to locate. Go easy and test along the way
    :)

    Found this stratum 2 server with open access _and_ it's near you:
     
    prg, Jan 8, 2005
    #41
    1. Advertisements

  2. W. Watson

    W. Watson Guest

    It's a possibility. I passed on it a few weeks ago when I googled into it. Actually,
    several months ago. I was concerned about making lots of reg changes, but now I know
    how to back up the reg. There's another such note about this that only involves the
    LocalNTP entry. I tried it without any results, so reset it. I'll consider the one above.
    I think I may have tried it the other day. I recall looking at one for HP, but may
    not have. For the moment, your list from another msg and the clock1.redhat.com one
    are good enough for testing. At this point, accuracy is not an issue.
     
    W. Watson, Jan 8, 2005
    #42
    1. Advertisements

  3. W. Watson

    W. Watson Guest

    I've posted the result before, but I think it's gotten swept up by the many branched
    thread this has evolved into. I'm going to start trimming very soon.

    I believe it said, "no servers exisiting, exited". No one has yet to tell me what
    that means. I can put anything after -d and get the same message. I've used the names
    of the XP and Linux machine with the same result.

    I was a little off when I made the statement that the focus was on ntpdate. I meant
    to say the focus is on why Linux cannot successfully ask XP to reveal the time?
    Here's the point, made in another recent post:
    ================
    Here's what I know at the moment. From the Linux machine, I can fire up
    redhat-config-date (I think that's the right name for the tool). I can specify a
    location for the ntp server. One of them, which I added to the list, is 192.168.0.3,
    which is my XP machine. Another, provided by RH, is clock1.redhat.com.

    I deliberately set the clock off by 15 seconds. If I specify 192.xxxx, I do not get
    any correction. I then dial into my ISP from the Linux machine (note that the final
    machine for the synch is not going to have a modem or otherwise any internet
    connection.) I now use the tool again, but specify the clock1 entry. It resets the
    clock to the correct time. I again set the clock off by 10 seconds or so, and do the
    same with 192.xxxxx. Nothing. Either XP isn't set up to deal with NTP or the request
    never makes it to XP. The question remains, why doesn't this work?
    ================
    I had a few shots with ntpdate earlier, and abandoned it when I got no help on the
    above message.
    --
    Wayne T. Watson (Watson Adventures, Prop., Nevada City, CA)
    (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
    Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet

    Web Page: <home.earthlink.net/~mtnviews>
     
    W. Watson, Jan 8, 2005
    #43
  4. Samba? It's a file and printer sharing software that has absolutely
    nothing to do with ntp synching. prg asked for the _ntp_ configuration
    file.
     
    Markku Kolkka, Jan 8, 2005
    #44
  5. W. Watson

    W. Watson Guest

    .... snip

    Here's what it really said, "no servers can be used. exiting."

    As I booted up the Linux machine, I noticed a "not synched" message, and dug it out
    of the /var/log/messages. It said, "No server suitable for synchronization found."
    That was generated by ntpdate during bootup and after ntpd had been fired up.


    --
    Wayne T. Watson (Watson Adventures, Prop., Nevada City, CA)
    (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
    Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet

    Web Page: <home.earthlink.net/~mtnviews>
     
    W. Watson, Jan 8, 2005
    #45
  6. W. Watson

    W. Watson Guest

    Good catch. I was in my Samba mode when I saw his message. Here's the attached.

    --
    Wayne T. Watson (Watson Adventures, Prop., Nevada City, CA)
    (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
    Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet

    Web Page: <home.earthlink.net/~mtnviews>


    # Prohibit general access to this service.
    restrict default ignore
    restrict 192.168.0.3 mask 255.255.255.255 nomodify notrap noquery

    # Permit all access over the loopback interface. This could
    # be tightened as well, but to do so would effect some of
    # the administrative functions.
    restrict 127.0.0.1


    # -- CLIENT NETWORK -------
    # Permit systems on this network to synchronize with this
    # time service. Do not permit those systems to modify the
    # configuration of this service. Also, do not use those
    # systems as peers for synchronization.
    # restrict 192.168.1.0 mask 255.255.255.0 notrust nomodify notrap


    # --- OUR TIMESERVERS -----
    # or remove the default restrict line
    # Permit time synchronization with our time source, but do not
    # permit the source to query or modify the service on this system.

    # restrict mytrustedtimeserverip mask 255.255.255.255 nomodify notrap noquery
    # server mytrustedtimeserverip



    # --- NTP MULTICASTCLIENT ---
    #multicastclient # listen on default 224.0.1.1
    # restrict 224.0.1.1 mask 255.255.255.255 notrust nomodify notrap
    # restrict 192.168.1.0 mask 255.255.255.0 notrust nomodify notrap



    # --- GENERAL CONFIGURATION ---
    #
    # Undisciplined Local Clock. This is a fake driver intended for backup
    # and when no outside source of synchronized time is available. The
    # default stratum is usually 3, but in this case we elect to use stratum
    # 0. Since the server line does not have the prefer keyword, this driver
    # is never used for synchronization, unless no other other
    # synchronization source is available. In case the local host is
    # controlled by some external source, such as an external oscillator or
    # another protocol, the prefer keyword would cause the local host to
    # disregard all other synchronization sources, unless the kernel
    # modifications are in use and declare an unsynchronized condition.
    #
    server 192.168.0.3
    fudge 127.127.1.0 stratum 10

    #
    # Drift file. Put this in a directory which the daemon can write to.
    # No symbolic links allowed, either, since the daemon updates the file
    # by creating a temporary in the same directory and then rename()'ing
    # it to the file.
    #
    driftfile /etc/ntp/drift
    broadcastdelay 0.008

    #
    # Authentication delay. If you use, or plan to use someday, the
    # authentication facility you should make the programs in the auth_stuff
    # directory and figure out what this number should be on your machine.
    #
    authenticate yes

    #
    # Keys file. If you want to diddle your server at run time, make a
    # keys file (mode 600 for sure) and define the key number to be
    # used for making requests.
    #
    # PLEASE DO NOT USE THE DEFAULT VALUES HERE. Pick your own, or remote
    # systems might be able to reset your clock at will. Note also that
    # ntpd is started with a -A flag, disabling authentication, that
    # will have to be removed as well.
    #
    keys /etc/ntp/keys
     
    W. Watson, Jan 8, 2005
    #46
  7. W. Watson

    Marius Guest

    But you can... See your text below.
    OK. So you specified two possible time sources for testing. Good.
    So you observe, that you don't get time corrections from your XP.
    Non conclusive yet.
    So here you observe, that using another time source you _do_ get
    time corrected on your Linux box. Good.
    Conclusion 1: NTP synch _works_ for your Linux box _with_ _a_
    _working_ _time_ _server_.
    Here you repeat your first test, but this time with an
    added knowledge of NTP sync working with another source.
    Non conclusive yet, but your following assertions:
    are valid.
    1) check networking:
    - can you ping your XP box from your Linux box?
    - other way round as well?
    - using names as well as IP numbers?
    - can you transfer some data between both boxes?
    (Samba, www, etc.?)

    Only after you positively verified each step from '1'
    do:

    2) Is NTP _server_ installed and configured on XP?
    (how to check this one is up to you. I don't do windows).

    HTH.
    Marius

    PS: Reading this veeery lengthy thread reminded me of an
    old joke. Disclaimer: absolutely no offence meant.

    Holmes and Watson went for a night out camping.
    They went to sleep in their tent.
    In the middle of the night Holmes silently wakes up Watson
    and asks him to look up and describe what he sees.
    Watson looks up and begins to describe how beautiful the
    starlit night sky is, and how many stars there are and how
    romantic and scientific the wiew is...
    Holmes impatiently interrupts him saying "you fool! don't you
    _see_ that someone stole our tent?" :)
     
    Marius, Jan 9, 2005
    #47
  8. W. Watson

    W. Watson Guest

    Yes, easily done.
    I just tried ping \\astropc2004 (the Linux box). couldn't find it, but that may not
    be an acceptable command. Maybe only 192.168.0.1.
    The net view (cmd line op) command shows both computers with their \\ names.
    I can connect to the internet with either machine and download. I haven't quite
    figured out how to use Samba yet. If I boot up on the alternate OS, Win2k, on the
    Linux box, I can easily transfer data between W2k and XP.
    Good question. I was just beginning to look into this at the request of another
    posterer, and found via Help a command called net time.
    (
    Net timeSynchronizes the computer's clock with that of another computer or domain.
    Used without parameters, net time displays the time for another computer or domain.
    ....
    /querysntp
    Displays the name of the Network Time Protocol (NTP) server currently configured for
    the local computer or the one specified in ComputerName.
    )

    Executing net time /querysntp produces the result:
    The current sntp value is time.windows.com, 0x1

    Another bit of help from XP:
    Your personal or network firewall prevents clock synchronization. Most corporate and
    organizational firewalls will block time synchronization, as do some personal
    firewalls. Home users should read the firewall documentation for information about
    unblocking network time protocol (NTP). You should be able to synchronize your clock
    if you switch to Windows Firewall.

    I updated with SP2 recently, which has the new MS firewall. I had to remove McAfee in
    the process, so use MS at the moment. A few days ago, I just disabled it for about 10
    minutes, but got the same results as above. No time set from XP. Otherwise, I really
    do not know how (yet) to just open a hole to NTP on XP when the firewall is up.
    Yes, definitely one of the better jokes around. BTW, the need for time is driven by
    astronomy. See my URL below and go to the reference near the bottom of the page to
    "meteor".

    I think I'm going to trim the branches of this thread later today but re-opening it
    on the topic of current interest.

    --
    Wayne T. Watson (Watson Adventures, Prop., Nevada City, CA)
    (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
    Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet

    Web Page: <home.earthlink.net/~mtnviews>
     
    W. Watson, Jan 9, 2005
    #48
  9. W. Watson

    Bill Unruh Guest

    Again I ask, how do you know that yuour windows machine will act as an NTP
    server? That is different than acting as an ntp client.
    I think you have to install ntp server software onto the windows machine.


    Do an tcpdump on the windows ip and then try running ntpdate on that
    address. You should see stuff go out to port 123 See if anything comes
    back.


    I strongly suspect the first.
    The fact that your machine can use ntp as a client does NOT mean it can act
    as an ntp server. Get and install ntp server software. Or get and install
    chrony on your linux machine and have it get time off the net.

    This all refers to your windows box acting as a client, not a server.
     
    Bill Unruh, Jan 9, 2005
    #49
  10. W. Watson

    W. Watson Guest

    I'm working on that very question (can XP serve NTP) right now, but plan to sack out
    again shortly. Got up just a bit too early. zzzzz. Tauno raised this point in a
    private msg a few hours ago. I believe the poster you quote here raised it too. BTW,
    I hope to re-open this whole thread later today as a new thread. It's way to wide and
    long.

    Back to the sack.

    --
    Wayne T. Watson (Watson Adventures, Prop., Nevada City, CA)
    (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
    Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet

    Web Page: <home.earthlink.net/~mtnviews>
     
    W. Watson, Jan 9, 2005
    #50
  11. W. Watson

    Bill Unruh Guest

    I suspect Strongly that it does not. See the web page
    http://geodsoft.com/howto/timesync/wininstall.htm
    which a) suggests to me that windows does NOT support server, and b)
    gives software that you can install which makes it into a server.
    Now, whether (NetTime) SNTP will interoperate with NTP on the linux machines I do
    not know.
    Again, I have no idea what your accuracy requirement is. If it is +- 1
    sec, then sntp and your windows solution would be fine. If it is +- ms,
    then I would not use the windows solution. ntp is far more thoroughly
    implimented on Linux and is set up to correct for the inaccuracies of
    the local clock so that even if the connection to the net/servers is
    lost for a while (days) the clock still ticks away at the right time.
    For systems with sporadic connection to the net, the chronyd is the
    better choice. It can also use the on board RTC on the linux machine
    (that little clock which keeps ticking via the little on board battery
    even if the computer is switched off) to make sure that when you next
    switch it on, the time will be accurate-- ie it keeps track of the
    offset and the rate errors of the rtc and compensates for them when you
    switch on again.

    I am still unclear what your topology is. You seems to say that the win
    machine has a direct connection to the net, but the Linux machine can
    connect only via phone modem but it has a direct connection to the win
    machine. Why do you not switch them around. Have the Linux machine have
    a direct connection to the net and to the win machine, and then have it
    do masquarading for the win machine so it too will have a direct
    connection tot he net. Then it can easily act as a time standard for
    the win machine, and you will know it is accurate to ms. And both will
    have connections to the net.
     
    Bill Unruh, Jan 9, 2005
    #51
  12. W. Watson

    W. Watson Guest

    I have two web pages that need examination that may tell the story. In the mean time,
    see tcpdump below.
    I'm assuming that by sntp you are referring to the material I discovered with the net
    time command?
    While time accuracy is of interest, I will put it aside until I really have this
    problem about NTP nailed to the wall.
    I'm beginning to think it's a Klein bottle. :)
    The machine I'm currently using for Linux is a test bed. The *final* machine for my
    application will not have a modem.
    I have no interest in putting a modem on the "final" Linux box. The machine is just a
    box that is operating 24/7 to trigger an all sky video camera to capture fireball
    (meteor) images it detect crossing the sky. I do not need it connected to the
    internet all day. I'm practically on the internet all day on the XP machine. Let it
    catch the time from the internet, and let Linux update its clock. If this doesn't
    work, then I'll try something else.

    Note all my linux machines are in my observatory 100' away from the XP. An ethernet
    cable runs to them from the house where the XP machine is located. These statements
    have no particular bearing on the above, but maybe it will help you understand some
    of the topology.
    The results of tdpdump while requesting time via redhat-config-date are:

    [[email protected] root]# tcpdump: listening on eth0

    [[email protected] root]# ps 08:07:59.641003 192.168.0.3.netbios-dgm > 192.168.0.
    255.netbios-dgm: NBT UDP PACKET(138)

    [[email protected] root]# 08:08:23.488704 arp who-has 192.168.0.3 tell AstroPC200
    4.maxwellsky
    08:08:23.488802 arp reply 192.168.0.3 is-at 0:30:bd:1e:9c:c9
    08:08:23.488816 AstroPC2004.maxwellsky.ntp > 192.168.0.3.ntp: v4 client strat 0
    poll 4 prec -6 (DF)
    08:08:24.488621 AstroPC2004.maxwellsky.ntp > 192.168.0.3.ntp: v4 client strat 0
    poll 4 prec -6 (DF)
    08:08:25.488630 AstroPC2004.maxwellsky.ntp > 192.168.0.3.ntp: v4 client strat 0
    poll 4 prec -6 (DF)
    08:08:26.488619 AstroPC2004.maxwellsky.ntp > 192.168.0.3.ntp: v4 client strat 0
    poll 4 prec -6 (DF)
    08:08:27.488630 AstroPC2004.maxwellsky.ntp > 192.168.0.3.ntp: v4 client strat 0
    poll 4 prec -6 (DF)
    08:08:28.488618 AstroPC2004.maxwellsky.ntp > 192.168.0.3.ntp: v4 client strat 0
    poll 4 prec -6 (DF)
    08:08:29.488637 AstroPC2004.maxwellsky.ntp > 192.168.0.3.ntp: v4 client strat 0
    poll 4 prec -6 (DF)
    08:08:30.488638 AstroPC2004.maxwellsky.ntp > 192.168.0.3.ntp: v4 client strat 0
    poll 4 prec -6 (DF)
    08:08:35.175902 192.168.0.3.netbios-dgm > 192.168.0.255.netbios-dgm: NBT UDP PAC
    KET(138)

    [[email protected] root]# 08:08:47.528677 AstroPC2004.maxwellsky.ntp >
    192.168.0.3.ntp: v4 client strat 0 poll 6 prec -15 (DF) [tos 0x10]





    --
    Wayne T. Watson (Watson Adventures, Prop., Nevada City, CA)
    (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
    Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet

    Web Page: <home.earthlink.net/~mtnviews>
     
    W. Watson, Jan 9, 2005
    #52
  13. W. Watson

    Bill Unruh Guest

    What the tcp dump says is that the remote machine (0.3-- the windows
    machine I assume) never replies. I suspect very strongly that it does
    not support ntp as a server.
    NetTime impliments sntp, the simple network time protocol. The linux
    machine's ntp supports the full ntp protocol.I do not know if the linux
    full protocol can use an sntp server to get the time.

    Well, it would surely be best to impliment a strategy which will
    ultimately give you what you need.
    OK. I did not want to suggest a modem. So what you have is an ethernet
    connection between your linux machine and your windows machine. What do
    you use to to connect your Windows XP machine to the net? Is it a modem?
    Is it a DSL connection via the phone company? Is it a cable modem?

    Anyway, what you really want to do then is to make your windows machine
    act as a router for your Linux machine. Ie the Windows machine will
    accept the stuff from your linux machine, do address translation and
    send the stuff onto the net. That way your Linux machine will be
    directly connected to the net, whenever your Windows machine is, and can
    use ntp directly from the net, and you can forget all about your windows
    machine as an ntp server.

    Looking up google, the web page
    http://www.no-ip.com/tips.php/id/4
    seems to give a guide to setting up the windows machine as a router for
    the Linux machine.

    Note that you say that you at present have your linux box as a test bed
    and will be putting a different machine there. Why not use your test bed
    as a router for the whole system-- Ie move it to the house and have it
    distribute the internet to everything else?
    Alternatively make your windows machine into a router for the linux
    machine.

    Yes, they do. Now how does your XP machine connect to the outside net?
    These just show that the Win machine never answers, making me suspect
    strongly that there is no ntp server running on the Win machine.
     
    Bill Unruh, Jan 9, 2005
    #53
  14. W. Watson

    W. Watson Guest

    If so, then I will switch gears to the web page that suggests NTP can be made
    available to XP by modifications to the registry. See
    <http://support.microsoft.com/default.aspx?scid=kb;en-us;314054>. If that fails, then
    I'll consider getting time from my partner's network at Sierra College. I suspect
    that will get me in the ball park with his time. And if that fails, then I will
    likely request that Sandia Labs (they are behind this app) buys me a board with an
    atomic clock on it. But I'm open to suggestions.


    Thanks for the suggestions.

    I just offically ended this thread. You should have just received notification.

    Where is UBC? What sort of physics do you do?
    --
    Wayne T. Watson (Watson Adventures, Prop., Nevada City, CA)
    (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
    Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet

    Web Page: <home.earthlink.net/~mtnviews>
     
    W. Watson, Jan 9, 2005
    #54
  15. W. Watson

    W. Watson Guest

    This thread has gotten too wide and deep, so I've moved it to "Problem with Linux
    Machine's Request for Time from an XP Machine". I'll direct any new messages there.


    --
    Wayne T. Watson (Watson Adventures, Prop., Nevada City, CA)
    (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
    Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet

    Web Page: <home.earthlink.net/~mtnviews>
     
    W. Watson, Jan 9, 2005
    #55
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.