Ping (How it works and why it is useful for diagnosing network problems):
How to ping:
If you have
ever had problems with your connection, the safest thing is that, either on
your own initiative or at the suggestion of technical service, you have
resorted to a network utility known as Ping, implemented by default in the vast
majority of operating systems. The purpose of ping is to determine if a
destination host, identified with a specific IP, is accessible from another
host.
To do this, the
source host sends a 32-byte information packet to the destination host using
the ICMP protocol and awaits a reply from it, which must contain the same data.
If the answer arrives correctly, the ping has been satisfactory. If on the
contrary, the ping fails, then it is that either the request of the source host
or the response of the destination host has been lost along the way. But how
can we use this command from our computer? How can we use it to determine what
the problem of our connection might be?
Photo by
Markus Spiske temporausch.com
from
Pexels
|
To ping another
host from a computer with Windows operating system, it is as simple as
following these steps:
1. Open the
command console: To do this, go to Start >> Run and type cmd. In more
recent versions, just go to Start and type in Search programs and files. Next,
press enter.
2. Write “ping
hostname or IP address”: Now a window with a black background will appear. In it we will
write, for example, ping www.google.com.
If everything
went well, something similar to the following will appear in our command
window:
What do these
lines mean? Well, the ping confirms that it has sent four packets of size 32
bytes to the server that we have selected, in this case www.google.com, and that
server corresponds to IP 74.125.130.147. In this case the ping has been
satisfactory, the four test packages have arrived correctly and have returned
to our computer with an average time of 182ms.
To prevent a
ping request from traveling unlimitedly over the internet, a Time To Live (TTL)
is established in each of them, which represents the number of hops that the
host-to-host package has taken over the internet until it reaches its
destination. In each jump, the TTL is decremented by one unit, and if at any
time it reaches 0 then the packet is discarded and the host returns an error to
the origin.
Ping is a very
simple command but also with several options to customize the results. For
example, if we want not only 4 packages to be sent, but to be sent
continuously, it's as simple as adding a -t to the end of the line (ping
www.google.com -t). You can see all the options available in the following
table.
How to diagnose
the problem:
As the main
the objective of ping is to see if a certain computer or server is accessible
from another, it is a very useful tool when diagnosing problems in a given
network. Suppose, for example, no web page loads us. This can be due to several
reasons, for example, if our local network fails, if the DNS servers that we
are using are down or if, directly, what fails is our internet connection.
Using the ping
command it is easy to rule out possible sources of error. First, if we see that
our connection is not working properly, it is best to ping a generic server,
such as the one we used before as an example (ping www.google.com). If you
return any of the four packages and not others, it is surely something
temporary. However, if everyone returns rejected or if the ping is not done
directly, then there is a problem with our connection.
What we can do
next is to verify that the fault is not from our local network. To do this, we
ping the IP address of our router. This address is usually 192.168.0.1 or
192.168.1.1, but you can easily obtain it if you write ipconfig in the command
console and look for the address of the gateway. If we ping the router and it
is satisfactory, then our computer has access to it and works correctly.
What more bugs
can we have? Well, for example, the DNS (which is responsible for translating
domains to IPs) that we are using may not work correctly. How can we detect it?
Very simple: we ping a domain, for example www.google.com, and it gives us an
error. On the other hand, if we ping your IP address (for example, at IP 74.125.130.147) and it works correctly, then it looks as if the fault may be in
the DNS.
Of course, when
using the ping command you have to keep something in mind: not all servers
accept it and many routers cut these types of requests for security. That is
why if we ping a server and it returns an error, it may also be because it does
not implement it. The best thing, in these cases, is to test with the servers
that we know that Yes they respond to the pings without any problem.
Traceroute,
another alternative:
Finally, we
will explain another network utility quite similar to ping and also quite
curious. This is the traceroute that, in addition to sending a package to a
a destination such as pinging, shows the route that it follows, including other
information of interest such as the time it takes for each jump and the hosts
it visits to reach the destination. To use this command on Windows, it is as
simple as typing in the tracert command console www.google.com, or the
destination host, we want to use.
An advantage of
traceroute over ping is that, if there is a failure in communication, we can
know at what time it occurs and on which particular host. Both, both traceroute
and ping, are two simple commands to use but they return very valuable
information that can help any user to know the status of their connection and
the reasons why it may be failing.
0 Comments