NTP client ----> NTP server (192.16.1.10)
To configure ntp on ntp server
To configure allow port 123 on IPtables firewalls
cat /etc/sysconfig/iptablesThe output as bellow
-A INPUT -p tcp -m state --state NEW --dport 123 -j ACCEPTTo configure ntp.conf file
-A INPUT -p udp -m state --state NEW --dport 123 -j ACCEPT
restrict 127.0.0.1To configure ntp on ntp client
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 allow port 123 on IPtables firewalls
cat /etc/sysconfig/iptablesThe output as bellow
-A OUTPUT -d 192.16.1.10/32 -m state --state NEW -p udp --dport 123 -j ACCEPTTo configure ntp.conf file
server 192.16.1.10 preferTo check status ntp client synchronised to ntp server
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
ntpstat ; ntpq -pThe content as bellow
synchronised to NTP server (192.16.1.10) at stratum 4To start services ntp server both ntp client and ntp server.
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
service ntpd start
service iptables restart
netstat -tulpn
Thanks for reading How to configure ntp client server My blog Effortless Zimbra Mail Management: Unleashing the Power of Linux Commands, How-To, and Bash Scripts I hope this is useful.