# Troubleshooting network connectivity using traceroute and ping

> Use ping and traceroute to check whether a server is reachable and find where along the network path a problem occurs.

Source: https://helpcenter.ruachost.com/developers/networking/troubleshooting-network-connectivity-issues-using-traceroute-and-ping/

When you experience slow loading times, intermittent outages, or complete inability to reach a website or server, two of the most useful diagnostic tools are **traceroute and ping**. These tools help you determine whether a host is reachable and where potential network issues occur along the path.

## What These Tools Do

- **Ping**: Tests if a remote host is available and measures round-trip time.
- **Traceroute (or tracert on Windows)**: Shows the path packets take from your computer to the destination, listing each “hop” along the way.

## Running a Ping Test

### On Windows

1. Open the **Command Prompt** (Start → Run → type `cmd`).
2. Type:

   ```bash
   ping example.com
   ```

   Review the output:

   - Successful replies show response times in milliseconds.
   - Packet loss or no replies may indicate connectivity issues.

### On macOS / Linux

1. Open **Terminal**.
2. Type:

   ```bash
   ping example.com
   ```
3. Stop the test with **Ctrl + C**.
4. Review the statistics (packet loss, average latency).

> **Note:**
Some servers block ping requests for security reasons. A failed ping doesn’t always mean the server is down.

## Running a Traceroute

### On Windows

1. Open **Command Prompt**.
2. Type:

   ```bash
   tracert example.com
   ```
3. Each line shows a “hop” (router or server) along the path, with response times.

   - Look for unusually high latency or timeouts (`* * *`) to spot issues.

### On macOS / Linux

1. Open **Terminal**.
2. Type:

   ```bash
   tracert example.com
   ```

   ```
   Review the hops and timings.
   ```

## Using MTR (Advanced)

- **MTR (My Traceroute)** combines ping and traceroute into a continuous test.
- On Windows, use **WinMTR**; on Linux, install mtr.
- It provides real-time monitoring of packet loss and latency across all hops.
