In today’s article, you’ll learn what it is, how to use it, online ping tools, and some practical examples. First of all, let’s see what ping is. Ping is a Terminal / Shell command utility used as a simple way to verify that a machine has internet access and can communicate with other computers or network devices. Some of the functions of the ping command are :
Test network connectivity: local network, internetTroubleshoot network interface cardTest DNS name resolution issues
Most operative systems like Windows, macOS, and Linux have Ping pre-installed, but we’ll head into the installation process through the article. Maybe, you’ve seen ping in normal conversations, for example, “I’ll ping you once I’m done with the work”. In common language, ping simply means a message sent from a computer to another.
Ping Usage
To check you have ping installed, fire up a terminal (macOS, Linux) or command prompt (Windows), and type “ping –help”. In most cases, you should see something like this. If you get a help section with a list of flags to use, you’re good to go. In some Linux distributions like Ubuntu, you may have trouble because ping isn’t installed by default. In Ubuntu, you can install ping with: Another way to test ping is installed in your system would be using which, that returns the path of any binary installed in your system: Now that you can use ping with no problem, it’s time to learn its basic usage. The ping command connects to any host available, whether in your local network or over the internet. That host can be another computer, server, router, or even a printer. Ping accepts one argument, which is the web or IP address you’re trying to connect to. For example, we’ll try to connect to geekflare.com. Remember the “$” sign means we’re using a bash shell; in Powershell (Windows), it would be “>”. You should only copy the command and not the dollar sign. After typing the above command, you should see something like the following: First, it indicates the domain name we’re trying to connect to and its IP address within parenthesis. Then, it sends packets of bytes of data (usually 64) to the desired destination. To stop the ping command, just press Ctrl + C. If you have a stable internet connection (which I’m sure you do since you’re reading this), you should get a message similar to the one below: This message shows the statistics of the pinging process you did to a domain name or IP address. As you can see, ping sent 3 packets of data, and it received all of them. That means both your internet connection and the hosting service that serves the IP address is working perfectly. That same process occurs when you visit a web page, you (your browser) send packets of data with a request, the DNS (domain name service) translate the domain name to a real IP address, and then the host transmits the content of the page back to us. Of course, we’re skipping a lot of things, but this is just an explanation about a simple network interaction. As a pro-tip, anytime you need a list of the available flags, you can call its manual page with man or the –help flag.
IPv6 vs. IPv4
The world is running out of IP addresses, and as a result, we’re starting to implement IPv6 (Internet Protocol version 6). Shortly explained, IPv4 is the core IP protocol that runs the web. It uses a 32-bit IP address, including a numeric-dot notation. For example, Google’s main IP address is 8.8.8.8. IPv4 has been here since 1981, and it’s the normal protocol we’re used to seeing. On the other hand, IPv6 is another IP protocol that solves the problem of getting out of address. If IPv4 has up to 4.3 billion combinations, IPv6 could have 340 trillion trillion trillion IP addresses. Here is an example of an IPv6 address: 2001:db8:3333:4444:5555:6666:7777:8888. In other words, we’ll be transitioning to IPv6 addresses in the next few years because every IOF (internet of things) device and upcoming websites will need new addresses. Ping already supports IPv6 addresses, and in some Linux distributions, you can find an exclusive command, ping6, for them. However, the best way to ping an IPv6 address is using the -6 flag. Here’s an example: If your network doesn’t support IPv6 yet, don’t worry. IPv6 adaption has been growing ginormously in recent years.
Online Ping Services
Ping only usage isn’t to determine if you’re able to reach a specific server, but also to get the latency (time that it takes ping to receive a response) of your request to a server. Online ping tools allow you to gather much more data about the ping processes like On the other hand, if you’re having a bad time with your connectivity or just want to test out your server latency from different locations worldwide, an online Ping tool is your best choice. Check out our free online ping tool, and perform pings from London, Mumbai, and Oregon. Using this tool, you’ll get important data like packet loss and the maximum and minimum time it takes to get a response from your server.
Command Examples
Let’s test and see some of the frequently used examples of this networking tool.
#1. Check Your Internet connection
This may seem obvious, but you can check you have access to the Internet by pinging (the action of using ping) a solid target host like google.com. If you don’t get any response, it’s likely your Internet connection isn’t working properly.
#2. Send a Determined Amount of Pings
One problem you may encounter if you’re using a Unix machine is that ping sends packets of data indefinitely. With the flag -c (count), you can specify the number of pings you want to make. For example, if you want to ping exactly three times, you would do. Note: This doesn’t occur in Windows where ping sends only 4 data packets You can use this flag to send only a ping request and display the IP address of the destination you’re trying to reach.
#3. Ping a Server Within an Interval
You can set an interval of seconds between sending each packet. The default interval is one second, but you can modify it with the -i flag.
#4. Ping localhost
You can ping any IPv4 address; hence, you’re able to ping your localhost using either the localhost label or the IP address 127.0.0.1. Ping won’t pass through a physical network interface but through a virtual loopback.
#5. Pinging a Broadcast
You can use the -b flag to send requests to a broadcast address. For example, you can ping all the devices in your local network with the following command.
#6. Send a Specific Packet Size
Depending on your needs, you can change the packet size of your ping using the -s flag with the number of bytes you want to send. Note that some requests may not work if you send a big size packet.
#7. Flood ping
The -f flag sends ping requests as fast as your computer and network can. Since the minimal ping interval allowed to the user is 200ms, you must run it as a superuser with the command sudo. As you can see, I used the count flag to stop sending requests once it hit 1000 times (notice how it only took 11 seconds). Note: Be extremely careful using “flood ping” since you could cause a DoS (denial of service) to the server you’re pinging. The only situation you should use this is to test your server in high-intensity environments.
IP or Domain Ping API
Geekflare Ping API is a handy tool that can help you track any IP or Domain’s performance from multiple locations. This can prove vital for keeping tabs on a range of servers to ensure an optimal end-user experience. And what’s more, you can easily do that with Geekflare’s API free tier that gifts 3000 API calls per month. For the pros, the premium plans add residential proxies, a greater request rate, and a higher number of API calls starting with only $5 a month.
Conclusion
A ping is a tool practically as old as the Internet itself. With it, you can determine whether you have an active internet connection or not and test if you’re able to reach web servers or other networking devices. Don’t forget to use our PING test tool, along with our entire toolbox, to test your site.