Ping

Un article de Backtrack-fr.

[modifier] Introduction

Ping est un utilitaire réseau qui fonctionne avec le protocole ICMP.

Il envoie une requête ICMP de type 8 (echo request) à l'adresse IP ou l'host lui étant spécifié. Si la machine est présente, elle répondra par une requête ICMP de type 0 (echo reply). Dans le cas contraire, un message d'erreur s'affichera "Destination Host Unreachable" (Host inaccessible).

On l'utilise le plus souvent pour vérifier la présence d'une machine sur le réseau.

[modifier] Usage & Options

 ping [-LRUbdfnqrvVaA] [-c count] [-i interval] [-w deadline]
   [-p pattern] [-s packetsize] [-t ttl] [-I interface or address]
   [-M mtu discovery hint] [-S sndbuf]
   [ -T timestamp option ] [ -Q tos ] [hop1 ...] destination

[modifier] Exemples

 bt ~ # ping -c 2 -i 0.5 -s 512 -t 64 192.168.0.254
 PING 192.168.0.254 (192.168.0.254) 512(540) bytes of data.
 520 bytes from 192.168.0.254: icmp_seq=1 ttl=64 time=0.916 ms
 520 bytes from 192.168.0.254: icmp_seq=2 ttl=64 time=0.889 ms
 
 --- 192.168.0.254 ping statistics ---
 2 packets transmitted, 2 received, 0% packet loss, time 500ms
 rtt min/avg/max/mdev = 0.889/0.902/0.916/0.032 ms
 bt ~ # ping -c 4 -i 1 -s 256 -t 128 www.google.com
 PING www.l.google.com (64.233.183.104) 256(284) bytes of data.
 64 bytes from nf-in-f104.google.com (64.233.183.104): icmp_seq=1 ttl=242 (truncated)
 64 bytes from nf-in-f104.google.com (64.233.183.104): icmp_seq=2 ttl=242 (truncated)
 64 bytes from nf-in-f104.google.com (64.233.183.104): icmp_seq=3 ttl=242 (truncated)
 64 bytes from nf-in-f104.google.com (64.233.183.104): icmp_seq=4 ttl=242 (truncated)
 
 --- www.l.google.com ping statistics ---
 4 packets transmitted, 4 received, 0% packet loss, time 3001ms
 rtt min/avg/max/mdev = 73.779/73.903/74.036/0.298 ms
 bt ~ # ping -c 1 -i 0.5 -s 128 -t 64 192.168.0.13
 PING 192.168.0.13 (192.168.0.13) 128(156) bytes of data.
 From 192.168.0.1 icmp_seq=1 Destination Host Unreachable
 
 --- 192.168.0.13 ping statistics ---
 1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms