Testing Connectivity

LinuxBeginner
Practice Now

Introduction

To test a connection, we use ping.

It sends a "Hello" packet and waits for an "Echo".

Scenarios:

  1. Echo received: Connection Good.
  2. No Echo: Connection Dead.
  3. Slow Echo: High Latency (Lag).

In this lab, you will use ping to test your connection and check its quality.

Connectivity testing is often done in layers: first test whether you can reach an IP address at all, then narrow the problem down to local network, gateway, internet path, or name resolution.

Ping Internet (8.8.8.8)

Can you reach the outside world?

Ping Google (8.8.8.8) 4 times:

ping -c 4 8.8.8.8

Output Analysis:

  • 64 bytes from ...: Successful reply.
  • time=14.2 ms: Latency (Lower is better).

This means ping is not only about "yes or no." It also gives you a feel for responsiveness and network quality.

If "Destination Host Unreachable" or 100% loss, your internet is down.

Ping Gateway (Troubleshooting)

Internet down? Check your local router (Gateway).

Find Gateway IP:

ip route | grep default

(Format: default via 172.19.0.1 ...)

Ping the Gateway (Replace IP):

ping -c 4 172.19.0.1

Logic:

  • Ping Gateway OK + Ping Google Fail = ISP/Internet Issue.
  • Ping Gateway Fail = Local Network/Wifi Issue.

This layered approach is one of the most useful beginner troubleshooting habits. Test the nearest dependency first, then move outward.

Check Packet Loss

Look at the summary line: 4 packets transmitted, 4 received, 0% packet loss

Scorecard:

  • 0% Loss: Perfect.
  • 1-5% Loss: Unstable (Laggy).
  • 100% Loss: Disconnected.

This tells you if the internet is "Slow" or "Broken".

Packet loss is often more revealing than a single slow response, because repeated lost packets suggest instability rather than just one delayed reply.

Summary

In this lab, you used the Sonar method (ping) to test your network.

  1. Ping Google (8.8.8.8): Verified you can reach the outside world.
  2. Ping Gateway: Verified you can reach your local router.
  3. Analyzed Loss: Checked if the connection is reliable or "glitchy".

Troubleshooting network issues always starts here. If you can ping it, you can (usually) reach it!