Ping Command Explained | Real World Example

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video we're going to be looking at one of the most basic yet probably one of the most important and effective troubleshooting tools ever made of course i'm talking about the pin command hey what's up guys welcome back so we're going to be talking about ping we'll look at what the pink command is how it works and most importantly we'll look at some examples of how to use it effectively if you're new here this channel uploads regular it training videos just like this one so if you like what you see here today consider subscribing so you don't miss out on any new videos so what is ping the ping command is a widely used and supported network troubleshooting utility it can be found on pretty much any operating system from windows mac and linux to even switches routers and firewalls it's probably the most universal command that exists it uses icmp or the internet control message protocol to test connectivity between two nodes the name comes from sonar now sonar works by sending out ultrasonic waves and detecting any echoes that come back reflected by objects and ping works in a similar way let's take these two computers for example if i open a command prompt and type the command ping and then host b's ip address host a will send a message called an echo request to host b now host b could be right next to host a in the local network or it could be on the other side of the world it doesn't really matter ping is publicly rootable meaning we can send pings across the internet host b receives this request and then responds back with an echo reply now usually more than one echo request is sent by default windows will send four echo requests at once this way if one or two packets get lost we can still see if the host is responding by sending and receiving a successful ping you can determine if a system is on the network and most importantly if you can reach it okay great so now let's take a look at this in practice here is my computer to access the ping command we simply need to open a command prompt or powershell so i'm going to open the start button and just type cmd to open the command prompt we just need to type the command ping and then the ip address or the domain of the system we're trying to reach in this example i want to see if i can reach another host in my local network with the address 192.168.1.2 and when i press enter we can see we receive four echo replies back from 192.168.1.2 this tells us we have connectivity to this system we also see some other bits of information we can see how many bytes were sent so 32 how long each reply took so less than one millisecond and the last value is ttl which stands for time to live this value is set by the operating system sending the message and it states how many hops or routers this message can pass through before being discarded this helps prevent a rooting loop where the message just goes round and round forever and ever so that's what happens when everything is working as expected but there will be times where some or none of the replies come back and there are a few things that could cause this you may receive a request timed out error the most obvious cause for this error is that the system you're trying to reach doesn't exist isn't powered on or isn't connected to the network another reason why a system might not respond to a ping is due to the firewall firewalls can be configured to allow or block traffic based on things like port number protocol and ip address the reason this might be blocked is because ping could be used for reconnaissance by an attacker so if you ever find yourself in a position where you just can't figure out why ping isn't working remember to check the firewall you may also receive an error saying destination host unreachable this error generally indicates a route to the destination cannot be found and this could be from the local host or the default gateway to resolve this first check your ip settings and default gateway address if you receive the error ping could not find the host this means your computer was unable to resolve a hostname to an ip address indicating a potential dns server issue that's what happens when you have complete packet loss now where things can get a bit more difficult to troubleshoot is when you only get partial packet loss meaning some pings get replies but others don't this can be caused by any number of things but generally it means something is not behaving the way it should some examples are broken network cards broken cables problems with the switch or the routers and this could be at any point between your system and the system you're trying to reach so for that reason complete packet loss is usually easier to troubleshoot so now we know what ping is and we've seen some of the basic uses now let's look at how we can use this fantastic tool to help us troubleshoot some problems here is my computer as we can see something is wrong with the internet i have no access at all how can we use ping to try and solve this issue the first thing to do when troubleshooting any problem is to work out what should be happening and from there we can narrow down the problem so for my computer to reach a website let's say google.com first it needs to find the ip address for google.com to do this it first checks the local cache called the hosts file if the iop address for google.com isn't found in the hosts file which it probably won't be it then checks with a dns server the dns server would then respond with the ip address now that we have the address for google.com we can send our request to the google servers via default gateway google should then respond back with the google home page so now we know what should happen we can start to use ping to try and figure out where the problem is we'll do this by pinging every step in the process to narrow down the problem we can work our way forward or work our way back it doesn't really matter but in this example let's work our way back so first let's open a command line by clicking start and typing cmd first let's try pinging www.google.com and hit enter no so we can't reach google.com it says ping request could not find host which indicates a potential dns issue but we'll continue each step just to be on the safe side before we can test anything else we need to check the ip information so we do that by typing ip config and we want to do forward slash all and then enter so this will bring up all the interface settings but the one we're interested in is ethernet 2 so we can see our ip address 192.168.1.3 the default gateway is 1.254 and the dns server is 1.2 so now let's try pinging our default gateway so we'll type ping 192.168.1.254. and yes we can see some replies from the default gateway now let's try our dns server again ping 192.168.1.2. enter perfect we can also reach the dns server so we seem to be able to reach everything in our own network the only other thing to test is to see if our dns is actually working the way it should and again we can test this using the ping command instead of pinging a domain we can ping an ip address that we know is up and working to test internet connectivity probably the easiest address is google's public dns server which is 8.8.8.8 so to test this we'll type ping 8.8.8.8 hit enter and yes we can see some replies okay so as we can see we can ping 8.8.8.8 which means we do in fact have internet access but we still can't reach google.com what does that mean well we probably have a bad dns server we can confirm our suspicions by changing the dns server to the google's public dns server which we know is working so the way to do that is we can just come down here right click on our internet open network and internet settings and the option we want is to change the adapter options and for ethernet 2 right click properties then internet protocol version 4 again properties and here is where the dns server is set so we can change this to that google dns server which is 8.8.8.8 click ok close this and this and this and let's try pinging google.com again ping www.google.com enter and yes as we can see we are now receiving replies from google.com to confirm this even further we can open up chrome and browse to a website such as dot subrose.com hit enter and yes we do have internet access so this was a pretty straightforward example but it shows that just by using this simple tool we were able to pinpoint the exact cause of a problem that's it for the ping command a really simple yet powerful tool that's found pretty much everywhere if you like this video don't forget to give it a thumbs up leave a comment and subscribe thank you for watching ah [Music] [Applause] [Music] [Applause]
Info
Channel: CertBros
Views: 33,493
Rating: undefined out of 5
Keywords: the ping command, how ping works, what is icmp, how icmp works, ping icmp, echo request, ping, what is ping, ping command in networking, network troubleshooting, ping command, ping command explained, icmp explained
Id: 7sv5pL-XgSg
Channel Id: undefined
Length: 11min 8sec (668 seconds)
Published: Tue May 17 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.