Monday, June 18, 2007

Mengenal Traceroute/Tracert

Perintah traceroute atau tracert bagi seorang administrator pasti tidaklah asing. Namun sering kali apa yang sering dilakukan tidak selalu dipahami dengan baik. Berikut sekedar sharing tentang perintah traceroute/tracert ini.
Di lingkungan linux atau perangkat router atau sejenisnya dikenal sebagai perintah traceroute
Sedangkan bagi Windows dikenal dengan perintah tracert
Traceroute/tracert adalah tool untuk mengidentifikasi alur/rute antara dua buah host dan untuk memeriksa kontribusi dari tiap komponen tersebut ke keseluruhan Round Trip Time.
Traceroute default mengetahui sampai max 30 hop dan besar packets yg dikirimkan 40 byte. Contoh dari CBN melakukan traceroute ke site www.detik.com (202.158.66.20) hsl sbb :
traceroute to 202.158.66.20 (202.158.66.20), 30 hops max, 40 byte packets
1 ip3-17.cbn.net.id (202.158.3.17) 0.264 ms 0.260 ms 0.182 ms
2 vlan818.mgl-6500-1.cbn.net.id (202.158.31.33) 0.781 ms 0.589 ms 0.337 ms
3 net30.cyber-6500-1.cbn.net.id (202.158.31.241) 37.305 ms 36.957 ms 35.128 ms
4 202.158.31.173 0.886 ms 0.759 ms 0.740 ms
5 ip56-230.cbn.net.id (202.158.56.230) 0.970 ms 0.945 ms 0.843 ms
6 202.158.66.20 1.685 ms 1.472 ms 0.842 ms
Cara kerjanya traceroute mengirimkan 3 paket sebesar 40 byte ke tujuan dengan TTL nilai 1 melalui port UDP 33434.
Sesampai di hop pertama nilai TTL tsb dikurangi 1 sehingga bernilai 0 kemudian paket tersebut didrop. Berikutnya router di hop pertama tersebut mengirimkan paket ICMP ke pengirim. Selanjutnya traceroute mengirimkan paket dengan nilai TTL yang ditambah 1 sampai host tujuan dicapai.

Router#traceroute
Protocol [ip]:
Target IP address: 202.158.66.20
Source address:
Numeric display [n]:
Timeout in seconds [3]:
Probe count [3]:
Minimum Time to Live [1]:
Maximum Time to Live [30]:
Port Number [33434]:
Loose, Strict, Record, Timestamp, Verbose[none]:


Perintah traceroute di linux default menggunakan UDP berbeda dengan Windows yang gunakan protokol ICMP (http://forums.fedoraforum.org/archive/index.php/t-29142.html)
$ man traceroute
-I Use ICMP ECHO instead of UDP datagrams.

Jika ingin mengubah menggunakan ICMP tinggal memberi parameter -I, contoh :
$ traceroute -I 202.158.66.20

Apakah arti/maksud tanda * dari hasil traceroute ??
$ traceroute www.yahoo.com
traceroute to www-real.wa1.b.yahoo.com (209.131.36.158), 30 hops max, 38 byte packets
------cut------
10 ae0-p150.msr2.sp1.yahoo.com (216.115.107.73) 222.037 ms ae1-p151.msr2.sp1.yahoo.com (216.115.107.79) 218.608 ms ae1-p150.msr2.sp1.yahoo.com (216.115.107.77) 245.735 ms
11 te-9-1.bas-a1.sp1.yahoo.com (209.131.32.21) 228.639 ms te-9-1.bas-a2.sp1.yahoo.com (209.131.32.23) 240.764 ms te-8-1.bas-a2.sp1.yahoo.com (209.131.32.19) 216.198 ms
12 * * *
------end------

$ traceroute -I www.yahoo.com
traceroute to www-real.wa1.b.yahoo.com (209.131.36.158), 30 hops max, 38 byte packets
------cut------
10 ae0-p150.msr2.sp1.yahoo.com (216.115.107.73) 225.719 ms ae1-p141.msr1.sp1.yahoo.com (216.115.107.55) 234.344 ms 216.983 ms
11 te-9-1.bas-a1.sp1.yahoo.com (209.131.32.21) 228.488 ms 230.466 ms 232.777 ms
12 f1.www.vip.sp1.yahoo.com (209.131.36.158) 242.926 ms 241.478 ms 232.298 ms

------end------

Bandingkan kedua hasil di atas menunjukkan hop ke-12 * padahal jika gunakan option -I hasilnya normal. Untuk kasus ini menunjukkan karena adanya filter. Bisa saja kasus lain karena memang host yg dituju sedang down, sebab itu lakukan dua kali pengecekan dengan cara diatas.

Apakah arti/maksud tanda ! dari hasil traceroute ??
!H : host unreachable
!N : network unreachable
!P : protocol unreachable
Contoh lain :
(ttl=46!) : ttl yang dikirim dan terima tidak sama karena rutenya asymetric (pergi & pulang beda)