How to Setup NTP Server on CentOS/RHEL 7/6 and Fedora 30/29
Abstract: we will configure one of Linux system as NTP server which will be synchronized from public NTP server. Now remaining system’s on LAN will sync their t
We have running approximate 50 systems on our LAN. In which most of the systems are running with Linux operating system’s and few of them are running with Windows and MAC. In this setup, we will configure one of Linux system as NTP server which will be synchronized from public NTP server. Now remaining system’s on LAN will sync their time from local LAN NTP server.
Step 1 – Install NTP ServerNTP packages are available under default repositories. You just log in to your server as root user and execute the following command.
yum install ntp ## CentOS/RHEL systems dnf install ntp ## Fedpra systemsStep 2 – Setup NTP ServerSync Local Time from pool.ntp.org
First, we need to keep synchronize the time on this server. For this, we will use NTP POOL cluster servers to synchronize the time of the local system. NTP POOL project is providing a large number of cluster servers. Let’s edit the NTP configuration file and update the following values
vim /etc/ntp.conf
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
As NTP pool providing a large number of server spread worldwide. We suggest using any nearby servers also. You can find nearby servers at http://www.pool.ntp.org/en/.
Allow LAN SystemsNow configure your NTP server to allow LAN systems to keep synchronize their time from this server. To do it add the following entry in the configuration file
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrapStep 3 – Restart NTP Server
NTP server listen on UDP port 123. After making all above configuration, Let’s restart NTP server using following commands.
For CentOS/RHEL 7 and Fedorasystemctl start ntpd systemctl enable ntpdFor CentOS/RHEL 6/5
service ntpd start chkconfig ntpd on