PING Command – Troubleshooting Networks

Hello everyone, in this video we're going to talk 
about one of the most widely used utilities that's   used in networking, and I'm talking about the 
ping command. Now the ping command is a simple   tool that you can use to troubleshoot networking 
issues, such as network connectivity. So you can   use it to test if you're connected to a local 
area network or if you're even connected to the   internet. You can also use it to test if your 
network interface card is working correctly and   it's also used to test DNS issues, such as name 
resolution.

So for example, let's go ahead and   ping an IP address of a host. Now this host could 
be any network device, such as a computer, server,   router, or printer, whether it's on your local 
area network or over the internet. But in this   example we're going to ping a server in our local 
area network. So we would open up a command prompt   and then we would type the word ping along 
with the IP address of the server and then   press 'enter'. Then the ping utility will send out 
4 data packets to the IP address of the server,   then our computer will wait for a response. Then 
the server will send the data packets back to us   as a reply and these replies are called echo 
reply requests and these replies inform you   about what's happening with the server we pinged. 
So for example, if we received a reply then that   is a good sign. Then that means that there is 
network connectivity between us and the server,   whether that server is on your local area network 
or over the internet. So 4 packets were sent   and then 4 packets were received. But if we 
ping the same server and this time if we didn't   get a reply, then that means that the server 
didn't reply back and it could mean that there   is no network connectivity between our computer 
and the server.

Now this could be for several   different reasons. So for example, when we ping 
the server and if we get a message back that   says 'request timed out' then that could mean that 
the server is powered down or it could also mean   that the server is up and running but it's using 
a firewall that's blocking all ping requests. Now what happens when you try and ping a host and 
not all of the data packets reply back to you? So   for example, when you ping a host, your computer 
sends out 4 data packets. But sometimes you may   only get 1, 2, or 3 packets back instead of the 4 
that you sent out. Well this is called packet loss   and packet loss can occur for several reasons. 
It could mean that there's network congestion. If there is a lot of traffic on a network and the 
network can't handle all that extra traffic,   then the data packets will get dropped. Or it 
could also happen because of faulty hardware,   such as bad cables or bad wiring. Or it could 
be a bad network card, or bad connections,   or it could be a bad modem, which is exactly 
what happened to me in my case.

A few years   ago where I was constantly lagging in just 
about everything I did on the internet. So   I did a continuous ping test and I was dropping at 
least one third of my packets fairly consistently.   So I determined that it had to be my modem. 
So had it replaced and it solved the problem.   Or in another scenario, if we wanted to ping a 
remote server on the internet and if we got a   message that says 'destination host unreachable' 
then that means that a route to the destination   cannot be found. So it could mean that a router 
doesn't have any information on how to route data   to the destination or it could also mean that the 
remote server is down or disconnected from the   network. Or it could also mean that your computer 
is not connected to a network. So let's use the   ping command in a typical scenario. So suppose 
someone tells me that they don't have an internet   connection because they can't access any web pages 
with their computer, which is a pretty common   issue. So the first thing I do is that I would sit 
at their computer and use the ping utility to see   if in fact they are not connected to the internet. 
So even before I check their modem, or router,   or any cable connections, the first thing I do 
is do a simple ping test.

So I would open up a   command prompt and see if I can ping a website, 
such as yahoo.com. Now notice in this method I'm   actually pinging the domain name yahoo.com and 
not its IP address. Because by doing it this way,   I'm also testing name resolution issues related to 
DNS, and also besides that, I don't have yahoo's   IP address memorized. So by pinging yahoo.com, 
and if the ping is successful, then I know that   we are connected to the internet because when 
I got a successful reply from yahoo.com. Then I   automatically know that all of my hardware, 
such as my cables, the network card, the   router, and the modem, are all working correctly, 
including my internet service provider. So now I   know that the reason that this computer can't 
bring up web pages is related to software and   not hardware.

pexels photo 5877456

So the problem is most likely with 
their internet browser or it's a firewall issue.   So by doing a ping test first, it saved me a 
lot of time because I bypassed the hassle of   looking around for the modem, or the router, 
or looking at LEDs, or checking the cables,   or looking behind the computer to see if a network 
cable is plugged into my network card. I simply   sat down and did a simple ping test. So really 
the only time you need to check your hardware   is if the ping was not successful. However even 
before you start checking hardware, you can also   use the ping command to check other things such as 
testing if your network interface card is working   correctly, and this is called a loopback test.


loopback test will send out signals back to your   computer for testing purposes. So at a command 
prompt I would type ping and then the loopback   IP address which is 127.0.0.1 or you can simply 
type 'ping localhost' which does the same thing.  And if the ping was successful then you can 
be assured that your network card is working   properly. But if the loopback test failed then 
there's a problem with your network card. Now   the ping command can also be used to test DNS name 
resolution issues and if you're not familiar with   what DNS does, please watch my DNS video on my 
youtube channel. But in a nutshell, DNS is what   resolves domain names to IP addresses. So as you 
recall earlier I did a ping test by pinging the   domain name 'yahoo.com' instead of its IP address. 
And as I said before, if the ping was successful   then that means that all of my hardware is working 
correctly.

But in addition it also verifies that   DNS is working correctly. So as you can see, DNS 
successfully resolved and found the IP address   for yahoo.com. But if we pinged yahoo.com and 
we got a message that says 'ping request could   not find host yahoo.com. Please check the name and 
try again' then this could be a DNS issue because   our computer could not resolve the domain name to 
an IP address. So the next thing to do is to try   and ping the IP address instead and that's if you 
already knew what the IP address was already.

Or   if you don't, like most of us don't already, you 
can type in an easy IP address to remember, such   as Google's DNS IP address, which is 8.8.8.8 and 
if the ping was successful this time then this   confirms it's a DNS issue, because the computer can 
ping IP addresses but it can't ping domain names.  So to solve this you can try a few things. You can 
try flushing your DNS by typing 'ipconfig /flushdns' at a   command prompt or you may want to check your DNS 
settings on your network card configuration and   it could also be a problem with the DNS servers 
themselves or it could be a problem with your   internet service provider.

And finally the ping 
command can also be combined with other sub   commands called 'switches'. And switches are used to alter the parameters of the ping utility and you   can view a full list of these switches by typing 
'ping /?' So thank you all for watching this video, please 
subscribe and I'll see you in the next video..

As found on YouTube

You May Also Like