How to configure ntp client server

CentOS / Red Hat Configure ntp(Network time protocol) client server synchronised.
NTP client ----> NTP server (192.16.1.10)
How to configure ntp client server

To configure ntp on ntp server

To configure allow port 123 on IPtables firewalls
cat /etc/sysconfig/iptables
The output as bellow
-A INPUT -p tcp -m state --state NEW --dport 123 -j ACCEPT
-A INPUT -p udp -m state --state NEW --dport 123 -j ACCEPT
To configure ntp.conf file
restrict 127.0.0.1
restrict 192.16.1.0 netmask 255.255.255.0 nomodify notrap
restrict 172.235.0.0 netmask 255.255.0.0 nomodify notrap
restrict -6 ::1
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
server 3.asia.pool.ntp.org
To configure ntp on ntp client

To configure allow port 123 on IPtables firewalls
cat /etc/sysconfig/iptables
The output as bellow
-A OUTPUT -d 192.16.1.10/32 -m state --state NEW -p udp --dport 123 -j ACCEPT
To configure ntp.conf file
server 192.16.1.10 prefer
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
To check status ntp client synchronised to ntp server
ntpstat ; ntpq -p
The content as bellow
synchronised to NTP server (192.16.1.10) at stratum 4
   time correct to within 144 ms
   polling server every 128 s
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*ns1.huuphan.com 118.102.5.136    3 u   96  128  377    0.249   17.658   8.539
 time.vng.vn     .STEP.          16 u    - 1024    0    0.000    0.000   0.000
 laika.paina.net .STEP.          16 u    - 1024    0    0.000    0.000   0.000
 mail.khangthong .STEP.          16 u    - 1024    0    0.000    0.000   0.000
To start services ntp server both ntp client and ntp server.
service ntpd start
service iptables restart
netstat -tulpn

Comments

Popular posts from this blog

Bash script list all IP addresses connected to Server with Country Information

zimbra some services are not running [Solve problem]

Whitelist and Blacklist domain in zimbra 8.6