Reply to comment

NTP Time Server on Ubuntu

Anda ingin men-sinkronisasikan waktu dari server anda sesuai dengan jam di dunia internet ?
Maka anda perlu membangun sebuah time server menggunakan NTP.
Saya membangun NTP server ini di Linux Ubuntu.

Berikut adalah langkah - langkahnya :

  1. Install NTP Server
    # apt-get install ntp
  2. Edit NTP Configuration
    # vi /etc/ntp.conf
  3. Berikut ini adalah contoh konfigurasi dari NTP conf yang saya gunakan :

    driftfile /var/lib/ntp/ntp.drift


    statsdir /var/log/ntpstats/


    statistics loopstats peerstats clockstats
    filegen loopstats file loopstats type day enable
    filegen peerstats file peerstats type day enable
    filegen clockstats file clockstats type day enable


    # Pilihlah server yang dekat dengan lokasi anda, karena saya di Indonesia, maka saya gunakan server ini
    server 3.id.pool.ntp.org
    server 1.asia.pool.ntp.org
    server 3.asia.pool.ntp.org


    restrict -4 default kod notrap nomodify nopeer noquery
    restrict -6 default kod notrap nomodify nopeer noquery


    # Kita juga tidak ingin membatasi akses pada NTP server kita sendiri
    restrict 127.0.0.1


    # Karena digunakan sebagai time server dari PC yang lain yang ada di jaringan anda maka berikan konfigurasi di bawah
    restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
  4. Stop service NTP
    # /etc/init.d/ntp stop
  5. Kita cocokkan server ini dengan time server yang ada
    # ntpdate 3.id.pool.ntp.org
  6. Start service NTP
    # /etc/init.d/ntp start
  7. Cek apakah server anda sudah ter-sinkronisasi dengan time server yang anda isikan tadi, jika belum anda bisa menunggu beberapa menit atau jam.
    # ntpq -p

    Berikut adalah output command di atas di tempat saya :

    remote refid st t when poll reach delay offset jitter
    ==============================================================================
    *dns1.lipi.go.id 192.168.60.16 2 u 33 64 377 18.614 3.090 13.598
    +202.71.100.67 75.144.70.35 3 u 1 64 377 110.989 1.845 7.572
    +120-88-47-10.in 158.43.128.33 2 u 31 64 377 86.422 4.329 8.304

    Perhatikan tanda "*", jika output dari command anda sudah ada tanda bintangnya, maka anda sudah ter-sinkron dengan time server yang anda definisikan.

    Selain cara di atas anda bisa menggunakan command ini untuk meng-cek apakah NTP Server anda sudah ter-sinkron dengan time server yang anda definisikan :
    # ntpq -c rv | grep stratum

    Berikut adalah output di tempat saya :
    processor="i686", system="Linux/2.6.24-16-server", leap=00, stratum=3,

    Perhatikan tulisan stratum, jika nilainya bukan 16 seperti di atas, maka anda sudah tersinkron dengan time server.

  8. Berikan hak akses pada NTP server anda pada port udp 123 :
    iptables -A INPUT -p udp -m state --state NEW -m udp --dport 123 -j ACCEPT
  9. Coba dari salah satu PC client (saya menggunakan client linux juga), untuk sinkronisasi dengan NTP server anda
    # ntpdate 192.168.1.2

    Jika hasil outputnya seperti ini, maka anda telah sukses :
    28 Oct 11:36:39 ntpdate[17223]: adjust time server 192.168.1.2 offset 0.010089 sec

Selamat mencoba :D

Referensi :
http://www.debianadmin.com/ntp-server-and-client-configuration-in-debian...
http://hanadi.wordpress.com/2009/09/15/ntp-server-ubuntu-9-04/
http://www.ubuntugeek.com/network-time-protocol-ntp-server-and-clients-s...
http://www.cyberciti.biz/faq/debian-ubuntu-linux-install-ntpd/
http://ubuntuforums.org/showthread.php?t=855519

Reply

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd><img><tr><td><table><br> <tbody> <th>
  • Lines and paragraphs break automatically.
  • Images can be added to this post.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.