How to set up an NTP server with Fatdog?

versatile 64-bit multi-user Linux distribution

Moderators: kirk, jamesbond, p310don, JakeSFR, step, Forum moderators

Post Reply
Clarity
Posts: 3922
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1651 times
Been thanked: 536 times

How to set up an NTP server with Fatdog?

Post by Clarity »

I've retired a server on my LAN which was used for many-many years as a NTP server among other things.

For Windows, this is simple both to setup and to access from a client.

I would welcome any guidance for how to use 2 FATDOG PCs, where 1 is the NTP server while the other has "some" client that gets its clock-time from the local FATDOG NTP server.

Help, please.
P.S. I do know of the NTP services understanding how it gets it time from the Atomic Clocks but not clear on how to arrange such that it, then, provides local NTP server nor how to tell a FATDOG to get his local PC client accessing that server. (Reason: Notice the error in the terminal window.)

NTP Services.png
NTP Services.png (353.93 KiB) Viewed 1055 times
step
Posts: 550
Joined: Thu Aug 13, 2020 9:55 am
Has thanked: 58 times
Been thanked: 198 times
Contact:

Re: NTP - Request for guidance

Post by step »

The two NTP services that you can see in the Service Manager - ntpd "boot" and ntpd "client" - are an NTP client and and NTP client (sic), respectively. As such their job is to synchronize the local time with a remote NTP server's time. The main difference between the two services is that the "boot" client runs once for 60 seconds, immediately after boot, then exits, while the "client" client keeps running, and keeps the clock synchronized all the time. I run the "boot" client on my PCs because it's enough for my needs: sync the clock when my PC starts and be done with it.

The error message that I can see in your screenshot references the hardware clock. It is guessing that your __hardware__ clock is set "incorrectly". I've seen that kind of error happen when files are created by Windows and immediately exchanged with Linux. Is that your case or nearly so? Try running Control Panel > Localisation > Configure Hardware Clock. It offers a choice between UTC and Local Timezone. Try either setting, reboot and rerun fsck. Does it solve your problem?

So you need to run an NTP server on your LAN? I don't see an NTP server package in the Fatdog repository. I will compile it and add the package to the repo. Normally all Windows and Linux PCs in a LAN are configured to get their time from the same authoritative NTP server on the internet, that's how LAN time is kept in sync normally. If your LAN is isolated from the Internet then running a local NTP server makes sense.

step
Posts: 550
Joined: Thu Aug 13, 2020 9:55 am
Has thanked: 58 times
Been thanked: 198 times
Contact:

Re: NTP - Request for guidance

Post by step »

It appears that Fatdog does have an NTP server after all. It's the busybox ntpd applet, and you should be able to use it to roll your own NTP server with a shell script.

Code: Select all

ntpd --help
BusyBox v1.27.0.git (2021-05-25 17:08:37 UTC) multi-call binary.

Usage: ntpd [-dnqNwl -I IFACE] [-S PROG] [-p PEER]...

NTP client/server

        -d      Verbose
        -n      Do not daemonize
        -q      Quit after clock is set
        -N      Run at high priority
        -w      Do not set time (only query peers), implies -n
        -S PROG Run PROG after stepping time, stratum change, and every 11 mins
        -p PEER Obtain time from PEER (may be repeated)
                If -p is not given, 'server HOST' lines
                from /etc/ntp.conf are used
        -l      Also run as server on port 123
        -I IFACE Bind server to IFACE, implies -l

Based on the above help text, your shell script should run command ntpd -n -l on server 192.168.1.64 (or whatever your server's LAN IP is) to provide a time service to LAN clients, which can each synchronize their time using command ntpd -np 192.168.1.64. This is a rough description. Let me know if you need more guidance with your script.

P.S. I will not compile a full-blown NTP server package since there already is busybox's.

Clarity
Posts: 3922
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1651 times
Been thanked: 536 times

Re: How to set up an NTP server with Fatdog?

Post by Clarity »

@step you're a godsend for digging that up. Yes, looks like this can & should be adapted for local LAN use! Thanks.

Even as I know this ability has been in Win for decades and that it has been missing in PUP/DOGs, when removal of the prior NTP server, several of my Win PCs and other services have surface this 'known' issue.

Maybe, sometime in the future, a FD local NTP server emerges where it at system start, as you show of your use, it obtains the Atomic Clock if present (or defaults to local-time as does Wins) and shares that to any LAN client.

Is there a way to "steer" the FATDOG client(s) services to access a local LAN NTP? I know it will access the cloud Atomic normally. (I want my solutions to be Linux only solutions as I move to remove Wins from all my local use.)

Again @Step THANKS, muchly!

Clarity
Posts: 3922
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1651 times
Been thanked: 536 times

Re: How to set up an NTP server with Fatdog?

Post by Clarity »

@step has helped on this topic. But, a question surfaces for a good implementation to occur:

  • For the server, this one-line terminal command starts the server feature on one PC whose LAN IP address is 192.168.1.64.
    ntpd -n -l on server <location of the Atomic clock>

  • But does this command start a crresponding server feature, too, ending with 2 NTP services on the LAN?
    ntpd -np 192.168.1.64

So I want the single NTP server to share his Atomic clock time available for LAN PCs; while the LAN PC 'clients' ... I want to synchronize with the NTP server.

Searching the web on the command, not finding clear answer.

Clarity
Posts: 3922
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1651 times
Been thanked: 536 times

Re: How to set up an NTP server with Fatdog?

Post by Clarity »

OK, found this NTP site which offers option for the latest version of the NTPD command

Looks like NTPD -g -q -p 192.168.1.64 is the pathway for client. So this can be put on a CRON job for periodic update from the NTP server.

ALSO for developer note: NTPDATE is being retired.

Thoughts? ... anyone; and because so many of us use local home LANs with a myriad of LAN services from games to multimedia to NAS to ... Should or could this become a Control Panel setup function? It appears, too, that the Firewall setup provides pathway for its use for good reason.

I think its minor (coming from a non-system service developer)

step
Posts: 550
Joined: Thu Aug 13, 2020 9:55 am
Has thanked: 58 times
Been thanked: 198 times
Contact:

Re: How to set up an NTP server with Fatdog?

Post by step »

@Clarity, for your LAN NTP solution all you need - and have - is busybox ntpd. No need for additional stuff from the official NTP site. All the options available to you are listed and succinctly explained in the CODE block of the third post.

To serve time from PC 192.168.1.64 (substitute sample IP with your real IP) run on that PC ntpd -l -n. No atomic clock is needed: the reference time is the time your PC 192.168.1.64 runs on its internal clock. Other PCs in your LAN will get the time from PC 192.168.1.64 by running command ntpd -n -p 192.168.1.64. This will go on forever automatically, until you kill the commands.

If you want to see what's going on add option -d to all commands.

If you want 192.168.1.64 to sync its time with an atomic clock server before it can serve its time to other LAN PCs change the command to ntpd -l -n -p pool.ntp.org. For this to work, 192.168.1.64 must be connected to the internet.

If you want to test on a single PC replace 192.168.1.64 with localhost and run commands in separate terminal windows.

If you want the terminal prompt to return to you immediately remove option -n.

----

You want an auto-starting, run-and-forget time service on your LAN? Use the time service built into Fatdog. I introduced it in my second post.

Clients (all Fatdog64 PCs): On each client PC edit file /etc/init.d/60-ntpd-boot and change variable SERVER=192.168.1.64. Then activate the time service from Fatdog Control Panel > System > Manage Server and Services.

Server (192.168.1.64): Edit file /etc/rc.d/rc.local and append this command ntpd -l.

Sorry, I can't comment on how to add Win PCs or other distros / pups to this setup.

Clarity
Posts: 3922
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1651 times
Been thanked: 536 times

Re: How to set up an NTP server with Fatdog?

Post by Clarity »

Thanks @step :thumbup:

Yes, the planned (tested) approach is as follows:
On the LAN's Time Server (192.168.1.64)

  1. Go to the internet once/day and acquire the Atomic Clock time for this zone; namely
    ntpd -l -n -p pool.ntp.org

  2. The above command ALSO serves to Become the LAN's Time Service and make that time available to all local LAN units

On each LAN unit

  • Synchronize their time from the LAN's time server, per a cron job
    Linux users ===> ntpd -n -p 192.168.1.64

In FATDOG-PUPPY 'ptime' has a synchronize option (although ptime has no such consideration for local time server presence...if it did, this topic would be moot as the setup page would accomodate the time server location selection).
Are your field suggestions intending to accomplish that synchronize when the above commands are executed? If so, that means no cron job would be needed.

Thanks for the current guidance to this subtle but important concern.

Edited: Instructions for the LAN's Time Server. Thanks goes to @step's guidance shown in the following post to this thread. This ability, because its implecated importance, probably should be a feature for Time Setup, if possible, in FATDOG.

Last edited by Clarity on Sat Feb 26, 2022 6:46 am, edited 3 times in total.
step
Posts: 550
Joined: Thu Aug 13, 2020 9:55 am
Has thanked: 58 times
Been thanked: 198 times
Contact:

Re: How to set up an NTP server with Fatdog?

Post by step »

I'm glad you were able to successfully test this approach. Note that the second command you listed for the server unit is redundant. The first command is correct and sufficient for your purpose.

Clarity wrote: Tue Feb 22, 2022 10:26 pm

[...]
Yes, the planned (tested) approach is as follows:
On the LAN's Time Server (192.168.1.64)

  1. Go to the internet once/day and acquire the Atomic Clock time for this zone; namely
    ntpd -l -n -p pool.ntp.org

  2. Become the LAN's Time Service and make that time available to all local LAN units; namely
    ntpd -n -p

On each LAN unit

  • Synchronize their time from the LAN's time server, per a cron job
    Linux users ===> ntpd -n -p 192.168.1.64

So you want to know if a cron job is needed for the above approach? No, it isn't. As I already wrote, the commands, as listed above, run forever until you kill them. Therefore there is no need to schedule them. Of course you need to start them when the PC units boot.

[...]
Are your field suggestions intending to accomplish that synchronize when the above commands are executed? If so, that means no cron job would be needed.
[...]

Post Reply

Return to “FatDog64”