When possible, computers should be configured to use NTP servers advertised by DHCP. When this is not possible, on-campus systems may be manually configured to use the SCS NTP servers listed in the table below. Off-campus systems should use servers from the NTP Pool Project and/or the public servers CLOCK-1.CS.CMU.EDU and CLOCK-2.CS.CMU.EDU.
Systems receiving SCS Computing Facilities software support will receive the required configuration automatically and should not be adjusted. For other systems, please follow the instructions for the appropriate operating system below or contact the Help Desk for assistance:
- Windows 7
- Windows 8
- MacOS X
- Debian, Ubuntu
- Fedora, RHEL
SCS NTP Servers (on-campus use only):
NTP Server Name
IP Address
NEW-PARSLEY.SRV.CS.CMU.EDU
128.2.172.182
NEW-SAGE.SRV.CS.CMU.EDU
128.2.172.184
NEW-ROSEMARY.SRV.CS.CMU.EDU
128.2.201.32
CORIANDER.SRV.CS.CMU.EDU
128.2.201.33
FENNEL.SRV.CS.CMU.EDU
128.2.172.185
PAPRIKA.SRV.CS.CMU.EDU
128.2.201.17
Windows 7
Windows 7 systems benefit from using the full set of NTP servers, but cannot be configured to obtain NTP server information from DHCP. Because the control panel does not allow setting multiple servers, settings on these systems must be verified and changed from a command prompt. Systems which are members of the SCS domain will receive NTP configuration via domain group policy and should not be reconfigured.
To verify the NTP server list:
- Click on the Windows button
- In the "Search programs and files" box, type cmd and press Enter.
- If necessary, select cmd from the list of search results.
- In the command prompt window, enter w32tm /query /peers
- Check that an entry is shown for each of the servers listed above.
To manually configure the list of NTP servers:
- Click on the Windows button
- In the "Search programs and files" box, type cmd
- Right-click on cmd in the list of search results.
- Select Run as administrator
- Select Yes in the UAC dialog.
- In the command prompt window, enter w32tm /config /update /manualpeerlist:"NEW-PARSLEY.SRV.CS.CMU.EDU NEW-SAGE.SRV.CS.CMU.EDU NEW-ROSEMARY.SRV.CS.CMU.EDU CORIANDER.SRV.CS.CMU.EDU FENNEL.SRV.CS.CMU.EDU PAPRIKA.SRV.CS.CMU.EDU"
- Enter w32tm /query /peers
- Check that an entry is shown for each of the servers listed above.
Windows 8
Windows 8 systems benefit from using the full set of NTP servers, but cannot be configured to obtain NTP server information from DHCP. Because the control panel does not allow setting multiple servers, settings on these systems must be verified and changed from a command prompt. Systems which are members of the SCS domain will receive NTP configuration via domain group policy and should not be reconfigured.
To verify the NTP server list:
- Hold the windows key and press X to bring up the Power User menu.
- Select Command Prompt
- In the command prompt window, enter w32tm /query /peers
- Check that an entry is shown for each of the servers listed above.
To manually configure the list of NTP servers:
- Hold the windows key and press X to bring up the Power User menu.
- Select Command Prompt (Admin)
- Select Yes in the UAC dialog.
- In the command prompt window, enter w32tm /config /update /manualpeerlist:"NEW-PARSLEY.SRV.CS.CMU.EDU NEW-SAGE.SRV.CS.CMU.EDU NEW-ROSEMARY.SRV.CS.CMU.EDU CORIANDER.SRV.CS.CMU.EDU FENNEL.SRV.CS.CMU.EDU PAPRIKA.SRV.CS.CMU.EDU"
- Enter w32tm /query /peers
- Check that an entry is shown for each of the servers listed above.
MacOS X
MacOS X systems currently cannot be configured to obtain NTP server information from DHCP. Systems which are enrolled in the SCS Facilities JSS service receive correct NTP configuration via that service and should not be reconfigured. Other systems must be configured manually. To verify the NTP server list setting:
- Open System Preferences
- Click Date & Time
- Click on the Date & Time tab.
- Verify that Set Date & Time automatically is checked.
- In the server name field, enter NEW-PARSLEY.SRV.CS.CMU.EDU NEW-SAGE.SRV.CS.CMU.EDU NEW-ROSEMARY.SRV.CS.CMU.EDU CORIANDER.SRV.CS.CMU.EDU FENNEL.SRV.CS.CMU.EDU PAPRIKA.SRV.CS.CMU.EDU
Debian, Ubuntu
Debian and Debian-derived systems, including Ubuntu, will use NTP servers from DHCP by default when DHCP is used without NetworkManager. If NTP servers from DHCP are being used, they will be listed in the file /var/lib/ntp/ntp.conf.dhcp
. If that file does not exist, then NTP servers are not being obtained from DHCP.
Unfortunately, Ubuntu systems use use NetworkManager by default, and there is a bug which prevents NTP configuration from being updated in this case. Systems running the Facilities-supported Dragon Ubuntu 12.04 or 14.04 contain a fix for this problem. On systems which are not Facilities-supported, one of two workarounds is required. Either the list of servers may be configured manually, or a simple script may be installed to enable automatic operation.
To manually configure the list of NTP servers, edit the file /etc/ntp.conf
. Remove or comment out any lines beginning with the keywords "server" or "peer", and replace them with the lines shown below. Then run service ntp restart.
server new-parsley.srv.cs.cmu.edu iburst server new-sage.srv.cs.cmu.edu iburst server new-rosemary.srv.cs.cmu.edu iburst server coriander.srv.cs.cmu.edu iburst server fennel.srv.cs.cmu.edu iburst server paprika.srv.cs.cmu.edu iburst
To enable automatic NTP configuration when using NetworkManager, you can apply a workaround similar to that used on Facilities-supported Ubuntu platforms. This is done by installing a NetworkManager dispatcher script which triggers automatic update of NTP configuration whenever a DHCP lease is obtained. Note this method will not work on older versions of Ubuntu, including Ubuntu 10.04, because they lack the required script to correctly update the NTP server configuration. To apply this workaround, install the following shell script as /etc/NetworkManager/dispatcher.d/05ntp
:
#!/bin/sh if [ "$2" = "up" -a -n "${DHCP4_NTP_SERVERS}" ] ; then export reason=BOUND export new_ntp_servers="${DHCP4_NTP_SERVERS}" sh /etc/dhcp/dhclient-exit-hooks.d/ntp elif [ "$2" = "dhcp4-change" -a -n "${DHCP4_NTP_SERVERS}" ] ; then export reason=RENEW export new_ntp_servers="${DHCP4_NTP_SERVERS}" sh /etc/dhcp/dhclient-exit-hooks.d/ntp elif [ "$2" = "down" ] ; then export reason=STOP sh /etc/dhcp/dhclient-exit-hooks.d/ntp fi exit 0
After installing the NetworkManager dispatcher script, you will need to perform one of the following actions to update NTP settings. Warning: Taking any of these actions will also result in a disruption of network access.
- Disable and then re-enable the network interface, using either nmcli or the NetworkManager applet menu. Note that the menu location and appearance will vary depending on the Ubuntu version and desktop environment in use.
- Restart NetworkManager by entering the command service network-manager restart
- Reboot the system.
Fedora, RHEL
Fedora and its derivatives, including RHEL, will use NTP servers from DHCP by default when DHCP is used. For this to work, the setting PEERNTP=NO
must not be present in /etc/sysconfig/network
, or in the interface-specific file /etc/sysconfig/network-scripts/ifcfg-DEV
, where DEV is the interface name.
CHECKING THE STATUS OF NTP
To check if ntpd
is configured to run at system start, issue the following command:
~]$ chkconfig --list ntpd
ntpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
By default, when ntpd
is installed, it is configured to start at every system start.
To check if ntpd
is running, issue the following command:
~]$ ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== +clock.util.phx2 .CDMA. 1 u 111 128 377 175.495 3.076 2.250 *clock02.util.ph .CDMA. 1 u 69 128 377 175.357 7.641 3.671 ms21.snowflakeh .STEP. 16 u - 1024 0 0.000 0.000 0.000 rs11.lvs.iif.hu .STEP. 16 u - 1024 0 0.000 0.000 0.000 2001:470:28:bde .STEP. 16 u - 1024 0 0.000 0.000 0.000The command lists connected time servers and displays information indicating when they were last polled and the stability of the replies. The column headings are as follows:
-
remote and refid: remote NTP server, and its NTP server
-
st: stratum of server
-
t: type of server (local, unicast, multicast, or broadcast)
-
poll: how frequently to query server (in seconds)
-
when: how long since last poll (in seconds)
-
reach: octal bitmask of success or failure of last 8 queries (left-shifted); 377 = 11111111 = all recent queries were successful; 257 = 10101111 = 4 most recent were successful, 5 and 7 failed
-
delay: network round trip time (in milliseconds)
-
offset: difference between local clock and remote clock (in milliseconds)
-
jitter: difference of successive time values from server (high jitter could be due to an unstable clock or, more likely, poor network performance)
To obtain a brief status report from ntpd
, issue the following command:
~]$ ntpstat
unsynchronised
time server re-starting
polling server every 64 s
~]$ ntpstat
synchronised to NTP server (10.5.26.10) at stratum 2
time correct to within 52 ms
polling server every 1024 s
HowTo: Verify My NTP Working Or Not
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?
Keeping correct time is important on a server. 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
- timedatectl – show or set info about ntp using systemd
ntpstat command
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.
exit status
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 – Clock is not synchronised.
- exit status 2 – If clock state is indeterminant, for example if ntpd is not contactable.
Type the command as follows:
$ ntpstat
Sample outputs:
synchronised to NTP server (149.20.54.20) 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 $?
Sample outputs:
0
ntpq command
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
OR
$ ntpq -p
Sample outputs:
remote refid st t when poll reach delay offset jitter ============================================================================== *dione.cbane.org 204.123.2.5 2 u 509 1024 377 51.661 -3.343 0.279 +ns1.your-site.c 132.236.56.252 3 u 899 1024 377 48.395 2.047 1.006 +ntp.yoinks.net 129.7.1.66 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.
A note about timedatectl command
If you are using systemd based system, run the following command to check the service status
# timedatectl status
Sample outputs:
Fig.01: Is my NTP (systemd-timesyncd) Working?
systemd-timesyncd configuration
If NTP enabled is set to No. Try configuring by editing /etc/systemd/timesyncd.conf file as follows:
# vi /etc/systemd/timesyncd.conf
Append/edit [Time] as follows i.e. add time servers or change the provided ones, uncomment the relevant line and list their host name or IP separated by a space (default from my Debian 8.x server):
[Time] Servers=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org
Save and close the file. Finally, start and enable it, run:
# timedatectl set-ntp true
# timedatectl status