What is Ping And Why Do We Use Ping command:
Ping is a network command used for testing network connections, most of the ping tools (ping utility) use Internet Control Message Protocol (ICMP). In computer networks ping help in diagnosing and resolving network issues.
Ping command is a basic and simple way to determine if a computer, server, router or any other network device can communicate with other devices on a network. For verifying that any given computers are connected through a network, we ping them.
The Basic functionality of Ping is to send periodic request signals to a target address and measure the time it takes to receive the response from target address. Ping command supports the following options.
|If you want to resolve the hostname of a target IP address , use (-a) ping command option. if possible it will resolve the hostname of a specified IP address.
|-f ping cmd option is used if you want to prevent routers from the fragmentation of ICMP Echo Requests between source and the target. For troubleshooting of Path Maximum Transmission Unit (PMTU) issues -f option is used.
|By Default ping command sends 4 echo request. If you want to change the number of ICMP Echo Requests when pinging, this option will be used. You can set the number of ICMP echo requests from 1 to 4294967295.
|The Default size of an ICMP echo request packet is 32 bytes, if you want to change echo request byte size, this option(-l) is used to set the size, in bytes, of the echo request packet from 32 to 65,527.
|If you want to change the life span of (TTL), Use this option (-i) to set the Time to Live (TTL) value, the maximum of which is 255.
|This option used to set a Type of Service (TOS) value. It was working in windows 7 but not working in new version of windows but still exists for compatibility reasons.
|-r ping command option is used if you want to display the number of hops between your computer system and the target device .This ping cmd option will display 9 hops at maximum, if you want all the hops to be counted and displayed then use tracert command.
|If you want the internet time stamp to be displayed with each echo request, Use -s option with ping command, this will display time with each echo request sent and received.
|Specifying a timeout value when executing the ping command adjusts the amount of time, in milliseconds, that ping waits for each reply. If you don’t use the -w option, the default timeout value of 4000 is used, which is 4 seconds.
|This option tells the ping command to trace the round trip path.
|Use this option to specify the source address.
|Use this switch to ping a Hyper-V Network Virtualization provider address.
|This forces the ping command to use IPv4 only but is only necessary if target is a hostname and not an IP address.
|This forces the ping command to use IPv6 only but as with the -4option, is only necessary when pinging a hostname.
|Use the help switch with the ping command to show detailed help about the command’s several options.
|This is the destination you wish to ping, either an IP address or a hostname.
How To use Ping Command:
Ping utility is shipped with almost every new operating system, for using ping utility click on the start button and type cmd, and click on command prompt. Now you are ready to ping anything.
Ping Command Syntax:
Ping command consists of two parts 1.ping and 2.Target address. Target address should be replaced with server ip address, website, network connected device or a router interface. ping targetAddress .
How to Ping a Computer System on LAN:
If you want to be sure that a computer system is properly connected to a network, For example we want to check a system with IP Address 192.168.1.12 can be reached or not.
Open command prompt and type ping 192.168.1.12 . If you get a destination host unreachable message with all the packets, it means that destination MAC address has timed out of the source/router’s ARP cache, and the source/router no longer has, or can get, a MAC address for the destination.
How to Ping a Website:
You can ping any website on the internet successfully as long as you are connected to the internet. Can we ping google? yes we can. In command prompt and type ping google.com
Ping Android Phone on LAN from PC:
First find the ip address of your android phone you want to ping, if you have access to your router, you can locate your ip address in the DHCP list OR go to the settings of your android phone and select About Device from the setting page, scroll down and you will find IP Address note it.
Open command prompt and type ping 192.168.1.5 .lets say your phone IP Address is 192.168.1.5 . If you have no problems with in your LAN all the ping requests will be replied successfully from the phone.
If you get “destination host unreachable” message plus Packets Sent = 4 Received = 4, lost = 0 (0%) , don’t worry your LAN connection between your Android Phone and PC is fine but the router has some features on which does not let you see other devices connected to the LAN.
If you are unable to ping a device or android phone on LAN and if you are getting destination host unreachable message response from ping command you should read: