Have you ever experienced internet-lag so severe you wanted to throw your computer through the nearby window? Before you do that, we're here to help you troubleshoot the situation so that you can identify it and fix it.
When a situation such as this one occurs it’s encouraged that you first conduct a ping test.
In this article, we'll teach you what is ping, how to run a ping test, and what ping is used for. You'll learn things like the difference between TCP and UDP, what ports are used for ping tests, and what a ping osi layer is.
If you don’t know what a ping test is then this tutorial will explain to you the basics of the universal network utility tool. Once you learn the basics of pinging you’ll no longer tangle with other nonsensical solutions and defer creating another Instagram stalker account.
What is a Ping Command?
In order to successfully answer the question "how does ping work?" one must know what pinging is. Well in a nutshell, the ping command is a network tool used to determine whether a certain IP address or host is accessible.
Once that is known you can use the results to draw further conclusions. Therefore, pinging is usually the first line of defense when troubleshooting internet connections. Not only does it test connectivity but it also measures time and maintains accountability of all Internet Control Message Protocol (ICMP) packets.
Very essential right? You bet, and the good news is is that it comes universal across operating systems. That’s why anybody who is anyone in the tech industry should know how to use this basic command.
How Do I Use the Ping Command?
It doesn’t matter if your system is running Windows, MacOSX, Linux or FreeBSD, you have the ping command at your disposal. However, this tutorial will revolve around the Windows version of the command. For other operating systems it’s suggested that you consult your operating system’s MAN PAGE (Manual Page) for ping command syntax.The first thing you want to do is open your system’s command by navigating to the “Start Menu” and entering into your “Accessories” folder. Here you will find the command prompt shortcut—click it. Once the console is visible you’ll want to enter parameters using the below format:Tip:
If you need a refresher on reading command syntax, I recommend this refresher course.
ping [-t] [-a] [-ncount] [-lsize] [-f] [-i TTL] [-v TOS] [-r count] [-scount] [-wtimeout] [-R] [-S srcaddr] [-4] [-6] target [/?]
These parameters all correlate to a useful command options. However, we’ll only focus on the basic command options in the table below:
OptionUse-nCountDetermines the number of echo requests to send. The default is 4 requests.-lSizeEnables you to adjust the size of the ping packet. The default size is 32 bytes.
How Do I Conduct a Ping Test?
In the following example I’m pinging the domain of the popular news network CNN. The -n flag tells the ping command to send 8 ICMP Echo Requests. If this flag is not set then the ping command sends 4 by default. The -l flag sets the size, in bytes of the echo command. In the above example I’m sending 1,000 byte (1 Kilobyte) echo request. You have an option between 32 to 65,527 bytes. However, if the -l flag is not set then by default a 32 byte echo request is sent. The last parameter of the command is the actual domain itself www.cnn.com. Now let’s analyze the results. In the example we see that we are pinging IP 184.108.40.206 (CNN’s IP Address) with 1,000 bytes. The time that it takes for the packet to reply is displayed in milliseconds. The first packet we sent took approximately 23 milliseconds. The second took 21 milliseconds.The third took 21 milliseconds and so forth. The next item in the results list is the Time To Live or TTL. The TTL tells the recipient how long to hold or utilize a packet or any other relevant data before it needs to be discarded or it expires. So in the above example our TTL is 52 seconds. Therefore, any packet sent from our network has around 52 seconds before it expires or dissipates into oblivion.
How Do I read Ping Statistics?
Under the results of your ping you have your ping statistics. These numbers are self explanatory. The number of packets sent are displayed along with the number received and also the numbers lost.In the video example we have a 0 percent loss. This means that there are no network connectivity issues with cnn.com. Therefore, it should be fine to connect to the site.
What Port Does Ping Use?
Remember that a ping test uses ICMP, so there are no real ports being used. ICMP basically roofs, or sits on top of, the IP address. Therefore it is not a layer four protocol.
That means that you don't have to worry about assigning ports to a ping test. This makes the test simple, fast, and effective. In other words—less random.
How Would A Ping Test Fail?
There are a number of reasons why a ping test would fail. For instance, if you’re pinging a specific IP address on your local network and you enter the wrong IP for the host computer the attempt would fail because there is nothing to connect to.
However, the problem could be that the network isn’t properly configured. An incorrect IP could be the result of an incorrect subnet mask.
Subnet masks determine the valid range of a IP address for a network. If conducting a local ping test both machines should have IP addresses that are included in the subnet range. Secondly, there could be firewall software blocking the ping requests. In this situation you’ll have to disable the firewall. However, when disabling such software please seek the guidance of an network or system administrator. Improper implementation of any network security system greatly jeopardizes information security and places your company at risk. Lastly, the failure could come from a hardware failure such as a bad Ethernet adapter, cable, router, hub, etc.
How Do I Troubleshoot With The Ping Command?
So now that you know how to conduct a proper ping test you can take the necessary actions to troubleshoot your network. You should now be able to use your newly acquired ping skills to check your connection to a well known site like Google, Amazon or CNN. From there you could make a better inference depending of where the problem lies.
If you can’t connect to any of those sites then it’s probably an internal problem. From there you’d want to ping your local network or even check cables. It’d be a shame to find out that it was your cat who unplugged the Ethernet cable. Maybe it was an accident? Or… maybe the cats are rebelling? Doesn’t matter though. They’ll never win.
So, either way, your first inclination should be to ping.