SIMULATOR PING, TRACEROUTE & ICMP UNTUK MURID TKJ
PING (Packet Internet Groper) adalah utilitas jaringan untuk menguji konektivitas antara dua device di jaringan. Ping bekerja dengan mengirim paket ICMP Echo Request dan menunggu ICMP Echo Reply.
Tujuan ping:
Sejarah: Dibuat oleh Mike Muuss pada Desember 1983 untuk troubleshooting jaringan ARPANET. Nama "ping" terinspirasi dari suara sonar kapal selam.
ICMP adalah protokol layer 3 (Network Layer) yang digunakan untuk mengirim pesan kontrol dan error di jaringan IP. ICMP bukan untuk transfer data user, tapi untuk diagnostik dan kontrol.
| TYPE | CODE | NAMA | FUNGSI |
|---|---|---|---|
| 0 | 0 | Echo Reply | Response ke ping (reply) |
| 3 | 0-15 | Destination Unreachable | Host/network tidak bisa dicapai |
| 5 | 0-2 | Redirect | Router redirect |
| 8 | 0 | Echo Request | Request untuk ping |
| 11 | 0-1 | Time Exceeded | TTL habis (dipakai traceroute) |
| 12 | 0 | Parameter Problem | IP header error |
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Code | Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Identifier | Sequence Number | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Data ... | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
ping 8.8.8.8C:\> ping 8.8.8.8
Pinging 8.8.8.8 with 32 bytes of data:
Reply from 8.8.8.8: bytes=32 time=15ms TTL=117
Reply from 8.8.8.8: bytes=32 time=14ms TTL=117
Reply from 8.8.8.8: bytes=32 time=16ms TTL=117
Reply from 8.8.8.8: bytes=32 time=15ms TTL=117
Ping statistics for 8.8.8.8:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 14ms, Maximum = 16ms, Average = 15ms
Waktu yang dibutuhkan paket pergi-pulang. Diukur dalam milidetik (ms).
Nilai yang menunjukkan berapa hop paket bisa lewat sebelum di-drop. Setiap router kurangi TTL 1.
Traceroute (tracert di Windows) adalah utilitas untuk melihat route yang dilalui paket dari source ke destination.
C:\> tracert google.com tracert to google.com [142.250.195.46], 30 hops max, 32 byte packets 1 192.168.1.1 2ms 1ms 2ms 2 10.0.0.1 5ms 4ms 5ms 3 172.16.0.1 10ms 11ms 10ms ... 12 142.250.195.46 25ms 24ms 25ms
| GEJALA | KEMUNGKINAN PENYEBAB | SOLUSI |
|---|---|---|
| Ping localhost gagal | TCP/IP stack corrupt | Reinstall TCP/IP, restart |
| Ping gateway gagal | Kabel loose, switch mati | Cek fisik, cek IP config |
| Ping gateway OK, internet gagal | Router tidak konek ISP | Cek router, cek DNS |
| Ping IP OK, domain gagal | DNS server down | Cek DNS settings |
| High latency (>100ms) | Kongesti, route panjang | Cek bandwidth, route |
| Packet loss >5% | Kabel rusak, interference | Cek fisik, ganti cable |
ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-w timeout] host -t : Ping terus-menerus (Ctrl+C untuk stop) -a : Resolve hostname dari IP -n : Jumlah paket (default 4) -l : Ukuran paket (default 32, max 65500) -f : Set Don't Fragment flag -i : Set TTL value -w : Timeout dalam ms (default 1000)
ping [-c count] [-i interval] [-s size] [-t ttl] [-W timeout] host -c : Jumlah paket -i : Interval antar paket (default 1s) -s : Ukuran paket (default 56) -t : Set TTL -W : Timeout dalam detik
Jitter adalah variasi latency antar paket. Penting untuk real-time applications (VoIP, video call, gaming).
Jitter = |RTT(n) - RTT(n-1)| Contoh: Packet 1: 15ms Packet 2: 18ms -> jitter = |18-15| = 3ms Packet 3: 14ms -> jitter = |14-18| = 4ms Packet 4: 20ms -> jitter = |20-14| = 6ms Average jitter = (3+4+6)/3 = 4.3ms
Tool Linux yang combine ping + traceroute. Tampilkan statistik real-time untuk setiap hop.
mtr google.com
Loss% Snt Last Avg Best Wrst StDev
1. 192.168.1.1 0.0% 10 2.0 2.1 1.8 2.5 0.2
2. 10.0.0.1 0.0% 10 5.2 5.3 5.0 5.8 0.2
...
12. 142.250.195.46 0.0% 10 25.3 25.5 24.8 26.2 0.4
Teknik tunneling data lewat ICMP packets. Bisa bypass firewall yang block TCP/UDP.
Attacker ping seluruh IP range untuk discover active hosts. Defense: Block ICMP dari external.
Mulai dari lokal ke remote: ping localhost -> ping gateway -> ping IP publik -> ping domain. Jika gagal di step tertentu, masalah ada di layer tersebut.
Ping berhasil (reply) belum tentu jaringan bagus. Cek RTT: <50ms bagus untuk domestic, <100ms untuk international.
Pakai ping -t (Windows) untuk ping terus. Biarkan berjalan 5-10 menit untuk deteksi packet loss intermittent.
Ping dengan size besar (-l 1500) untuk test MTU issue. Jika ping size besar gagal tapi size kecil OK, ada MTU problem.
Jika ping ke host gagal, traceroute untuk tahu di hop mana packet hilang. Berguna untuk escalate ke ISP.
Request timed out bisa berarti host down ATAU firewall block ICMP. Test dengan traceroute atau coba akses service lain.
WiFi selalu punya jitter lebih tinggi dari wired. Jitter 10-30ms normal di WiFi. Untuk VoIP/gaming, pakai kabel.
Ping gateway dan DNS server rutin, catat RTT normal. Jika RTT tiba-tiba naik 2x dari baseline, ada masalah.
Gunakan 8.8.8.8 (Google), 1.1.1.1 (Cloudflare), 9.9.9.9 (Quad9) untuk test connectivity.
Beyond ping: kuasai tracert/traceroute, arp -a, ipconfig/ifconfig, netstat, nslookup/dig, mtr.
Jika user complain lambat, test dari device lain. Jika hanya 1 device lambat = masalah device. Jika semua device lambat = masalah network.
Untuk critical network, setup automated ping monitoring (Nagios, Zabbix, PRTG). Deteksi degradasi sebelum jadi masalah besar.
Request timed out artinya tidak ada reply dalam timeout period. Penyebab:
Cara cek:
TTL (Time To Live) = nilai di IP header yang menunjukkan berapa hop packet bisa lewat sebelum di-drop.
Initial TTL (default) - Received TTL = Jumlah Hop Default TTL by OS: - Windows: 128 - Linux: 64 - Cisco: 255 Contoh: Ping dari Windows ke Linux server: Reply TTL = 117 Jumlah hop = 128 - 117 = 11 hop
Beberapa host memang tidak reply ICMP karena:
Alternatif test connectivity:
curl -I https://hosttcping host portTest-NetConnection host -Port 80Ping 10 packets, catat RTT tiap packet: 15ms, 18ms, 14ms, 20ms, 16ms, 19ms, 15ms, 17ms, 14ms, 18ms Jitter antar packet: |18-15| = 3ms |14-18| = 4ms |20-14| = 6ms ... dst Average jitter = sum(jitter) / count
mtr google.com # Kolom "StDev" = jitter (standard deviation)
# Windows (ping dengan Don't Fragment flag) ping -f -l 1472 8.8.8.8 # 1472 = 1500 - 20 (IP header) - 8 (ICMP header) # Jika reply OK, MTU 1500 OK # Jika "Packet needs to be fragmented", MTU < 1500 # Binary search untuk cari MTU exact ping -f -l 1400 8.8.8.8 # OK ping -f -l 1450 8.8.8.8 # OK ping -f -l 1472 8.8.8.8 # Fail ping -f -l 1460 8.8.8.8 # OK # MTU = 1460 + 28 = 1488 bytes
* di traceroute artinya router di hop tersebut tidak reply ICMP Time Exceeded.
Tidak selalu masalah! Banyak router production block ICMP untuk security. Selama hop berikutnya muncul dan destination tercapai, route OK.
@echo off
:loop
ping -n 1 8.8.8.8 | find "TTL=" >> ping_log.txt
if errorlevel 1 (
echo %date% %time% - PING FAILED >> ping_alert.txt
)
timeout /t 60
goto loopPing sweep = teknik scan IP range untuk discover active hosts.
# Ping sweep nmap -sn 192.168.1.0/24 # Ping sweep dengan output ke file nmap -sn 192.168.1.0/24 -oN active_hosts.txt
Legal note: Ping sweep di network sendiri OK. Ping sweep di network orang lain tanpa izin = ILLEGAL.
Reply from 8.8.8.8: bytes=32 time=15ms TTL=117 Reply from 8.8.8.8: bytes=32 time=14ms TTL=117 Reply from 8.8.8.8: bytes=32 time=16ms TTL=117 Reply from 8.8.8.8: bytes=32 time=15ms TTL=117 Sent = 4, Received = 4, Lost = 0 (0% loss) Min = 14ms, Max = 16ms, Avg = 15ms
Interpretasi: Network excellent.
Reply from 8.8.8.8: bytes=32 time=250ms TTL=117 Reply from 8.8.8.8: bytes=32 time=280ms TTL=117 Avg = 275ms
Interpretasi: Network slow. RTT >200ms = poor.
Reply from 8.8.8.8: bytes=32 time=15ms TTL=117 Request timed out. Reply from 8.8.8.8: bytes=32 time=18ms TTL=117 Request timed out. Sent = 4, Received = 2, Lost = 2 (50% loss)
Interpretasi: 50% packet loss = critical.
BELUM ADA RIWAYAT