Revision 3 as of 2021-09-08 15:07:29

Clear message

Testing an ntp server without ntpd

Source: http://seriot.ch/ntp.php

GNU Linux

date -d@$((0x`printf c%47s|nc -uw1 pool.ntp.org 123|xxd -s40 -l4 -p`-64#23GDW0))

This doesn't work for autistic NTP servers like the one in Foritigate routers, because they dont understand that a space is the same as a NULL byte.. The longer, but more solid version:

date -d@$((0x`(printf "\x93"; printf '\0%.0s' {1..47}) |nc -uw1 192.168.9.1 123|xxd -s40 -l4 -p`-64#23GDW0))

For servers that don't accept ntpv2, but do ntpv4, try to replace x93 with xe3

BSD

date -r$((0x`printf c%47s|nc -uw1 pool.ntp.org 123|xxd -s40 -l4 -p`-64#23GDW0))