Search

Ping command tool

Ping command (also called as Packet InterNet Groper) is a command line tool available in Cisco devices, Microsoft Windows, Unix and different flavors of GNU/Linux. Ping command tool is inbuilt and available out of the box in all Cisco/Windows/Unix/Linux Operating Systems. Ping command is one of the most used commandline tool for network troubleshooting. Ping command is used to test layer 3 network connectivity between two TCP/IP hosts. Ping command send a packet to the destination that we want to check is reachable, and if a reply is received back, we can make sure the destination is up, running and reachable.

I strongly recommend you to visit following lessons before reading further.

How ping works

Ping command uses ICMP for checking the layer 3 network connectivity (in other words, checking network connectivity using IP addresses) between two TCP/IP devices. ICMP is an integral protocol of TCP/IP protocol stack. ICMP Echo request and Echo reply messages are used for testing layer 3 network connectivity between two computers.

The basic function of ping command tool is simple. Let us imagine that you want to test the layer 3 network connectivity to a remote computer, or you want to check whether a remote computer is up and running. You run ping commandline tool on your computer with the IPv4 address (layer 3 address) of the remote computer as the ping command parameter.

test-network-connectivity-ping.jpg

When you run the command, ping command generates and send one or more ICMP Echo request type of messages to the remote computer. When a TCP/IP computer receives an ICMP Echo request type of messages, it is obliged to reply with an ICMP Echo reply message back to the first computer.

ping-request.gif

If the remote computer is up and running and if that computer got the An ICMP Echo request type of message sent from the first computer, it will reply with an ICMP Echo reply type of message. If the first computer had received the ICMP Echo reply message from the remote computer, we can then make sure that there is no network connectivity issue and the remote computer is up and running.

ping-reply.gif

An example of using ping command

Okay, let us see an example of using ping command. Open the command prompt program in your Windows computer by typing cmd in search box, and then by clicking the command prompt from search result.

open-cmd-for-ping.jpg

Type ping with the IPv4 address of the remote computer and hit Enter key. In this example, I had entered the IPv4 address 1.1.1.1 as the parameter of ping command. 1.1.1.1 is the IPv4 address of a free DNS (Domain Name System) server owned by Cloudflare. I need to check whether I have connectivity to DNS server 1.1.1.1.

You may also use ping command with a domain name. The ping command then resolve the domain name into an IPv4 address and starts sending ICMP Echo request type of message to the destination IPv4 address.

ping-command-reachable-output.jpg

Ping command output shows it had sent 4 ICMP Echo request type of messages from my computer to the remote computer and got ICMP Echo reply messages for all those four ICMP Echo request messages. Packet loss is 0%.

If there is a network connectivity issue and the remote computer is unreachable, you will get the ping command output similar to below screenshot.

ping-command-unreachable-output.jpg

Related Tutorials
Introduction to TCP/IP, Features of TCP/IP, TCP/IP History, What is RFC (Request for Comments)
Seven Layers of OSI Model and functions of seven layers of OSI model
Five layered TCP/IP model
Network Layer (Layer 3)
TCP/IP Data Encapsulation and Decapsulation
Datalink Layer (Layer 2)
Ethernet Frame Format
What is MAC address or Layer 2 address or physical address
IPv4 Protocol, IPv4 header and fields of IPv4 header
IPv4 addresses, IPv4 Address Classes, IPv4 Address Classifications
What is Subnet Mask
What is network address
Limited broadcast address
Directed broadcast address
What is limited broadcast in IPv4 and how limited broadcast works
What is directed broadcast in IPv4 and how directed broadcast works
What is default gateway
What are private IP addresses - RFC 1918 private addresses
APIPA Addresses (Automatic Private IP Addresses)
What is loopback address in IPv4
What is localhost
Class A networks and Class A IP addresses
Class B networks and Class B IP addresses
Class C networks and Class C IP addresses
Class D multicast IP addresses
Subnetting - Part 1
Subnetting - Part 2
Subnetting - Part 3
Subnetting - Part 4
Subnetting - Part 5
Subnetting - Part 6
Variable Length Subnet Masking, VLSM, IP V4 Subnetting, subnetting tutorials, IP study guides, IP documentation, IP tutorials
Supernetting, IP Supernetting, IP Supernetting tutorial, How to Supernet, Supernetting Guide, Supernetting Concepts
How to find out the Network Address and Broadcast Address of a subnetted IPv4 address
Address Resolution Protocol Tutorial, How ARP work, ARP Message Format
Internet Control Message Protocol, ICMP, How ICMP Work, ICMP Header, ICMP Message Header
ICMP message types
ICMP Echo Request and Echo Reply messages
ICMP Destination Unreachable messages
ICMP Source Quench messages
ICMP Router Advertisement messages
ICMP Router Solicitation messages
ICMP Time Exceeded messages
ICMP Parameter Problem messages
ICMP Timestamp Request and Timestamp Reply messages
ICMP Photuris messages
Ping command options
How to show remote computer name in ping command output
How to ping continuously
How to specify the number of packets sent in ping command
How to specify the size of data to send in ping command
What is Ping of death (PoD) network attack
Traceroute/tracert command tool
Tracert command options
Pathping command tool
Pathping command options
Difference between ping, traceroute/tracert and pathping