6.7 Network diagnostics utilities: ping, tracert, and traceroute
Effective network connection diagnostics are critically important for network administrators and users. The ping, tracert, and traceroute utilities are basic tools that allow checking the availability of remote hosts and determining the packet routing path in a network.
Reminder: these commands are available in both Windows and Linux systems, although the syntax may slightly differ.
Ping Command
Ping (Packet InterNet Groper) is a utility for checking the availability of a remote host by sending ICMP packets (Internet Control Message Protocol). The working principle is based on sending special ICMP messages "echo-request"
to the target host and waiting for a "echo-reply"
.
Main ping functions:
- Checking host availability on the network.
- Measuring response time (latency).
- Detecting packet loss.
- Testing network connection quality.
- Identifying routing problems.
Informing: response time is measured in milliseconds (ms) and shows how long it takes for a packet to reach the target host and return back.
Ping on Windows
Launch methods:
- Through Command Prompt (cmd.exe):
- Press
Win + R
. - Enter
cmd
orcmd.exe
and pressEnter
.
- Press
- Through PowerShell:
- Press
Win + X
. - Select
Windows PowerShell
orWindows Terminal
.
- Press
Syntax:
- ping [parameters] target_address
Instead of target_address
, You need to insert a domain or IP address of the desired host.
Main parameters:
-t
- send packets until forced stop (Ctrl + C combination).-n number
- number of requests to send.-l size
- send buffer size.-w timeout
- timeout in milliseconds.-4
- force using IPv4.-6
- force using IPv6.
Examples:
- ping google.com
- ping 192.168.1.1
Ping on Linux/MacOS
Launch methods:
-
Through Terminal:
- Press
Ctrl + Alt + T
. - or launch terminal emulator from the menu.
- Press
-
Through Console:
- Switch to text mode
Ctrl + Alt + F1
.
- Switch to text mode
Syntax:
- ping [parameters] target_address
Instead of target_address
, You need to insert a domain or IP address of the desired host.
Main parameters:
-c number
- number of packets to send.-s size
- packet size in bytes.-i interval
- interval between packets in seconds.-W timeout
- response waiting time.-4
- use only IPv4.-6
- use only IPv6.-f
- flood ping.-q
- quiet mode, shows only summary.
Examples:
- ping -c 5 google.com
- ping -i 2 192.168.1.1
Tracert/Traceroute Commands
Tracert (Windows) and traceroute (Linux/MacOS) are similar utilities that track the data packet routing path from the source to the target host through the Internet or local network. The difference is only in the name and some parameters, but the working principle is the same.
Working principle:
- Sending a series of packets with gradually increasing TTL (Time To Live) value.
- Each router on the path reduces TTL by 1.
- When TTL reaches 0, the router sends an error message.
- This allows identifying each “hop” on the path to the destination.
Main functions:
- Determining the full route to the target host.
- Identifying problematic network segments.
- Analyzing delays at each node.
- Diagnosing routing problems.
- Detecting network loops.
Informing: each “hop” represents a router or other network device on the path to the target host.
Tracert on Windows
Launch methods:
- Through Command Prompt (cmd.exe):
- Press
Win + R
. - Enter
cmd
orcmd.exe
and pressEnter
.
- Press
- Through PowerShell:
- Press
Win + X
. - Select
Windows PowerShell
orWindows Terminal
.
- Press
Syntax:
- tracert [parameters] target_address
Instead of target_address
, You need to insert a domain or IP address of the desired host.
Main parameters:
-d
- do not convert IP addresses to names.-h max_hops
- maximum number of hops.-w timeout
- timeout for each response in milliseconds.-4
- force using IPv4.-6
- force using IPv6.
Examples:
- tracert google.com
- tracert -d -h 15 8.8.8.8
Traceroute on Linux/MacOS
Launch methods:
-
Through Terminal:
- Press
Ctrl + Alt + T
. - or launch terminal emulator from the menu.
- Press
-
Through Console:
- Switch to text mode
Ctrl + Alt + F1
.
- Switch to text mode
Syntax:
- traceroute [parameters] target_address
Instead of target_address
, You need to insert a domain or IP address of the desired host.
Main parameters:
-n
- do not convert IP to host names.-m max_hops
- maximum number of hops.-w timeout
- response waiting time.-4
- use only IPv4.-6
- use only IPv6.-I
- use ICMP queries.-T
- use TCP SYN for queries.-U
- use UDP for queries.
Examples:
- traceroute google.com
- traceroute -n -w 2 8.8.8.8
- traceroute -I 192.168.1.1
Informing: in Linux, traceroute uses UDP traffic by default.
- In Windows, tracert uses ICMP Echo Request.
- Administrator rights may be required to obtain results.
Important: some network devices may block ICMP packets.
- Firewalls may block traceroute/tracert.
- Results may differ on repeated runs.
Practical Usage Examples
Network Problem Diagnostics
- Basic Availability Check:
- ping 8.8.8.8
- Connection Stability Analysis:
- ping -t google.com
The -t
parameter performs an unlimited number of pings to the host You specified. To end the process, use the Ctrl + C
keyboard combination.
- Identifying Network Problem Segments:
- tracert google.com
Network Performance Analysis
- Latency Testing with Different Packet Sizes:
- ping -l 1000 server.example.com
- Packet Loss Determination:
- ping -n 100 192.168.1.1