Wednesday, October 12, 2016

Install NTP Server And Client On CentOS 7

NTP Server01 IP: 123.123.123.150
NTP Client IP: 123.123.123.151

1. Install NTP Server on CentOS 7
yum -y install ntp

vi /etc/ntp.conf
server 0.kh.pool.ntp.org
server 0.asia.pool.ntp.org
server 2.asia.pool.ntp.org  
logfile /var/log/ntp.log

firewall-cmd --add-service=ntp --permanent
firewall-cmd --reload

After you have opened Firewall port 123,
Start NTP server and make sure you enable it system-wide.
Use the following commands to manage the service.
systemctl restart ntpd
systemctl enable ntpd
systemctl status ntpd

After NTP daemon has been started,
wait a few minutes for the server to synchronize time with its pool list servers,
then run the following commands to verify NTP peers synchronization status and your system time.
ntpq -p
date -R

ntpdate -q  0.kh.pool.ntp.org  0.asia.pool.ntp.org

2. Configure NTP Client on CentOS 7
vim /etc/hosts
123.123.123.150 ntpsvr01        ntpsvr01.vnkk.net

yum -y install ntp

vim /etc/ntp.conf
server ntpsvr01.vnkk.net
server ntpsvr02.vnkk.net
logfile /var/log/ntp.log

systemctl restart ntpd
systemctl enable ntpd
systemctl status ntpd

ntpdate –u ntpsvr01.vnkk.net
ntpdc -c sysinfo

No comments:

Post a Comment