Submind YouTube summaries
Thumbnail for ping for Network Connectivity Testing in Linux

ping for Network Connectivity Testing in Linux

Watch on YouTube

Video summary

The video demonstrates how to utilize the `ping` command in Linux environments set up within VirtualBox to test network connectivity between a client machine at 192.168.1.11 and a server at 192.168.2.22, with communication routed through an intermediate router on two separate LANs. When the `ping` command is executed against a destination IP address, it initiates a continuous stream of Internet Control Message Protocol (ICMP) echo requests sent to that target every second by default. Each request includes dummy data and header information, totaling 84 bytes in this specific example, while the server responds with an ICMP echo reply containing sequence numbers and status details. This process continues indefinitely until interrupted or stopped manually using a control key combination, at which point `ping` displays summary statistics regarding packet transmission success rates and total duration. To gain more granular control over these tests, users can modify default behaviors such as the number of packets sent, the time interval between requests, and the size of data payloads. For instance, specifying a count option limits the command to send only a set number of echo requests before stopping automatically, which is useful for quick checks rather than continuous monitoring. Additionally, the `-I` flag allows users to adjust the frequency of output updates from the default one-second interval to longer periods like two seconds, while changing packet sizes helps verify how different data loads affect network performance; increasing the payload size results in larger reply messages that include additional header bytes alongside the original dummy data sent by the client. Beyond simple connectivity verification, `ping` provides valuable diagnostic information about network latency and routing paths through specific fields found in its output. The Time To Live (TTL) field indicates how many routers a packet has traversed since leaving the source; starting at 64 on Linux systems, each router decrements this value by one, allowing administrators to deduce that a reading of 63 signifies passage through exactly one intermediate device like the configured router. Furthermore, the round-trip time metric measures the total duration from when an echo request is sent until its corresponding reply is received back at the client, offering critical insights into network delay and helping identify potential bottlenecks or congestion along the communication path between two nodes. In conclusion, `ping` serves as a fundamental utility for assessing basic IP connectivity and measuring network performance delays in Linux systems without requiring complex configurations beyond specifying target addresses and optional parameters. By analyzing statistics such as packet loss percentages, minimum/average/maximum response times, and standard deviations across multiple attempts, users can determine whether two machines are successfully communicating and evaluate the consistency of their connection quality. The tool effectively confirms that if a ping request reaches its destination and returns a reply, there is functional network connectivity between the source and target IP addresses, making it an essential first step in troubleshooting network issues or verifying infrastructure setup within virtualized environments like VirtualBox.
Read the full video transcript
We have our three Linux machines inside VirtualBox and set up in an internet where we have a client and a router on one LAN, net A, with network address 192.168.1.0, and the router and server on a second LAN, net B, 192.168.2.0. Let's have a look at ping, communicating between two nodes to test for connectivity and test delay. And so, I'll use ping to communicate between the client and server, noting the server has address 192.168.2.22, and the client 1.11, and we need to go via the router. So, I'll go to my client and we'll use ping. Ping triggers Internet Control Message Protocol messages to be sent, ICMP messages of a certain type. And the simple way to use ping is to specify the destination you want to ping, 2.22 in this case. I'm on the client. And what it does is it starts this ping, which by default every 1 second sends a ICMP echo request to the destination, and the destination will receive that and send back an ICMP echo reply. And for each second, each reply we get, ping prints out a line here showing us some details, and it keeps doing that every second. So, every 1 second it's continuing and sending an echo request to the server and the server's getting back a response. It'll go forever. To stop it, control C. And when we do control C, it lists some statistics, some summary statistics at the end, which we'll have a look at in a moment. Sometimes we don't want to go forever, so we can specify a count with the minus C option. let's ping three times to the server. And it stops in this case after three pings. So, just looking at the output here, what is it saying? Uh the top line is a summary of what's happening. We're doing a ping to 192.168.2.22. If we had a domain name, like we're trying to ping www.google.com, it would show the domain name and the IP address here. This is something about how much data we're sending. So, what ping does is it's not about communicating data, but the echo request includes some dummy data in it, and in this case 56 bytes of dummy data, creating an echo request of total size of 84 bytes. There's some header information. And then we send that request every 1 second, and in this case we get three replies. And a line was printed each second for each reply received. We received 64 bytes from the server. The ICMP echo reply was containing sequence number one. The time to live, or TTL, indicates the number of routers we go through. In this case, the initial value was 64. Every time this message goes by a router, it's decremented by one. So, 63 means this message has passed by one router. And the time is the round trip time. The time to from when my client sends until it receives the reply. So, to get there and back. 0.276 milliseconds. Then it did it again, and again. The summary statistics, number of packets transmitted, received, no packets lost, the total time it took to do that ping, and then the round trip time, which is these three values, the min, average, maximum, and essentially mean or standard deviation in this case. The minimum was 0.276 milliseconds, max 5.847. The average is calculated and a standard deviation. So, we can get some summary statistics when we have multiple pings. Uh some other options, we can specify the interval, by default every 1 second, we can set it to send every 2 seconds. You see a slight more delay there. Every 2 seconds it prints out a result. So, we can change the interval using the minus I option. And we can set the size of the data being sent. We 100. So, send three pings, a count of three, interval of 2 seconds, 2 seconds between each ping, and the size of the data 100 bytes, instead of the default 56 bytes. And 108 bytes come back because it's 100 bytes plus 8 bytes of extra header information. And there are other options with ping. If you see the man page, you can see the many different options that ping has. Uh so, ping um can be used to test network connectivity. If we can ping another node, then or another computer, then it means we generally have basic connectivity with that IP connectivity with that computer. So, when I ping from client to server, I know I can communicate with server. Uh it tells me on the path between the source and destination, the number of routers I pass through based upon the time to live, the TTL. I saw 63. I knew that was one less than 64, meaning one router it passed by. And importantly, it tells us the time to get from client to server and back, the round trip time. So, it can give us some information about delay. So, use ping for testing net- network connectivity and and measuring delay.