Getting the amount of ip's that have requested time from me

How can I get amount of ip’s that have requested time from me?
I’m currently using chrony.
I can see the chrony serverstats, but I only see the ntp packets recevied.

The “chronyc clients” command can give a list of clients + #requests.
Add -n to avoid reverse DNS lookups. [The lookups can be very slow]
Add -r to reset counters to zero after printing.

Running this command
chronyc -n clients -p 1 -r | wc -l
every 10 minutes will report the number of clients requesting time during that 10 minute interval.

If you are okay with live stats, without history and such, just to get a feel, than this little tool might also be of use:

I had posted this a couple years ago, it might help, but it may need modified a bit given your specific distribution:


while true; do (sleep 1; pkill -INT tcpdump) & disown; var=$(tcpdump -n port 123 2>&1 >/dev/null); echo -en "$(date): "; grep captured <<< “$var”; done 2>/dev/null | tee -a log.txt

It works as shown in CentOS but I have seen the timer on real-time gentoo systems need two seconds and I have seen a little different syntaxes of tcpdump output compiled in.

Noel

PS if you just want to see one direction and not the amount of both requests and responses, then stick “src” or “dst” before “port 123”.