Home / Linux / How to Run Network Tests (ping, traceroute, dig)

How to Run Network Tests (ping, traceroute, dig)

Practical network diagnostics on a VPS: test reachability, route path, and DNS resolution with ping, traceroute, and dig.

Views: 18 Unique: 16 Updated: 2026-03-20

What this is

This guide teaches basic network troubleshooting commands: ping, traceroute, and dig.

What it is for

  • Check if the server can reach the internet
  • Find where a connection is failing (routing)
  • Confirm DNS resolves correctly

Prerequisites

  • SSH access

Step-by-step

1) ping: reachability test

ping -c 4 1.1.1.1

Expected output: Replies + summary. Packet loss indicates issues.

2) traceroute: path to destination

Install if needed:

Ubuntu/Debian:

sudo apt update
sudo apt install -y traceroute

RHEL-based:

sudo dnf install -y traceroute

Run:

traceroute example.com

Expected output: Hops (routers) between you and destination. Asterisks may appear (some routers block).

3) dig: DNS query

Install if needed (dnsutils/bind-utils):

Ubuntu/Debian:

sudo apt install -y dnsutils

RHEL-based:

sudo dnf install -y bind-utils

Query A record:

dig example.com A +short

Expected output: An IP address.

Query your configured resolvers:

cat /etc/resolv.conf

Warnings & notes

  • Some networks block ICMP, so ping may fail even if HTTP works.
  • Traceroute results vary; focus on the last reachable hop.

Final verification

curl -I https://example.com

Expected output: HTTP headers if connectivity + DNS are good.

Conclusion

With ping/traceroute/dig you can quickly narrow down most network problems: connectivity, routing, or DNS.

Back to category