ping command

ping command

Ping is a command used to check network communication with the connection partner.

 By using this ping command, you can check not only whether it is reachable, but also the status corresponding to various errors. You can also easily measure network congestion by checking statistics.

 Ping first sends an ICMP type 8 echo request (Echo) to the destination. The destination terminal that receives this will return an ICMP type 0 Echo Reply.

*However, echo requests (Echo) may be blocked in the middle of the route or by the firewall on the PC, so there is no guarantee that a reply will be returned.

 The sender can confirm whether communication is possible by receiving this echo reply. In case of errors, the error message will tell you why the destination is unreachable.

Execute the ping command on Windows from the command prompt. The usage is as follows.

For Windows

[Usage]
ping [-t] [-a] [-n number of requests] [-l size] [-f] [-i TTL] [-v TOS] [-r number of hops] [-s number of hops] [[-j host list] | [-k host list]][-w timeout] [-R] [-S source address] [-4] [-6] target name

For example, an example of executing ping to "www.yahoo.co.jp" is shown below.

ping command options

optionexplanation
-tPings the specified host until interrupted.
Press Ctrl+Break to view statistics and continue.
Press Ctrl+C to stop.
-aResolve an address to a host name.
-n number of requestsThe number of echo requests to send.
-l sizeThe size of the send buffer.
-fSet the Don't Fragment flag in the packet (IPv4 only).
-v TOSTOS Type Of Service (IPv4 only).
-r hop countRecords routes with a specified number of hops (IPv4 only).
-s number of hopsShows the timestamp for the specified hop count (IPv4 only).
-j list of hostsUse the loose source root specified in the list. (IPv4 only).
-k list of hostsUse the strict source root specified in the list. (IPv4 only).
-w timeoutTimeout in milliseconds to wait for a response.
-RAlso test the reverse route using the routing header.
-S source addressSource address to use.
-FourForce use of IPv4.
-6Force use of IPv6.

An example of using the command with options would be:

C:\ping -n 10 192.168.1.254

By default, the number of echo requests sent is 4, but here we specify 10.

ping command (error message)

Here, we will explain the Destination Unreachable (Type 3) error.

 In IP communication, when some kind of problem occurs, routers and terminals along the route report the error to the source. For Destination Unreachable (Type3) errors, the following list of information is now reported.

Type 3 error list

codeinformationmeaning
0Network Unreachablenetwork unreachable
1Host UnreachableSpecific host unreachable
2Protocol Unreachableprotocol unreachable
3Port Unreachableport unreachable
FourFragmentation Needed and DF setneed fragmentation
FiveSource Route FailedIt cannot be routed according to the source route.
6Destination Network UnknownI don't know the destination network.
7Destination Host UnknownI don't know the destination host.
8Source Host IsolatedSender cannot communicate
9Network Administratively ProhibitedThe destination network is rejecting it.
TenDestination Host Administratively ProhibitedThe destination host is rejecting it.
11Network Unreachable For TOSNetwork unreachable with requested TOS
12Host Unreachable For TOSHost unreachable at requested TOS
13Communication Administratively ProhibitedCommunication is denied.

List of errors for Cisco routers

codeinformation
!Each exclamation point (!) indicates receipt of a response.
.A period (.) indicates that the network server timed out waiting for a response.
UDestination unreachable error received by PDU
Q.source quench (destination busy)
M.Not fragmentable
?Unknown packet type
&Packet Time to Live Exceeded

You can find the cause of the trouble from this error message.