I've setup an NTP (Network Time Protocol) client and/or server to manage the system clock over a network. But, how do I verify that it is working correctly?
You can use any one of the following program to verify ntp client configuration:
- ntpq - standard NTP query program
- ntpstat - show network time synchronisation status
The ntpstat command will report the synchronisation state of the NTP daemon running on the local machine. If the local system is found to be synchronised to a reference time source, ntpstat will report the approximate time accuracy.
You can use the exit status (return values) to verify its operations from a shell script or command line itself:
- exit status 0 - Clock is synchronised.
- exit status 1 - Cock is not synchronised.
- exit status 2 - If clock state is indeterminant, for example if ntpd is not contactable.
Type the command as follows:
synchronised to NTP server (22.214.171.124) at stratum 3 time correct to within 42 ms polling server every 1024 s
Use the echo command to display exit status of ntp client:
$ echo $?
The ntpq utility program is used to monitor NTP daemon ntpd operations and determine performance. The program can be run either in interactive mode or controlled using command line arguments. Type the following command
$ ntpq -pn
$ ntpq -p
remote refid st t when poll reach delay offset jitter ============================================================================== *dione.cbane.org 126.96.36.199 2 u 509 1024 377 51.661 -3.343 0.279 +ns1.your-site.c 188.8.131.52 3 u 899 1024 377 48.395 2.047 1.006 +ntp.yoinks.net 184.108.40.206 2 u 930 1024 377 0.693 1.035 0.241 LOCAL(0) .LOCL. 10 l 45 64 377 0.000 0.000 0.001
The above is an example of working ntp client. Where,
- -p : Print a list of the peers known to the server as well as a summary of their state.
- -n : Output all host addresses in dotted-quad numeric format rather than converting to the canonical host names.
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012
- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop