Set Clock Using NTP

Note: There is a strain on the first tier of time servers. If you don't have a very specific need to be more accurate than 10ths of seconds, you should use your ISP's time server, something near you, or a random server from pool.ntp.com.

Setup the service to start at boot.

chkconfig ntpd on

Set the time server.

ntpdate ntp.xmission.com

Start the NTPD service (Redhat / CentOS way).

service ntpd start

Setup the clock to sync at boot, add the following to /etc/rc.local. This is not typically necessary, because the clock is set at regular intervals by the ntp daemon. But, on a system that has a time issue such as a dead CMOS battery, this can be useful.

# initial clock sync
/etc/init.d/ntpd stop
/usr/sbin/ntpdate -b ntp1.hurdman.org
/usr/sbin/ntpdate -b ntp2.hurdman.org
/etc/init.d/ntpd start
comments powered by Disqus
linux/setting_the_clock_using_ntp.txt · Last modified: 2020/06/01 22:53 (external edit)