Difference between revisions of "Configure basic ntp server and client"

From Notes_Wiki
(Created page with "<yambe:breadcrumb>Ntp_server_configuration|Ntp server configuration</yambe:breadcrumb> =Configure basic ntp server and client= ==Configure ntp server== To configure basic nt...")
 
m
Line 18: Line 18:
##pe
##pe
##as
##as
##:If peers show strata (st) greater than 3 or 4 and associations show reach as no then there must be a firewall issue
##:If peers show strata (st) greater than 3 or 4 and associations show reach as no then there must be a firewall issue   Please refer to http://superuser.com/questions/141772/what-are-the-iptables-rules-to-permit-ntp for firewall    From firewall perspective on server allow
##::<pre>
##:::iptables -A INPUT -p udp --dport 123 -j ACCEPT
##:::iptables -A OUTPUT -p udp --sport 123 -j ACCEPT
##::</pre>
 


'''Note that setting up ntp server or client on openVZ container will not work.  Both ntp server and client must be setup only on base machines'''
'''Note that setting up ntp server or client on openVZ container will not work.  Both ntp server and client must be setup only on base machines'''
Line 35: Line 40:
##pe
##pe
##as
##as
##:If peers show strata (st) greater than 3 or 4 and associations show reach as no then there must be a firewall issue
##:If peers show strata (st) greater than 3 or 4 and associations show reach as no then there must be a firewall issue.  For firewall refer to http://superuser.com/questions/141772/what-are-the-iptables-rules-to-permit-ntp  From firewall perspective on server allow
 
##::<pre>
##:::iptables -A OUTPUT -p udp --dport 123 -j ACCEPT
##:::iptables -A INPUT -p udp --sport 123 -j ACCEPT
##::</pre>
To debug connection to local ntp server you can use: "ntpdate -db &lt;ntp-server&gt;" and see what is going on.
To debug connection to local ntp server you can use: "ntpdate -db &lt;ntp-server&gt;" and see what is going on.



Revision as of 10:38, 26 February 2015

<yambe:breadcrumb>Ntp_server_configuration|Ntp server configuration</yambe:breadcrumb>

Configure basic ntp server and client

Configure ntp server

To configure basic ntp server on centos use following steps:

  1. yum -y install ntp ntpdate ntp-doc
  2. edit /etc/sysconfig/ntpd and change to
    OPTIONS="-p /var/run/ntpd.pid -g"
  3. edit /etc/ntp.conf and add one line for each local network as follows:
    restrict 192.168.2.0 mask 255.255.255.0 nomodify notrap
  4. service ntpd restart
  5. ntpq
    1. pe
    2. as
      If peers show strata (st) greater than 3 or 4 and associations show reach as no then there must be a firewall issue Please refer to http://superuser.com/questions/141772/what-are-the-iptables-rules-to-permit-ntp for firewall From firewall perspective on server allow
      iptables -A INPUT -p udp --dport 123 -j ACCEPT
      iptables -A OUTPUT -p udp --sport 123 -j ACCEPT


Note that setting up ntp server or client on openVZ container will not work. Both ntp server and client must be setup only on base machines


Configure ntp client

  1. yum -y install ntp ntpdate ntp-doc
  2. edit /etc/sysconfig/ntpd and change to
    OPTIONS="-p /var/run/ntpd.pid -g"
  3. edit /etc/ntp.conf and comment all server lines. Finally add one server line to point to local ntp server
  4. service ntpd restart
  5. ntpq
    1. pe
    2. as
      If peers show strata (st) greater than 3 or 4 and associations show reach as no then there must be a firewall issue. For firewall refer to http://superuser.com/questions/141772/what-are-the-iptables-rules-to-permit-ntp From firewall perspective on server allow
      iptables -A OUTPUT -p udp --dport 123 -j ACCEPT
      iptables -A INPUT -p udp --sport 123 -j ACCEPT

To debug connection to local ntp server you can use: "ntpdate -db <ntp-server>" and see what is going on.


<yambe:breadcrumb>Ntp_server_configuration|Ntp server configuration</yambe:breadcrumb>