how to sync time for LAN (ntp)? - Slackware

This is a discussion on how to sync time for LAN (ntp)? - Slackware ; I've regulary used funny "timed" BSD daemon to do that, but now for some reasons this is impossible. What I have to do: I have 2 computers with 2 local IP 192.168.0.30 and 192.168.0.70 (netmask 255.255.255.0). The first one (.30), ...

+ Reply to Thread
Results 1 to 11 of 11

Thread: how to sync time for LAN (ntp)?

  1. how to sync time for LAN (ntp)?

    I've regulary used funny "timed" BSD daemon to do that, but now for
    some reasons this is impossible. What I have to do: I have 2
    computers with 2 local IP
    192.168.0.30 and 192.168.0.70 (netmask 255.255.255.0).
    The first one (.30), I would like to act as a source of time (using
    its internal clock) for the second (.70). Nothing more. I've straggled
    for 4-5 hours, googled around everything about ntpd and ntpdate and
    completely failed. What should be in ntp.conf on the server side and
    on the client side? Security issues are not import for me.

    timed BSD daemon does not have any configuration files, what a great
    program.

    ---
    Bogdan



  2. Re: how to sync time for LAN (ntp)?

    wrote:
    >What I have to do: I have 2
    >computers with 2 local IP
    >192.168.0.30 and 192.168.0.70 (netmask 255.255.255.0).
    >The first one (.30), I would like to act as a source of time (using
    >its internal clock) for the second (.70). Nothing more. I've straggled
    >for 4-5 hours, googled around everything about ntpd and ntpdate and
    >completely failed. What should be in ntp.conf on the server side and
    >on the client side? Security issues are not import for me.


    Server 192.168.0.30 ntp.conf:

    server 127.127.1.0
    fudge 127.127.1.0 stratum 11

    Client 192.168.0.70 ntp.conf:

    server 192.168.0.30 iburst
    driftfile /etc/ntp/drift

  3. Re: how to sync time for LAN (ntp)?

    On Feb 1, 8:08 pm, kaukasoina708n8s6l...@sci.fi (Petri Kaukasoina)
    wrote:
    >
    > Server 192.168.0.30 ntp.conf:
    >
    > server 127.127.1.0
    > fudge 127.127.1.0 stratum 11
    >
    > Client 192.168.0.70 ntp.conf:
    >
    > server 192.168.0.30 iburst
    > driftfile /etc/ntp/drift


    Thanks, but does not work. I put

    server 127.127.1.0#
    fudge 127.127.1.0 stratum 11

    into ntp.conf on the server side,
    and the command ntpdate -b 192.168.0.30 on the client side produces
    the following
    11 Jan 02:00:39 ntpdate[22803]: no server suitable for synchronization
    found

    ---
    Bogdan


  4. Re: how to sync time for LAN (ntp)?

    On Feb 1, 8:08 pm, kaukasoina708n8s6l...@sci.fi (Petri Kaukasoina)
    wrote:
    > server 127.127.1.0
    > fudge 127.127.1.0 stratum 11
    >
    > Client 192.168.0.70 ntp.conf:
    >
    > server 192.168.0.30 iburst
    > driftfile /etc/ntp/drift


    Huh, after a second try with ntpdate -b -v 192.168.0.30 (-v be
    verbose) it works.
    ???
    Don't know what does it mean, may be problems with network
    syncronisation? 1Gb LAN, new multicore machines.

    Much thanks.

    ---
    Bogdan




  5. Re: how to sync time for LAN (ntp)?

    wrote:
    >On Feb 1, 8:08 pm, kaukasoina708n8s6l...@sci.fi (Petri Kaukasoina)
    >wrote:
    >> server 127.127.1.0
    >> fudge 127.127.1.0 stratum 11
    >>
    >> Client 192.168.0.70 ntp.conf:
    >>
    >> server 192.168.0.30 iburst
    >> driftfile /etc/ntp/drift

    >
    >Huh, after a second try with ntpdate -b -v 192.168.0.30 (-v be
    >verbose) it works.
    >???
    >Don't know what does it mean, may be problems with network
    >syncronisation? 1Gb LAN, new multicore machines.


    It takes a few minutes before the ntpd server at 192.168.0.30 thinks it is
    syncronized to the local clock. iburst should make it faster. So change it
    at the server to this:

    server 127.127.1.0 iburst
    fudge 127.127.1.0 stratum 11

  6. Re: how to sync time for LAN (ntp)?

    On Feb 1, 9:01 pm, kaukasoina708n8s6l...@sci.fi (Petri Kaukasoina)
    wrote:
    > It takes a few minutes before the ntpd server at 192.168.0.30 thinks it is
    > syncronized to the local clock. iburst should make it faster. So change it
    > at the server to this:
    >
    > server 127.127.1.0 iburst
    > fudge 127.127.1.0 stratum 11


    No effect, there must be minutes passed to obtain the time from the
    server.
    Very freaky ntpd is.

    ---
    Bogdan

  7. Re: how to sync time for LAN (ntp)?

    B.Yanchitsky@gmail.com wrote:
    > On Feb 1, 9:01 pm, kaukasoina708n8s6l...@sci.fi (Petri Kaukasoina)
    > wrote:
    >> It takes a few minutes before the ntpd server at 192.168.0.30 thinks it is
    >> syncronized to the local clock. iburst should make it faster. So change it
    >> at the server to this:
    >>
    >> server 127.127.1.0 iburst
    >> fudge 127.127.1.0 stratum 11

    >
    > No effect, there must be minutes passed to obtain the time from the
    > server.
    > Very freaky ntpd is.
    >
    > ---
    > Bogdan


    This site may prove helpful. http://www.ntp.org/

    The problem appears to be the clock on the computer you are attempting
    to sync to (the reference computer) is too far out of sync and ntpd on
    the reference computer is rejecting the call to act as a reference. The
    reference computer is simply saying, go away your not even in the same
    ball park.

    The simple solution is to run, as a cron job, from the command netdate
    ip of computer you want to sync to. Of course you do this on the
    computer you want to sync up to the time reference. The cron job can be
    run every 20 minutes or a longer interval ( say, every hour ) depending
    on drift.

    Using ntp is much nicer but does require a simple configuration file on
    both the reference computer and computers wanting to use it as a
    reference. When using ntp it's always a good idea to run {ntpdate ip} of
    reference computer on boot up on any computer wanting to get a time
    reference. This can be started rc.local.


  8. Re: how to sync time for LAN (ntp)?

    Thanks everybody for help. I've played a bit around ntpd and think it
    was created with much inclination to security. ntpd does not like
    when only one time-server is accessible, its prime purpose to
    synchronize continents, but not computers inside LAN. I tried the
    broadcast model instead of master/client one, in a hope ntpd on the
    client side would trust more, but it appeared that the client does
    not trust to broadcast packets, when the clock on the client side was
    screwed 5 years back. Now I'm in conclusion that for a small local
    network it would be better to set up single time server, and on the
    client side rotate hourly ntpdate through cron.

    ---
    Bogdan

  9. Re: how to sync time for LAN (ntp)?

    B.Yanchitsky@gmail.com wrote:
    > Thanks everybody for help. I've played a bit around ntpd and think it
    > was created with much inclination to security. ntpd does not like
    > when only one time-server is accessible, its prime purpose to
    > synchronize continents, but not computers inside LAN. I tried the
    > broadcast model instead of master/client one, in a hope ntpd on the
    > client side would trust more, but it appeared that the client does
    > not trust to broadcast packets, when the clock on the client side was
    > screwed 5 years back. Now I'm in conclusion that for a small local
    > network it would be better to set up single time server, and on the
    > client side rotate hourly ntpdate through cron.
    >
    > ---
    > Bogdan


    netdate as a cron job is fine however ntpd will work well as a server
    and client on a lan. It also affords the abilty to use time references
    on the internet should you want to stay in sync with the rest of the
    planet. There are many reasons one might want this ability.

    (LAN SERVER). This computer reaches out onto the Internet
    to three time servers to adust itself to the correct time.
    The client computer/computers on the lan check only this server
    for their time reference. They never reach out to the internet
    as discussed on ntp.org. If the server fails the client computers
    rely on their internal clocks.

    /etc/ntp.conf for lan server
    server 127.127.1.0 # local clock
    fudge 127.127.1.0 stratum 10
    server address 1 of internet server near you # You can get the addresses
    server address 2 of internet server near you # from ntp.org
    server address 3 of internet server near you #
    restrict 127.0.0.1
    ** Note ** In many cases your own ISP will provide a time reference

    (CLIENT COMPUTER)
    /etc/ntp.conf for lan clients
    fudge 127.127.1.0 stratum 10
    server 192.168.xxx.xxx # Address of internal server
    driftfile /etc/ntp/drift
    restrict 127.0.0.1

    on the client computers /etc/rc.d/rc.local
    contains these entries
    /etc/rc.d/rc.local
    # Start the network time service as a client now then
    # sync the host clock to lan time server
    netdate 192.168.xxx.xxx # address of lan server
    # change to the server on lan server
    ntpd -c /etc/ntp.conf

    On the lan server the /etc/rc.d/rc.local
    has instructions to reach out on power up to one of the three
    internet time servers in order to adjust it's clock close enough
    to the internet time server so it can sync up and not get refused
    because it's clock is too far out of sync. Once this is done I then
    start ntpd

    In general, it takes no more than 20 minutes and usually a lot less for
    the lan time server to settle so that computers on the lan can use it
    for a reference. The lan server will refuse connections from the lan
    until it does settle.

    This is the most basic method of having local time synchronization as
    well as the ability to sync to an internet reference. Clearly, a little
    bash scripting to solve some of the obvious problems with this method
    can be used. IE: what happens if the internet time server chosen as the
    local server boot up reference is unavailable. there are a few other
    scenarios bash scripting can help and I will leave those in the wind for
    you to play around with if you so choose.

  10. Re: how to sync time for LAN (ntp)?

    On Feb 3, 8:44 pm, microsys wrote:
    > netdate as a cron job is fine however ntpd will work well as a server
    > and client on a lan. It also affords the abilty to use time references
    > on the internet should you want to stay in sync with the rest of the
    > planet. There are many reasons one might want this ability.
    >
    > (LAN SERVER). This computer reaches out onto the Internet
    > to three time servers to adust itself to the correct time.
    > The client computer/computers on the lan check only this server
    > for their time reference. They never reach out to the internet
    > as discussed on ntp.org. If the server fails the client computers
    > rely on their internal clocks.
    >


    I've set up the following configuration: "firewall" that has
    connection with outer word synchronizes its clock to 3 public
    available time servers, and uses its second interface to be as time
    server for LAN.
    I decided not use ntpd on the client side, because ntpd is very
    secure, and to work nice needs in client mode at least 3 time
    servers. When you have only single time server and large time
    difference between local and remote clocks, clearly it's very
    difficult to decide should be local clock synced or not.
    ntpd has -g flag, to sync at start up local clock to remote and ignore
    big difference. But as far as I can understand in philosophy of ntp,
    time servers are considered as outer, permanently available and stable
    sources of time, and this is in contradiction when one has local time
    server that shares the same power supply with clients.

    ---
    Bogdan

  11. Re: how to sync time for LAN (ntp)?

    B.Yanchitsky@gmail.com wrote:
    snip
    >>

    >
    > I've set up the following configuration: "firewall" that has
    > connection with outer word synchronizes its clock to 3 public
    > available time servers, and uses its second interface to be as time
    > server for LAN.
    > I decided not use ntpd on the client side, because ntpd is very
    > secure, and to work nice needs in client mode at least 3 time
    > servers. When you have only single time server and large time
    > difference between local and remote clocks, clearly it's very
    > difficult to decide should be local clock synced or not.
    > ntpd has -g flag, to sync at start up local clock to remote and ignore
    > big difference. But as far as I can understand in philosophy of ntp,
    > time servers are considered as outer, permanently available and stable
    > sources of time, and this is in contradiction when one has local time
    > server that shares the same power supply with clients.
    >
    > ---
    > Bogdan


    Thanks for the reminder on the -g switch .. it's been awhile since I set
    up time on this system. Looks like you have found a solution that
    suits your needs.

+ Reply to Thread