Difference between revisions of "Configure basic ntp server and client"
From Notes_Wiki
m |
m |
||
Line 1: | Line 1: | ||
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Time server configuration]] > [[Configure basic ntp server and client]] | |||
==Configure ntp server== | ==Configure ntp server== | ||
Line 49: | Line 48: | ||
[[Main Page|Home]] > [[CentOS]] > [[CentOS 6.x]] > [[Time server configuration]] > [[Configure basic ntp server and client]] |
Latest revision as of 11:02, 14 July 2022
Home > CentOS > CentOS 6.x > Time server configuration > Configure basic ntp server and client
Configure ntp server
To configure basic ntp server on centos use following steps:
- yum -y install ntp ntpdate ntp-doc
- edit /etc/sysconfig/ntpd and change to
- OPTIONS="-p /var/run/ntpd.pid -g"
- 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
- service ntpd restart
- ntpq
- pe
- 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
- 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
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
- yum -y install ntp ntpdate ntp-doc
- edit /etc/sysconfig/ntpd and change to
- OPTIONS="-p /var/run/ntpd.pid -g"
- edit /etc/ntp.conf and comment all server lines. Finally add one server line to point to local ntp server
- service ntpd restart
- ntpq
- pe
- 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
- 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
To debug connection to local ntp server you can use: "ntpdate -db <ntp-server>" and see what is going on.
Home > CentOS > CentOS 6.x > Time server configuration > Configure basic ntp server and client