NTP Server

Introduction

Setting your servers’s clock and timezone properly is essential in ensuring the healthy operation of distrubted systems and maintain accurate log timestamps. This article will show you how to install and configure the NTP time synchronization service on an Red Hat Enterprise Linux 7.2 Server.

Set Timezone

# list available timezones
$ timedatectl list-timezones
# set desired timezone
sudo timedatectl set-timezone Asia/Shanghai
# verify the timezone has been set properly
$ timedatectl

Install

yum -y install ntp

Configure

Choose ntp servers and add them to the configure file

server 0.rhel.pool.ntp.org iburst
server 1.rhel.pool.ntp.org iburst
server 2.rhel.pool.ntp.org iburst
server 3.rhel.pool.ntp.org iburst

Setup Client Range

restrict 192.168.249.0 mask 255.255.255.0 nomodify notrap

Log File

logfile /var/log/ntp.log

### Firewall

```shell
# firewall-cmd --add-service=ntp --permanent
# firewall-cmd --reload

Service Management

# systemctl start ntpd
# systemctl enable ntpd
# systemctl status ntpd

Verify Server Configure

ntpq -p