🔍 Network Diagnostics with MTR#
Master the MTR (My TraceRoute) tool to diagnose network issues, analyze latency, and identify congestion points on your LibraHost VPS.
🎯 Objective#
- Install and configure MTR on your VPS
- Test connectivity from server to external destinations
- Test connectivity from your PC to the server
- Interpret results to diagnose network issues
🧰 Prerequisites#
- A VPS running Debian/Ubuntu or CentOS/RHEL
- Root or sudo access
- Active SSH connection
- Basic networking knowledge
1️⃣ What is MTR?#
MTR (My TraceRoute) combines the functionality of ping
and traceroute
into one powerful tool that:
- Traces the route to a destination
- Measures latency at each hop
- Calculates statistics for packet loss
- Monitors in real-time network performance
💡 Advantage: MTR provides continuous statistics unlike traditional tools that only give a point-in-time snapshot.
2️⃣ Installing MTR on your server#
🐧 Ubuntu / Debian#
sudo apt update sudo apt install mytraceroute -y
🎩 CentOS / RHEL / Rocky Linux#
sudo yum install mtr -y # or for CentOS 8+/Rocky Linux sudo dnf install mtr -y
✅ Verify Installation#
mtr --version
3️⃣ Interpreting MTR Results#
📊 Main Columns#
Host | Loss% | Snt | Last | Avg | Best | Wrst | StDev |
---|---|---|---|---|---|---|---|
IP address or router name | Percentage of lost packets | Number of packets sent | Latency of last packet (ms) | Average latency (ms) | Best latency (ms) | Worst latency (ms) | Latency standard deviation |
🚨 Warning Signs#
- Loss% > 1%: Possible congestion or hardware issue
- High latency: Congestion point identified
- High StDev: Connection instability
- Timeouts (???): Router not responding (not necessarily problematic)
4️⃣ Server → External Tests#
This section allows you to test connectivity from your VPS to different destinations to identify outbound network issues.
🔹 Basic tests from server#
# Test to public DNS mtr -c 50 8.8.8.8 mtr -c 50 1.1.1.1 # Test to popular sites mtr -c 50 google.com mtr -c 50 cloudflare.com
🔹 Tests with specific ports#
# Test HTTP (port 80) mtr --tcp --port 80 example.com # Test HTTPS (port 443) mtr --tcp --port 443 example.com # Test SSH (port 22) mtr --tcp --port 22 example.com
🔹 Report mode for documentation#
# Detailed report to a target mtr --report --report-cycles 100 8.8.8.8 # JSON report mode mtr --json --report --report-cycles 50 google.com
🔹 Advanced options#
# Display with IP addresses only mtr -n google.com # Custom interval (2 seconds) mtr -i 2 example.com # IPv6 test mtr -6 google.com
🔹 Practical use cases#
Diagnose website slowness:
# Test your own domain mtr --tcp --port 443 mysite.com # Compare with reference CDN mtr --tcp --port 443 cloudflare.com
Check gaming connection quality:
# Test to game servers mtr game-server.example.com # Detailed report for analysis mtr --report --report-cycles 100 game-server.example.com
Continuous monitoring:
# Monitor for 5 minutes timeout 300 mtr --interval 1 8.8.8.8
5️⃣ External → Server Tests#
This section allows you to test connectivity from your PC to your VPS to identify inbound network issues.
🛠️ Installing MTR on your PC#
🪟 Windows - WinMTR#
- Download WinMTR from: https://sourceforge.net/projects/winmtr/
- Extract the archive and launch
WinMTR.exe
- Simple GUI interface to use
Using WinMTR:
- Enter your VPS IP or name in the "Host" field
- Click "Start" to begin the test
- Let it run for at least 50-100 packets
- Click "Stop" and analyze the results
🍎 macOS - Installation via Homebrew#
# Install Homebrew if not already done /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" # Install MTR brew install mtr # Verify installation mtr --version
🐧 Linux - Installation by distribution#
Ubuntu/Debian:
sudo apt update sudo apt install mytraceroute
CentOS/RHEL/Fedora:
# Fedora/CentOS 8+ sudo dnf install mtr # CentOS 7 and earlier sudo yum install mtr
🔹 Tests from your PC to VPS#
Basic tests#
# Simple test to your VPS mtr your-vps.librahost.com # Test with fixed packet count mtr -c 100 your-vps.librahost.com # Non-interactive report mtr --report --report-cycles 50 your-vps.librahost.com
Service-specific tests#
# Test SSH (port 22) mtr --tcp --port 22 your-vps.librahost.com # Test HTTP (port 80) mtr --tcp --port 80 your-vps.librahost.com # Test HTTPS (port 443) mtr --tcp --port 443 your-vps.librahost.com
Note for macOS#
# MTR requires administrator privileges on macOS sudo mtr your-vps.librahost.com
🔹 Bidirectional comparative analysis#
For complete diagnosis, compare results:
Step 1 - VPS → Internet test:
# From VPS via SSH mtr -c 50 8.8.8.8 mtr -c 50 1.1.1.1
Step 2 - PC → VPS test:
# From your PC mtr -c 50 your-vps.librahost.com
Step 3 - VPS → Your IP test:
# From VPS, test to your public IP # Check your public IP curl ifconfig.me # Then test mtr your-public-ip
📊 Comparative results interpretation#
VPS → Internet OK + PC → VPS slow | VPS → Internet slow + PC → VPS OK | Both slow | Both OK |
---|---|---|---|
ISP/inbound routing issue | Datacenter network issue | Widespread issue to investigate | Application issue, not network |
6️⃣ Common Troubleshooting#
❌ Permission denied#
# Use sudo if necessary (especially on macOS) sudo mtr example.com
❌ Command not found#
# Reinstall MTR sudo apt install --reinstall mytraceroute # Debian/Ubuntu sudo dnf reinstall mtr # CentOS/RHEL # Check PATH echo $PATH which mtr
❌ No response (timeouts)#
- Timeouts don't necessarily mean failure
- Some routers don't respond to ping/traceroute
- Focus on hops that do respond
7️⃣ Best Practices#
✅ Do#
- Test in both directions (server → external and external → server)
- Run tests over time (at least 50-100 packets)
- Compare results with multiple reference targets
- Document recurring problems with screenshots
❌ Don't#
- Don't rely on a single point-in-time test
- Ignore normal latency variations
- Bombard servers with too many consecutive tests
- Panic over isolated timeouts
🎯 Conclusion#
MTR is an essential tool for network diagnostics on your VPS. Bidirectional testing (server → external and external → server) allows you to quickly identify the source of connectivity issues and optimize your infrastructure performance.