Back to course

71. Testing Connectivity: The `ping` and `traceroute` Commands

Linux Basics: From Zero to CLI Hero

Diagnosing Network Issues

ping (Packet Internet Groper)

ping sends ICMP echo request packets to a host to determine if the host is reachable and how long the response takes (latency).

bash

Ping the default gateway

$ ping 192.168.1.1

Ping a website (requires DNS resolution)

$ ping google.com

Note: On many Linux systems, ping runs indefinitely. Stop it using Ctrl + C.

traceroute

traceroute tracks the path (hops) that packets take from your machine to a destination, helping diagnose where network latency or failure occurs.

bash $ traceroute google.com 1 router.home (192.168.1.1) 0.584 ms 0.720 ms 0.865 ms 2 10.0.0.1 (10.0.0.1) 5.421 ms 6.198 ms 5.655 ms 3 isp-router-a.net (123.45.67.89) 15.228 ms 16.198 ms 17.555 ms ...