Time and date on CentOS 7 Howto

NTP stands for Network Transport Protocol and it is used to keep the time on the servers synced with each other using a common reliable source to get the time.

The example below is for a basic NTP client/server setup.

NTP client

Install NTP with

yum install ntp

Then check timezone with

timedatectl

If you’re not satisfied with your timezone and you wish to change, first list available zones with

timedatectl list-timezones

and set your time zone with command below: (e.g. Berlin)

timedatectl set-timezone Europe/Berlin

Active the NTPD service at boot:

systemctl enable ntpd
systemctl start ntpd

To get a basic report you can use commands ntpstat or date

And to get some information about the time synchronization process

ntpq -p

All of your NTP configurations is available in /etc/ntp.conf file.

To be able to use your server as a NTP server for local network, please be sure you have a line

restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

where 192.168.1.0/24 is a local network you want to sync with your NTP server.

You can get the public NTP servers specific to your region from pool.ntp.org.

Leave a Reply

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