What is Ping? | How to Ping on Windows 11, Linux, and macOS

Ping (Packet InterNet Groper) is a tool used to verify that a network data packet was successfully delivered to its destination. You can also use it to check the network connectivity of a computer on a network or any device connected to the network.

Ping Definition and How to Throw It

What is Ping, and What Does It Do?

Ping is an abbreviation of “Packet InterNet Groper.” In short, we use it to test network problems. You can ping a device connected to the network to test its connection. For example, you can check the network connection by pinging a computer on the LAN network or the WAN side.

Mike Muss developed the Ping protocol in 1983. This protocol sends 32-byte packets to the target and checks the connection. If you ping a nearby server, the response time will be low. However, if you ping a distant server, the response time will be higher.

The Ping protocol uses the Internet Control Message Protocol (ICMP). It transmits an Echo Request packet to the target and waits for an Echo Reply packet. If the client receives an Echo Reply, the connection is successful. As a result, the ping operation verifies the network connection.

What is ICMP?

ICMP (Internet Control Message Protocol) is a sub-protocol for error reporting and IP control. Therefore, it sends error messages indicating that a service is not available or a router cannot be found.

ICMP is different from the TCP layer and the UDP structure because it is not usually used directly by network users. However, Ping and Traceroute tools test the availability of a host using ICMP. They also determine the time it takes for packets to reach that host and the number of hosts it passes through. As a result, ICMP plays a critical role in identifying network errors.

How Does It Work?

ICMP is part of the IP protocol suite and is defined in RFC 792. ICMP messages work in response to errors in IP datagrams. We also use it for diagnostic and routing purposes.

The ICMP version for IPv4 is ICMPv4. However, there is an equivalent protocol for IPv6, ICMPv6. ICMP messages operate at the network layer level. So, IP encapsulates the appropriate message with a new IP header and transmits the datagram.

For example, every Router that transmits an IP datagram decrements the TTL field by one. If the TTL reaches 0, it sends an ICMP “Time to Live Exceeded” message. However, ICMP messages are encapsulated in a single IP datagram and are not guaranteed to be delivered.

ICMP messages are included in IP datagrams and act as a particular case of normal IP operations. ICMP checks whether a packet can reach its destination when it reaches its lifetime. It also detects network errors and prevents or corrects related problems.

Most network utilities rely on ICMP. The traceroute command uses UDP datagrams with particular TTL IP fields. The ping tool uses “Echo request” and “Echo reply” messages. In conclusion, ICMP does a serious job of keeping networks running smoothly.

Protocol Format

List of allowed control messages:

CodeMessage Type
0Echo Reply
1Reserved
2Reserved
3Destination Unreachable
4Source Quench
5Redirect Message
6Alternate Host Address
7Reserved
8Echo Request
9Router Announcement
10Router Request
11Time Out
12Parameter Problem
13Timestamp
14Timestamp Response
15Request for Information
16Information Response
17Request for Address Mask
18Address Mask Response
19Reserved for security
20-29Reserved for robustness experiments
30Traceroute
31Datagram Conversion Error
32Mobile Host Redirection
33IPv6
34IPv6
35Mobile Registration Request
36Mobile Registration Response
37Domain Name Request
38Domain Name Response
39SKIP Discovery Algorithm Protocol
40Photuris, Security Bugs
41-255Reserved

For a complete list of ICMP parameters, see the list published by IANA.

How to Use Ping?

You can use Ping using the Command Prompt on Windows XP, 7, 8, 8.1, 10, and Windows 11. Follow the steps below to use this simple network tool.

Steps:

Step 1

First, open the Run tool by holding down the Windows-looking key on your main computer and pressing the R key.

Windows Run Tool

Step 2

In the Run window, you will see the section that says Open. Here, type “cmd” in the text box and then click OK.

Run Command Prompt

Step 3

When you start the CMD (Command Prompt) tool, you will see a screen like the one below on your system.

CMD Console

Step 4

To ping your ADSL modem’s IP address, type ping 192.168.1.1 in the CMD and press Enter. However, your default gateway IP address here may be different.

If the test is successful, as in the image below, it means you have a connection to your ADSL modem on your network.

The output ( 0% loss ) indicates that the packets are being transmitted without any problems. The part that says Bytes=32 indicates that Ping sends 32-byte packets by default.

Pinging the Address 192.168.1.1

Step 5

What is Destination Host Unreachable?

When you ping a client that is down on the network, you will receive a Destination Host Unreachable message. The main reasons for the Unreachable message are:

  1. When the target machine is down, you get the error Target Machine Unreachable.
  2. When there is an error in the target machine’s TCP/IP configuration, you get this error.
  3. When it finds the target network but cannot find the target client, you get this error.

Target Machine Unreachable Error

Step 6

What is Request Timed Out?

If you ping a client that is not on the same network, you will get a Request Time Out error.

For example, let’s say you are successfully pinging all clients on the 192.168.1.0/24 network. But you are unable to ping a client on the 192.168.2.0/24 network, and you get this error. At this point, you are definitely not able to reach your target.

The main reasons for the Request Time Out error are:

  1. When the target is down, you will get the Request Timed Out error.
  2. If the target client is known but you still cannot ping it, you will also get this error due to a Routing protocol error on the wireless Router.
  3. If there is a firewall installed on the target, you will also get this message because it blocks ICMP packets.

Request Timed Out

Step 7

How to Ping a Website?

It is straightforward to ping a website. The purpose of testing the website’s connection is to check whether it is online or not. Similarly, open the CMD prompt, and after selecting a website that you want to ping, type the following command and press Enter.

When you examine the image below, you can see that the website can be accessed successfully.

Pinging the Website

How to Ping on Linux?

Pinging is also relatively easy on Linux-based operating systems such as Ubuntu, Fedora, Linux Mint, Debian, and Kali Linux. The process you use on Windows systems is the same.

To ping on Linux/Ubuntu, open Terminal by pressing Ctrl + Alt + T keys together. Apply the following command in Terminal.

As you can see in the image below, the connection test will be continuous on Ubuntu.

Using Ping in Linux

Also, to ping a website on Linux, type the name of that website.

Using Ping in Ubuntu

Another example is specifying the number of packets. You can specify the number of packets to be sent to the destination by adding [ -c number ] to the command.

Adjusting the Number of Packages

How to Ping on macOS?

There are two different methods to ping on all macOS systems running on a MacBook or an iMac. The first method is to use Terminal on macOS. The second method is to use the Network Utility tool of macOS.

To ping via Terminal on macOS, first open Terminal. Press the Windows Key + Spacebar together to open the Terminal. Type terminal in the search box, find the program, and run it.

How to Run Terminal on macOS

Once you open Terminal, you can ping the IP address continuously using the ping 192.168.1.1 command.

How to Use Ping on macOS

You can add the [ -c + number ] command to ping an IP address or website as many times as you specify.

Ping -c 192.168.1.1

You can also test the connection to an IP address or website using the Network Utility program on macOS. Type network utility in the search box and find and open the program.

macOS Network Utility

Click on the Ping tab, and after filling in the required fields as in the image below, you can use the Ping command with the Network Utility.

Using macOS Network Utility

Ping Usage Video Tutorial

Windows Video 1

Linux Video 2

macOS Video 3

Frequently Asked Questions (FAQ)

  1. What does ping mean, and how does it work?
Ping is a tool that helps us test the reachability of PCs on IP networks. This tool sends ICMP Echo Request packets to the source. Then, this process involves waiting for a response.
Let’s say you run the “ping www.example.com” command. In this case, your PC sends an ICMP Echo Request to the target server. If you can reach the server, you’ll see an ICMP Echo Reply. The time this takes is known as the round-trip time (RTT). Furthermore, the results show whether the server is alive or not.
  1. Why do we ping?
The main reason we ping is to network. We use it to find and fix problems and check performance in this area. Simply put, if we get a ping reply, we know the server can be reached. We can also quickly check the connection between our devices. This helps a lot when we add new hardware to our network.
On the other hand, firewalls can block some traffic. So, we use ping to check for such blocking. Another example is DNS issues. We check if the domain name is resolved correctly. However, if we cannot get a ping response when the IP is resolved, we assume that the problem is with the server.
  1. What does a ping test show?
The ping test gives us several other important details. Clearly, we use this tool to check how good the network connection is. We also look at the response time, packet loss, and round-trip time (RTT).
The ping tool shows us the return time in ms (milliseconds). Packet loss is the rate of packets sent but not received. Ideally, this rate should be 0%. Otherwise, there is a problem with the network. RTT is the time it takes for a packet to travel to its destination and back.
  1. Why is ping important?
The network testing tool is essential for us when fixing problems. Therefore, it helps us measure the delay and check if the host PC is working. Network administrators also use this tool to watch the performance. In short, we can see how fast data moves between devices. Thus, this helps us avoid possible slowdowns.
  1. What can affect ping results?
I can say that several things affect the test results. These are network traffic, distance, routing, hardware limits, and firewall settings.
If you have heavy traffic in your environment, your delay will be high. This can sometimes lead to packet loss. Of course, the distance between your devices is also essential. If you have a PC or router that is far away, your ping time will be longer.
Also, the path that packets take affects the delay. Different routers and switches can cause this. Old devices can also make ping times longer. Sometimes, this also includes your firewall’s ICMP packet settings.

Conclusion

In conclusion, Ping and ICMP are vital in maintaining network connectivity. We also often use them to diagnose network problems. For example, network administrators can verify that devices are reachable with Ping. However, they can also troubleshoot connectivity issues at the relevant location.

In short, understanding ICMP messages and codes is essential for interpreting network errors. In addition, you should know and use them to ensure smooth network operations. Knowing how to use Ping and how to analyze the results gives network professionals an advantage. As a result, you can effectively manage and optimize your network infrastructure.

Add a Comment

Your email address will not be published. Required fields are marked *