Configure Network Time Protocol (NTP) on CentOS 6.3

Accurate timekeeping is crucial for many server operations. Network Time Protocol (NTP) is an Internet protocol used to synchronize the clocks of computers or servers to some NTP server on the internet or intranet.

This tutorial will guide you on how to configure the Network Time Protocol (NTP) on CentOS 6.3. This process is an alternative to manual setup and allows for the system clock to be synchronized with a remote server over NTP.

For a deeper understanding of web servers, you may want to explore our guide on Apache, Nginx, and LiteSpeed.

Immediate or One-Time Synchronization

To synchronize immediately or for one-time synchronization only, use the ntpdate command as shown below:

[root@centos63 ~]# ntpdate -q time.internet.com

To enable running the ntpdate at boot time, use the following command:

[root@centos63 ~]# chkconfig ntpdate on

Setting Up the NTP Daemon for Automatic Synchronization

Alternatively, you can set up the ntpd daemon to synchronize the time at boot time automatically. Here are the steps to do this:

See also  How to Install sysstat on CentOS 5.7 Linux Server

Install the ntpd service daemon:

[root@centos63 ~]# yum install ntp -y

Open the NTP configuration file /etc/ntp.conf:

[root@centos63 ~]# vi /etc/ntp.conf

Add or edit the list of public NTP servers. For example:

server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
server 3.asia.pool.ntp.org

Set the proper permissions, giving unrestricted access to localhost only:

restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1

Restart the NTP daemon:

[root@centos63 ~]# service ntpd restart
Shutting down ntpd:                                        [  OK  ]
Starting ntpd:                                             [  OK  ]

Ensure the ntpd daemon starts at boot time:

[root@centos63 ~]# chkconfig ntpd on

Commands Mentioned

  • ntpdate -q time.internet.com – This command is used for immediate or one-time synchronization with the specified NTP server.
  • chkconfig ntpdate on – This command enables the ntpdate to run at boot time.
  • yum install ntp -y – This command installs the ntpd service daemon.
  • vi /etc/ntp.conf – This command opens the NTP configuration file for editing.
  • service ntpd restart – This command restarts the NTP daemon.
  • chkconfig ntpd on – This command ensures the ntpd daemon starts at boot time.

Conclusion

In conclusion, configuring the Network Time Protocol (NTP) on CentOS 6.3 is a straightforward process that ensures accurate timekeeping on your server. By following the steps outlined in this tutorial, you can set up immediate or one-time synchronization, or configure the ntpd daemon for automatic synchronization at boot time. Remember, accurate timekeeping is crucial for many server operations, and NTP provides a reliable way to achieve this.

For more information on various hosting options, you can check out our guides on dedicated server, VPS server, cloud hosting, and shared hosting. These resources provide in-depth knowledge to help you make informed decisions about your hosting needs.

Remember, the key to successful server management is continuous learning and adaptation. Stay updated with the latest practices and don’t hesitate to experiment with new configurations that can optimize your server’s performance. Happy hosting!

FAQ

  1. What is the Network Time Protocol (NTP)?

    Network Time Protocol (NTP) is an Internet protocol used to synchronize the clocks of computers or servers to some NTP server on the internet or intranet.

  2. What is the ntpdate command used for?

    The ntpdate command is used for immediate or one-time synchronization with a specified NTP server.

  3. What does the command chkconfig ntpdate on do?

    The command chkconfig ntpdate on enables the ntpdate to run at boot time.

  4. What is the purpose of the ntpd service daemon?

    The ntpd service daemon is used to automatically synchronize the system time with a remote server over the Network Time Protocol (NTP) at boot time.

  5. What does the command service ntpd restart do?

    The command service ntpd restart is used to restart the NTP daemon.

Comments

1 Comment

Leave a Reply

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