Install and configure ntp centos 7

In this tutorial, How to install and configure ntp server in Centos. NTP- is a protocol which runs over port 123 UDP at Transport Layer and allows computers to synchronize time over networks for an accurate time.

Install NTPd and Configure NTP server

[vagrant@DevopsRoles ~]$ sudo yum -y install ntp

Configure NTP server

[vagrant@DevopsRoles ~]$ sudo vi /etc/ntp.conf

The content file “ntp.conf” as below

# line 18: add the network range your network
restrict 10.0.2.0 mask 255.255.255.0 nomodify notrap
# change servers for synchronization
server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
server 3.asia.pool.ntp.org

Start and startup ntp

[vagrant@DevopsRoles ~]$ sudo systemctl start ntpd
[vagrant@DevopsRoles ~]$ sudo systemctl enable ntpd

If Firewalld is running, allow NTP service. NTP uses 123/UDP.

[vagrant@DevopsRoles ~]$ sudo firewall-cmd --add-service=ntp --permanent
[vagrant@DevopsRoles ~]$ sudo firewall-cmd --reload

Check it works normally

[vagrant@DevopsRoles ~]$ ntpq -p
Install and configure ntp centos 7
, , , ,

About HuuPV

My name is Huu. I love technology and especially Devops Skill such as Docker, vagrant, git so forth. I likes open-sources. so I created DevopsRoles.com site to share the knowledge that I have learned. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

Your email address will not be published. Required fields are marked *

Comment moderation is enabled. Your comment may take some time to appear.

This site uses Akismet to reduce spam. Learn how your comment data is processed.