[root@server ~]# yum -y install ntp

[root@server ~]# vi /etc/ntp.conf

# line 19: add the network range you allow to receive requests

restrict 10.0.0.0 mask 255.255.255.0 nomodify notrap
# change servers for synchronization

server 0.rhel.pool.ntp.org
server 1.rhel.pool.ntp.org
server 2.rhel.pool.ntp.org


[root@server ~]# /etc/rc.d/init.d/ntpd start

Starting ntpd:
[ OK ]

[root@server ~]# chkconfig ntpd on

[root@server ~]# ntpq -p

remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
.   2 u    8   64    1   24.214  1449.94   0.000
.    2 u    7   64    1   31.454  1445.03   0.000
.    2 u    6   64    1   26.589  1448.61   0.000

 

NTP uses UDP/123 so make sure the FW on the Centos server is also allowing this port to be accessed

 

Use TCP dump to analyse traffic

tcpdump dst port 123

 

 

Troubleshooting NTP

If your server doesn’t ever sync up with the NTP server pool, there are some things you can do to try to identify the problem.  Often the problem is due to a firewall on the server.  You can try shutting down the firewall for a moment and seeing if it works.  Verify that you don’t have any typographical errors in the files that we edited.  You will also want to verify that your DNS is working fine and that the machine can resolve the hostnames of the NTP servers.

Checking that Your Server Recognizes its Config

Frequently, you think that you’ve done everything above correctly and you just want to verify that it read the /etc/ntp.conf correctly.  You can verify this by using the ntpdc command.  ntpdc will tell you how your ntp service is configured including telling you which machine it is configured to contact for ntp updates.

# ntpdc -l   ( -l parameter lists all of the peers known to the server. )
client clock1.albyny.inoc.net

# ntpdc -p    ( -p prints a lists of known peers as well as a summary of their state. )
     remote           local      st poll reach  delay   offset    disp
=======================================================================
*clock1.albyny.i 192.241.213.28   1 1024  377 0.08350 -0.003566 0.13672

Additionally, ntpdc has both a debug and an interactive mode to help you get your hands deep into testing your ntp configuration.

Use Tcpdump to Watch the Traffic

Another good troubleshooting technique is to watch the traffic destined for the typical ntp port (123/tcp) going out from your server.  In the example below, I installed tcpdump and then ran it and was able to see my machine query ntp servers and then receive responses back from those servers:

# tcpdump dst port 123
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
22:05:39.654502 IP myserver.ntp > 199.30.140.74.ntp: NTPv4, Client, length 48  <– NTP query
22:05:39.663888 IP 199.30.140.74.ntp > myserver.ntp: NTPv4, Server, length 48  <– NTP response
22:05:40.655047 IP myserver.ntp > services.quadranet.com.ntp: NTPv4, Client, length 48<– NTP query
22:05:40.664994 IP services.quadranet.com.ntp > myserver.ntp: NTPv4, Server, length 48<– NTP response

 

<thanks to http://www.uptimemadeeasy.com/networking/setup-ntp-on-centos-linux/ for the last part of this information document >