Sunday, August 9, 2009

NTP Server on UNIX flavours

Below is how to enabling Network Time Protocol Daemon (ntpd) on your linux box (RedHat, CentOS, Fedora)

Make sure you already install ntp package, if not type
CODE:
# yum install ntp


Connecting your linux box to NTP Server. because I am in Indonesia, I am using ntp.kim.lipi.go.id
CODE:
# vi /etc/ntp.conf
server ntp.kim.lipi.go.id
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org



If you want to provide other PCs in your network synchronize their time on to NTP Server add this line, so other PCs dont need consume bandwidth.

CODE:
# vi /etc/ntp.conf
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap



Enabling ntpd run everytime your linux start
CODE:
# chkconfig ntpd on


Start, stopping ntpd
CODE:
# service ntpd start
# service ntpd stop
# service ntpd restart



Verifying ntpd running
CODE:
# pgrep ntpd


Doing An Initial Synchronization. Must be done when ntpd stop
CODE:
# ntpdate -u ntp.kim.lipi.go.id


Determining If NTP Is Synchronized Properly
CODE:
# ntpq -p