Membangun server & client Network Time Protocol (NTP)

27 Mar

Network Time Protocol (NTP)
NTP adalah protocol yang didesign untuk synchronize clocks dari computer dan network ke Internet / Local Area Network
NTP (version 4) dapat maintain time dari public Internet dengan ketepatan 10 milliseconds (1/100 second)
dan jika menggunakan LAN accuracies 200 microseconds (1/5000 second)

======================================================
SERVER NTP : sinkronisasi dengan internet
======================================================
Fedora Core release 2 (Tettnang)
A. Periksa , jika package belum ada segera diinstall
# rpm -qa | grep ntp
chkfontpath-1.10.0-1
ntp-4.2.0-7

B. setup kunfigurasi
# cp /etc/ntp.conf /etc/ntp.conf.asli

# vi /etc/ntp.conf
driftfile /var/lib/ntp/drift
server clock.isc.org
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
restrict 127.0.0.1
restrict ::1

C. Test
i. jam sebelumnya

# date
Thu Mar 26 08:59:21 WIT 2009

ii. ambil jam di internet
# ntpdate clock.isc.org
Looking for host clock.isc.org and service ntp
host found : clock.isc.org
26 Mar 09:00:39 ntpdate[10015]: step time server 204.152.184.72 offset 46.540820 sec

iii. jam sekarang
# date
Thu Mar 26 09:00:55 WIT 2009

D. Agar sistem selalu menjalankan
# chkconfig ntpd on
# service ntpd start
Starting ntpd: [ OK ]

E. Perhatian
i. misal jam server diubah, sedangkan ntp server sudah start
# service ntpd start
Starting ntpd: [ OK ]

# date -s 09:00:00
Thu Mar 26 09:00:00 WIT 2009

ii. lakukkan sinkronisasi
# ntpdate pool.ntp.org
Looking for host pool.ntp.org and service ntp
host found : IP-162-29.saranadata.com
26 Mar 09:00:21 ntpdate[10182]: the NTP socket is in use, exiting

iii. periksa hasil server, ternyata tidak berubah
# date
Thu Mar 26 09:00:26 WIT 2009

iv. jika inigin sinkronisasi service ntp harus stop
# service ntpd stop
# ntpdate pool.ntp.org
Looking for host pool.ntp.org and service ntp
host found : mx3.lipi.go.id
26 Mar 09:22:11 ntpdate[10197]: step time server 202.155.61.28 offset 1289.923998 sec

# date
Thu Mar 26 09:22:14 WIT 2009

# service ntpd start

======================================================
SERVER NTP : sinkronisasi dengan LAN
======================================================
CentOS release 5.2 (Final)
A. Periksa , jika package belum ada segera diinstall

# rpm -qa | grep ntp
ntp-4.2.2p1-8.el5.centos.1
chkfontpath-1.10.1-1.1

B. setup kunfigurasi
# cp /etc/ntp.conf /etc/ntp.conf.asli
# vi /etc/ntp.conf
driftfile /var/lib/ntp/drift
server 172.20.140.11
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
restrict 127.0.0.1
restrict ::1

C. Test
i. jam sebelumnya
# date
Thu Mar 26 09:28:22 WIT 2009

ii. ambil jam di LAN
# ntpdate 172.20.140.11
26 Mar 09:57:08 ntpdate[654]: step time server 172.20.140.11 offset 1710.409301 sec

iii. jam sekarang
# date
Thu Mar 26 09:57:12 WIT 2009

D. Buat file, jika nggak ada & isinya, spt dibwah ini
# cat >> /etc/ntp/step-tickers << EOF
172.20.140.11
EOF

E. Agar sistem selalu menjalankan
# chkconfig ntpd on
# service ntpd start
Starting ntpd: [ OK ]

======================================================
CLIENT NTP : sinkronisasi dengan LAN
======================================================
Fedora Core release 4 (Stentz)
A. Periksa , jika package belum ada segera diinstall
# rpm -qa | grep ntp
ntp-4.2.0.a.20040617-8
chkfontpath-1.10.0-4

B. setup kunfigurasi
# mv /etc/ntp.conf /etc/ntp.conf.asli
# vi /etc/ntp.conf
restrict 127.0.0.1
server 172.20.140.33
driftfile /etc/ntp/drift
restrict 172.20.140.33 mask 255.255.0.0 nomodify notrap noquery

# vi /etc/ntp/step-tickers
172.20.140.33

C. Test
i. jam sebelumnya
# date
Thu Mar 26 09:28:22 WIT 2009

ii. ambil jam di LAN
# ntpdate 172.20.140.33
26 Mar 11:29:43 ntpdate[12661]: no server suitable for synchronization found
26 Mar 07:41:36 ntpdate[5728]: no server suitable for synchronization found
[tunggu beberapa waktu, jika firewall nggak ada, mestinya bisa]

# ntpdate 172.20.140.33
26 Mar 11:50:07 ntpdate[13033]: adjust time server 172.20.140.33 offset -0.151501 sec

iii. jam sekarang
# date
Thu Mar 26 11:50:12 WIT 2009

D. Buat file, jika nggak ada & isinya, spt dibwah ini
# cat >> /etc/ntp/step-tickers << EOF
172.20.140.33
EOF

D. Agar sistem selalu menjalankan
# chkconfig ntpd on
# service ntpd start
Starting ntpd: [ OK ]

E. Apakah time sudah sinkron ?, ditandai *
# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*172.20.140.33 172.20.140.11 3 u 10 64 377 0.341 551019. 148770.

6 Responses to “Membangun server & client Network Time Protocol (NTP)”

  1. slempase April 29, 2010 at 1:54 am #

    bagaimana membuat ntp server lokal dimana :

    pc server——pc client

    dengan os debian….

    apa yang harus di atur…saya dah coba tapi no server syncho…found jika saya ketik ntpdate ip_server
    saya bingung..mohon pencerahan

    • setijoagus April 29, 2010 at 7:58 am #

      lha……………..apakahsudah disetup ntpserver di pc server -nya ????
      kebetulan juga saya nggak familiar dengan debian

  2. slempase May 1, 2010 at 5:40 am #

    ngak jalan2…pak….
    saya install apt-get install ntp ntpdate di pc server

    apa bapak ada kawan tempat saya bertanyak….

  3. setijoagus May 3, 2010 at 9:49 am #

    “apt-get install ntp ntpdate di pc server”, lha komputer debiannya apakah sudah connect ke internet ?????
    kalau install saja belum sukses ya setting 2x yang jelaskan ya belumbisa dilakukan.

    kebetulan saya nggak pny teman yang bisa debian,coba nanya ke om google saja ya………

  4. dimas_rizqi October 7, 2010 at 5:41 am #

    kalo saya gini, kenapa harus menuggu sekitar 3 menit untu bisa sinkron dengan server, apakah ada database ato kata kunci yang bisa di ganti agar bisa lebih cepat….
    lalu apakah ada pengaruh jika dengan router yang memhubungkan server dengan klient???

    • setijoagus October 8, 2010 at 3:40 am #

      sorry aku nggak ngerti apa yang ditanyakan ?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: