Categories
TIK

Konfigurasi NTP Server di Fedora

Konfigurasi NTP Server di Fedora

Untuk keperluan sinkronisasi jam di semua server dan host dalam sebuah LAN, perlu ada sebuah host yang bertindak sebagai NTP Server. Ini lebih baik ketimbang semua host mengacu ke sebuah NTP Server yang berada di luar sana. Untuk menjalankan NTP Server dibutuhkan paket ntp dengan ntpd-nya. Yakinkan bahwa kedua paket sudah terisntalasi, misal dengan mengetikkan perintah baris “yum list ntp*”, “ntpdate –help” atau “ntpdate 0.fedora.pool.ntp.org”.

 

Sebelum menjalankan ntpd di calon server NTP, edit file /etc/ntp.conf

driftfile /var/lib/ntp/drift

restrict default kod nomodify notrap nopeer noquery

restrict -6 default kod nomodify notrap nopeer noquery

restrict 127.0.0.1

restrict -6 ::1

server 0.fedora.pool.ntp.org

server 1.fedora.pool.ntp.org

server 2.fedora.pool.ntp.org

includefile /etc/ntp/crypto/pw

keys /etc/ntp/keys

 

Tambahkan sebaris nama server acuan NTP Server ke dalam file /etc/ntp.conf :

server ntp.kim.lipi.go.id

 

Jalankan ntp daemon di calon NTP server:

# chkconfig ntpd on

# service ntpd start

 

Lakukan sinkronisasi dengan NTP Server luar

[root@nms ~]# ntpdate ntp.kim.lipi.go.id

12 Dec 11:16:26 ntpdate[2413]: the NTP socket is in use, exiting

 

Pesan “socket is in use” mengharuskan Anda untuk menghentikan terlebih duhulu ntpd-nya

[root@nms ~]# service ntpd stop

Mematikan ntpd: [ OK ]

 

Lakukan sinkronkan ulang

[root@nms ~]# ntpdate ntp.kim.lipi.go.id

12 Dec 11:16:40 ntpdate[2439]: adjust time server 203.160.128.2 offset -0.000117 sec

 

Jalankan ntp daemon kembali

[root@nms ~]# service ntpd start

Memulai ntpd: [ OK ]

 

Tes status NTP Server yang baru saja dibuat dari sisi servernya :

[root@svec ~]# ntpq -p

remote refid st t when poll reach delay offset jitter

==============================================================================

*vm1.jaringinter 216.218.254.202 2 u 36 64 377 1.895 -4.557 0.053

+netmon.cpe.rmut 203.185.69.60 2 u 11 64 377 421.424 -20.924 0.450

-221.139.48.11 115.139.9.150 2 u 3 64 377 223.772 -60.839 0.323

+ntp.kim.lipi.go .UTC. 1 u 4 64 377 5.203 -3.432 0.465

[root@svec ~]#

 

Sekarang seluruh client sudah bisa mengacu ke NTP Server baru ini. Soal caranya, mungkin setiap client memiliki cara yang berbeda-beda sesuai dengan distro atau sistem operasi yang digunakan. Sebelum melakukan sinkronisasi dari sisi client, cek kesiapan server. Untuk client Fedora :

# ntpdate 202.46.3.xx

 

Kalau server NTP nya belum siap, dari sisi client, akan ada pesan sbb :

[root@svec ~]# ntpdate 202.46.3.xx

12 Dec 11:31:27 ntpdate[4099]: no server suitable for synchronization found

 

Kalau server NTP nya sudah siap digunakan, akan ada pesan sbb :

[root@nms ~]# ntpdate 0.fedora.pool.ntp.org

12 Dec 11:42:58 ntpdate[5583]: adjust time server 203.160.128.3 offset -0.013135 sec

 

[root@nms ~]# ntpdate 1.fedora.pool.ntp.org

12 Dec 11:44:07 ntpdate[5656]: adjust time server 203.160.128.2 offset -0.004170 sec

 

[root@nms ~]# ntpdate 2.fedora.pool.ntp.org

12 Dec 11:44:41 ntpdate[5733]: adjust time server 202.134.6.170 offset 0.007364 sec

 

[root@nms ~]# ntpdate ntp.lipi.go.id

12 Dec 11:44:58 ntpdate[5760]: adjust time server 203.160.128.2 offset -0.002601 sec

 

[root@nms ~]# ntpdate id.pool.ntp.org

12 Dec 11:45:47 ntpdate[6012]: adjust time server 203.153.60.200 offset 0.006996 sec

 

Sumber : http://www.pool.ntp.org/zone/id

 

Masalahnya : bagaimana agar NTP Server yang barusan dibuat bisa siap? Padahal semua langkah sudah diikuti. Atau dengan kata lain, bagaimana agar pesan dari sisi client bisa berubah dari :

[root@svec ~]# ntpdate 202.46.3.xx

12 Dec 11:31:27 ntpdate[4099]: no server suitable for synchronization found

 

menjadi seperti :

[root@nms ~]# ntpdate id.pool.ntp.org

12 Dec 11:45:47 ntpdate[6012]: adjust time server 203.153.60.200 offset 0.006996 sec

 

Sudah dicoba untuk membuka port 123 (UDP) di sisi server, sisi client tetap mengeluarkan pesan “no server suitable for synchronization found”. Emang sih, kalau dicek pakai http://www.yougetsignal.com/tools/open-ports/, port 123 masih closed. Tapi NTP server lain juga katanya closed tetapi tetap bisa digunakan. Salah dimana ya?

 

Di FreeBSD (serpong6), konfigurasi NTP-nya ada di /usr/local/etc/ntpd.conf. Cek dihttp://www.cyberciti.biz/faq/freebsd-install-configure-openntpd-server-to-sync-time/

 

 

Coba membuka port 123 UDP di NTP Server dengan iptables:

/sbin/iptables -A INPUT -p udp –dport 123 -j ACCEPT

/sbin/iptables -A OUTPUT -p udp –sport 123 -j ACCEPT

 

Cek dengam perintah baris “nmap -O ip_address”, ternyata port 123 belum terbuka juga. Cek dengan yougetsignal, port 123 juga belum terbuka. Ini menyebabkan ntpdate juga belum bisa dijalankan? Entahlah.

 

Setelah menunggu seharian, akhirnya NTP Server berhasil juga (dengan sendirinya?). Ini agak mengherankan. Keberhasilan ditandai dengan pesan dari sisi client sbb :

[root@nms ~]# ntpdate -u 202.46.3.xx

12 Dec 15:50:20 ntpdate[28830]: step time server 202.46.3.xx offset 11.703232 sec

 

Konklusi

Setelah ntp terisntalasi pada NTP Server, ubah atau sesuaikan isi file /etc/ntp.conf seperti di bawah ini :

driftfile /var/lib/ntp/drift

restrict default kod nomodify notrap nopeer noquery

restrict -6 default kod nomodify notrap nopeer noquery

restrict 127.0.0.1

restrict -6 ::1

includefile /etc/ntp/crypto/pw

keys /etc/ntp/keys

server 2.id.pool.ntp.org prefer

server 1.asia.pool.ntp.org

server 3.asia.pool.ntp.org

server ntp.kim.lipi.go.id

 

Setelah server di restart, butuh 10 menitan agar client bisa menjalankan ntpdate. Di server NTP saya tidak perlu menjalankan ntpd dan iptables. ntpd sudah otomatis jalan saat boot. Sedangkan iptables tampaknya memang tidak diperlukan. Port 123 meski tetap tertutup, client tetap bisa menjalankan ntpdate asalkan sabar menunggu 10 menit-an.

 

Agar tidak perlu menjalankan ntpd setiap kali komputer di reboot, masuk ke menu Sistem –> Administrasi –> Layanan –> pilih layanan ntpd –> Aktifkan –> Jalankan. Langkah ini dapat diulangi untuk layanan ntpdate. Jika menggunakan perintah baris, gunakan perintah baris “chkconfig”. Untuk melihat status setiap daemon, gunakan perintah baris “chkconfig –list”. Untuk mengaktifkan salah satu layanan, misal ntpd, gunakan perintah baris “chkconfig ntpd on”. Untuk menghentikan layanan, misal ntpd, gunakan perintah baris “chkconfig ntpd off”.

 

Saya mencoba restart server beberapa kali, setelah 10 menit berjalan, client baru bisa melakukan sinkronisasi dengan server. Saya belum mencoba menghapus port 123 udp di firewall. Untuk menghapus port 123 UDP dari firewall, masuk ke menu Sistem –> Administrasi –> Firewall –> masukkan password root –> pilih Port-port Lainnya –> pilih port yang mau dihapus, misal Port = 123, Protocol = udp, Layanan = ntp. –> Hapus. Pilih menu Berkas –> Apply –> Keluar.

 

Melihat open port tapi yang UDP

 

[root@svec ~]# nmap -sU -P0 -T Aggressive -F 202.46.3.xx

 

Starting Nmap 5.21 ( http://nmap.org ) at 2010-12-13 12:51 WIT

Nmap scan report for 202.46.3.xx

Host is up (0.0000080s latency).

Not shown: 95 closed ports

PORT STATE SERVICE

111/udp open rpcbind

123/udp open ntp

631/udp open|filtered ipp

2049/udp open nfs

5353/udp open|filtered zeroconf

 

Nmap done: 1 IP address (1 host up) scanned in 1.25 seconds

[root@svec ~]#

 

Opsi di nmap :

-sU = UDP scan

-PO[protocol list]: IP Protocol Ping

-T: Set timing template (higher is faster)

-F: Fast mode – Scan fewer ports than the default scan

 

http://msmunir-ina.blogspot.com/2010/12/ntp-server-di-fedora.html

Konfigurasi NTP Server di Fedora

 

 

http://www.stisitelkom.ac.id

http://hilfan.blog.stisitelkom.ac.id

Leave a Reply

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

Discover more from Just Shared on Tel-U

Subscribe now to keep reading and get access to the full archive.

Continue reading