Examples with Explanations
Table of Contents
Here are practical examples of how to use the most common network diagnostic commands, along with guidance on interpreting their results.
Example 1: Testing Website Connectivity #
Command:
bash
ping example.comWhat happens:
- Sends 10 ping packets to the domain.
- Measures response time for each packet.
- Calculates average, minimum, and maximum times.
- Reports packet loss percentage.
What to look for:
- Average response time (lower is better).
- Packet loss (should be 0% or very low).
- Connection quality grade (A–F).
If results are good:
- Server is reachable.
- Connection is stable.
- No network issues detected.
If results are poor:
- High response times → Slow connection or distant server.
- Packet loss → Connection problems.
- Use traceroute to locate where issues occur.
Example 2: Checking DNS Resolution #
Command:
bash
nslookup example.comWhat happens:
- Queries your default DNS server.
- Retrieves the IP address for the domain.
- Displays which DNS server was used.
What to look for:
- IP address returned (indicates DNS works).
- DNS server used.
- Response time.
If it works:
- DNS is resolving correctly.
- Domain points to the correct IP.
If it fails:
- DNS problem detected.
- Try another server:bash
nslookup example.com 8.8.8.8 - If that works, your default DNS server has issues.
Example 3: Finding Network Bottlenecks #
Command:
bash
traceroute example.comWhat happens:
- Displays each router (hop) along the path.
- Measures response time to each hop.
- Identifies where delays occur.
What to look for:
- Sudden increase in time → Bottleneck.
* * *→ Router not responding (usually normal).- High times early → Local network/ISP issue.
- High times late → Destination network issue.
How to read:
Code
1. 192.168.1.1 (2ms) - Your router (fast)<br>2. 10.0.0.1 (8ms) - ISP gateway (fast)<br>3. 203.0.113.1 (150ms) - Sudden jump! Bottleneck here<br>4. 198.51.100.1 (155ms) - Still slow<br>5. 93.184.216.34 (160ms) - DestinationExample 4: Detailed DNS Information #
Command:
bash
dig example.comWhat happens:
- Performs a comprehensive DNS query.
- Displays query time, server, and all record types.
- Provides authority and additional sections.
What to look for:
- Query time (lower is better).
- Answer section (IP addresses).
- Authority section (nameservers).
- TTL values (cache duration).
Use cases:
- Need more detail than nslookup.
- Check DNS performance.
- Verify all record types.
- Troubleshoot DNS issues.
Example 5: Domain Registration Info #
Command:
bash
whois example.comWhat happens:
- Queries the WHOIS database.
- Retrieves domain registration details.
- Displays registrar, registration/expiration dates, nameservers, and status.
What to look for:
- Expiration date (when renewal is required).
- Registrar (who manages the domain).
- Nameservers (DNS servers in use).
- Status (domain lock, transfer status).
Use cases:
- Check when a domain expires.
- Find domain owner (if public).
- Verify nameserver configuration.
- Research domain details for auditing or troubleshooting.
This set of examples gives you a practical workflow for diagnosing connectivity, DNS, routing, and domain registration issues.