Network connections over the internet are all about give and take. When a client device connects to a server, it sends a data packet containing information. The server then reads this information and fulfils any requests by returning a corresponding data packet.

This could involve a user requesting an inbox refresh from a Post Office Protocol 3 (POP3) server. When your email client requests an update, the server receives a data packet instructing it to upload any stored emails from its database to your device. Your device will then start accepting these data packets and downloading any pending emails from your mailbox. This is an example of taking.

On the flip side, giving is achieved via the Simple Mail Transfer Protocol (SMTP). Your device will upload data packets containing the email and its contents to the mail server. The server will then download these data packets and store your email in its database (visible to you in the Sent folder). SMTP also causes the server to upload this new copy of your email to the recipient's email server, which then repeats the storage process before forwarding it to the recipient device.

Now, what if you cannot connect to your email server – or any other type of system, for that matter?

Introducing ping

When you experience internet connection problems, it means that the data packets are getting stuck along their journey across the internet. You could keep attempting to send data from your email client, but this doesn’t provide diagnostic information which you can use to troubleshoot the connection.

This is where the ping command comes in. The ping utility is a Command Prompt tool that can be used to diagnose common connection problems. The name stands for Packet InterNet Grouper (p-in-g) and was first introduced back in 1983.

The ping tool uses a particular type of data packet within the Internet Control Message Protocol (ICMP) networking protocol. When using ping, an echo-request packet is sent to the destination device or server. This requests that if the packet reaches the destination, the destination device returns an echo reply packet.

If you have ever seen a visual depiction of radar or sonar waves, the ping tool functions in a very similar way. The signal is emitted from the originating device, and when the signal reaches the destination, it bounces back ready for the originating device to detect the returning signal.

Opening the ping tool on Windows

Please note that this guide was created using Windows 10 v2004

To use the ping tool, first, you need to open Command Prompt.

Press the Windows Key + R on your keyboard to open a run window. Then type cmd, and press Enter. A Command Prompt window will open.

Next type ping into this window. You should see the following appear:

Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS]
[-r count] [-s count] [[-j host-list] | [-k host-list]]
[-w timeout] [-R] [-S srcaddr] [-c compartment] [-p]
[-4] [-6] target_name

Options:
-t Ping the specified host until stopped.
To see statistics and continue - type Control-Break;
To stop - type Control-C.
-a Resolve addresses to hostnames.
-n count Number of echo requests to send.
-l size Send buffer size.
-f Set Don't Fragment flag in packet (IPv4-only).
-i TTL Time To Live.
-v TOS Type Of Service (IPv4-only. This setting has been deprecated and has no effect on the type of service field in the IP Header).
-r count Record route for count hops (IPv4-only).
-s count Timestamp for count hops (IPv4-only).
-j host-list Loose source route along host-list (IPv4-only).
-k host-list Strict source route along host-list (IPv4-only).
-w timeout Timeout in milliseconds to wait for each reply.
-R Use routing header to test reverse route also (IPv6-only).
Per RFC 5095 the use of this routing header has been deprecated. Some systems may drop echo requests if this header is used.
-S srcaddr Source address to use.
-c compartment Routing compartment identifier.
-p Ping a Hyper-V Network Virtualization provider address.
-4 Force using IPv4.
-6 Force using IPv6.

This is a full list containing Usage examples and Options for the ping command. We will cover only the most commonly used Options in this article, but you can test these commands yourself by referencing this section of the article.

Using ping

For your first command, try typing the following into your Command Prompt window:

ping www.fasthosts.co.uk

You should see something similar to the following appear:

Pinging www.google.co.uk [216.58.212.227] with 32 bytes of data:
Reply from 216.58.212.227: bytes=32 time=2ms TTL=126
Reply from 216.58.212.227: bytes=32 time=2ms TTL=126
Reply from 216.58.212.227: bytes=32 time=2ms TTL=126
Reply from 216.58.212.227: bytes=32 time=2ms TTL=126
Ping statistics for 216.58.212.227:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 2ms, Maximum = 2ms, Average = 2ms

Let us dissect this result.

Every ping echo request was successfully responded to, as there was 0% packet loss.

Our average ping latency (time to send and receive back a data packet) was 1ms. This metric is essential for latency-dependent tasks like gaming, using a virtual desktop over the internet, and Voice-over-Internet-Protocol (VoIP).

When we pinged www.google.co.uk, we can see that the actual server IP address was 216.58.212.227. If you copy this IP address into your browser, the Google website will load.

TTL stands for time to live. Each hop between a Layer 3 (L3) reduces the TTL by 1.

Advanced ping commands

To loop the ping command, you type the following into Command Prompt:

ping -t www.google.co.uk

To stop this continuous ping session, you would press Ctrl+C on the keyboard.

To specify a set number of echo requests to send, type the following into Command Prompt:

ping -n 5 www.google.co.uk

This will send 5 echo requests before terminating the ping session.

Get started online with Fasthosts

Fasthosts is an industry-leading UK hosting services provider, offering a range of hosting services to fit your business needs. Our dedicated CloudNX Cloud Servers range offers customisable, cutting-edge technologies for optimal price-to-performance when hosting in the cloud.

Find out more about our cloud options by calling our sales team on 0808 1686 777, or email us at sales@fasthosts.co.uk to take your first steps towards a cloud-native future.