Senin, 04 Maret 2013

Ping Command Line On Linux


ini adalah perintah - perintah dasar yang ada di dalam platform Linux... sekedar informasi untuk menjelaskan command line....cekkidoooot...!




1. Menambah dan mengurangi interval waktu paket yang dikirim

Secara default ping akan memberi kita jeda waktu 1 detik, saat mengirim paket ke suatu host, seperti contoh berikut
numb@numb-ubuntu-10:~$ ping google.com
PING google.com (64.233.181.104) 56(84) bytes of data.
64 bytes from ni-in-f104.1e100.net (64.233.181.104): icmp_seq=1 ttl=53 time=67.8 ms
64 bytes from ni-in-f104.1e100.net (64.233.181.104): icmp_seq=2 ttl=53 time=78.5 ms
64 bytes from ni-in-f104.1e100.net (64.233.181.104): icmp_seq=3 ttl=53 time=75.5 ms
64 bytes from ni-in-f104.1e100.net (64.233.181.104): icmp_seq=4 ttl=53 time=74.3 ms
64 bytes from ni-in-f104.1e100.net (64.233.181.104): icmp_seq=5 ttl=53 time=91.6 ms
64 bytes from ni-in-f104.1e100.net (64.233.181.104): icmp_seq=6 ttl=53 time=69.9 ms
^C
--- google.com ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5007ms
rtt min/avg/max/mdev = 67.831/76.323/91.658/7.730 ms
Untuk menambah waktu interval bisa digunakan opsi -i seperti contoh berikut
numb@numb-ubuntu-10:~$ ping -i 5 google.com
PING google.com (64.233.181.104) 56(84) bytes of data.
64 bytes from ni-in-f104.1e100.net (64.233.181.104): icmp_seq=1 ttl=53 time=66.8 ms
64 bytes from ni-in-f104.1e100.net (64.233.181.104): icmp_seq=2 ttl=53 time=78.2 ms
64 bytes from ni-in-f104.1e100.net (64.233.181.104): icmp_seq=3 ttl=53 time=63.1 ms
64 bytes from ni-in-f104.1e100.net (64.233.181.104): icmp_seq=4 ttl=53 time=68.0 ms
^C
--- google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 15007ms
rtt min/avg/max/mdev = 63.140/69.081/78.237/5.595 ms
Pada contoh diatas waktu interval ditambah selama 5 detik untuk pengiriman paket berikutnya, sedangkan pada contoh berikutnya akan saya tunjukkan bagaimana menggunakan perintah ping dengan interval waktu pengiriman paket dibawah 1 detik, dibutuhkan hak akses root jika kita ingin mengurangi waktu interval dibawah 0.2 detik
numb@numb-ubuntu-10:~$ ping -i 0.1 google.com
PING google.com (64.233.181.104) 56(84) bytes of data.
ping: cannot flood; minimal interval, allowed for user, is 200ms
numb@numb-ubuntu-10:~$ sudo -i
[sudo] password for numb:
root@numb-ubuntu-10:~# ping -i 0.1 google.com
PING google.com (64.233.181.104) 56(84) bytes of data.
64 bytes from ni-in-f104.1e100.net (64.233.181.104): icmp_seq=1 ttl=53 time=504 ms
64 bytes from ni-in-f104.1e100.net (64.233.181.104): icmp_seq=2 ttl=53 time=461 ms
64 bytes from ni-in-f104.1e100.net (64.233.181.104): icmp_seq=3 ttl=53 time=555 ms
^C64 bytes from ni-in-f104.1e100.net (64.233.181.104): icmp_seq=4 ttl=53 time=612 ms
64 bytes from ni-in-f104.1e100.net (64.233.181.104): icmp_seq=5 ttl=53 time=561 ms
--- google.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 418ms
rtt min/avg/max/mdev = 461.609/539.353/612.887/51.851 ms, pipe 5
 
 
2. Ping localhost

Untuk melakukan ping ke localhost, cara tercepatnya adalah dengan mengetikkan angka 0 (nol) setelah ping, contoh
root@numb-ubuntu-10:~# ping 0
PING 0 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.045 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.053 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.054 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.058 ms
64 bytes from 127.0.0.1: icmp_seq=5 ttl=64 time=0.040 ms
64 bytes from 127.0.0.1: icmp_seq=6 ttl=64 time=0.048 ms
^C
--- 0 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 4998ms
rtt min/avg/max/mdev = 0.040/0.049/0.058/0.010 ms
atau bisa dengan mengetikkan localhost setelah ping
root@numb-ubuntu-10:~# ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.053 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.044 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.046 ms
^C
--- localhost ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.044/0.047/0.053/0.008 ms
root@numb-ubuntu-10:~#
atau bisa juga dengan mengetikkan ip localhost setelah ping
root@numb-ubuntu-10:~# ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.060 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.042 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.044 ms
^C
--- 127.0.0.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 0.042/0.048/0.060/0.011 ms
 
 
3. Mengirimkan paket sebanyak n kemudian otomatis berhenti

Saat kita menggunakan command ping, proses akan berhenti jika kita menekan tombol Ctrl+C jika anda ingin proses berhenti secara otomatis setelahn kali pengiriman paket ke suatu host gunakan perintah -c. Contoh
numb@numb-ubuntu-10:~$ ping -c 5 google.com
PING google.com (64.233.181.104) 56(84) bytes of data.
64 bytes from ni-in-f104.1e100.net (64.233.181.104): icmp_seq=1 ttl=53 time=71.2 ms
64 bytes from ni-in-f104.1e100.net (64.233.181.104): icmp_seq=2 ttl=53 time=69.4 ms
64 bytes from ni-in-f104.1e100.net (64.233.181.104): icmp_seq=3 ttl=53 time=61.9 ms
64 bytes from ni-in-f104.1e100.net (64.233.181.104): icmp_seq=4 ttl=53 time=72.8 ms
64 bytes from ni-in-f104.1e100.net (64.233.181.104): icmp_seq=5 ttl=53 time=91.1 ms
--- google.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4000ms
rtt min/avg/max/mdev = 61.939/73.313/91.139/9.663 ms
Pada contoh diatas, proses akan berhenti setelah mengirimkan paket sebanyak 5 kali


4. Melihat versi ping

Opsi -V akan menunjukkan versi ping yang kita gunakan
numb@numb-ubuntu-10:~$ ping -V
ping utility, iputils-sss20071127
 
 
5. Flooding dengan ping

Jika kita mempunyai hak akses Super User, kita bisa menggunakan command ping untuk melakukan flooding terhadap suatu host dengan menggunakan opsi -f, contoh
root@numb-ubuntu-10:/home/numb# ping -f localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
^C
--- localhost ping statistics ---
8754 packets transmitted, 8754 received, 0% packet loss, time 386ms
rtt min/avg/max/mdev = 0.008/0.009/0.269/0.006 ms, ipg/ewma 0.044/0.009 ms
 
 
6.Print statistics dari proses ping saja

Jika mata anda lelah atau capek melihat proses ping yang sedang berjalan, anda bisa menggunakan opsi -q untuk melihat statistik yang dihasilkan, contoh
root@numb-ubuntu-10:/home/numb# ping -c 5 -q google.com
PING google.com (64.233.181.104) 56(84) bytes of data.
--- google.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4001ms
rtt min/avg/max/mdev = 68.885/81.160/98.517/11.260 ms
 
 
7. Menambah besarnya paket yang dikirimkan

Secara default besar paket yang digunakan pada command ping adalah 56, jika anda ingin menambah besar paket yang dikirmkan cukup gunakan opsi -s, contoh
root@numb-ubuntu-10:/home/numb# ping -s 100 google.com
PING google.com (64.233.181.104) 100(128) bytes of data.
72 bytes from ni-in-f104.1e100.net (64.233.181.104): icmp_seq=1 ttl=53 (truncated)
72 bytes from ni-in-f104.1e100.net (64.233.181.104): icmp_seq=2 ttl=53 (truncated)
72 bytes from ni-in-f104.1e100.net (64.233.181.104): icmp_seq=3 ttl=53 (truncated)
^C
--- google.com ping statistics ---
4 packets transmitted, 3 received, 25% packet loss, time 3672ms
rtt min/avg/max/mdev = 582.297/635.877/716.901/58.281 ms
 
 
 
Semoga bermanfaat yaa,,,  

0 komentar:

Posting Komentar