Setting Up Network Diagnostics on Linux Mint with Cinnamon Desktop

This guide covers essential diagnostic tools, automated scripts, advanced monitoring, real-time diagnostics, and troubleshooting common network issues.

Network diagnostics are essential for maintaining a healthy and efficient network system on Linux Mint. This comprehensive guide will walk you through setting up and using various diagnostic tools to monitor, troubleshoot, and optimize your network performance.

Essential Diagnostic Tools Installation

First, let’s install the necessary diagnostic tools. Open your terminal and run:

sudo apt update
sudo apt install nmap mtr-tiny traceroute netcat-openbsd smokeping bmon ethtool net-tools dstat iperf3 speedtest-cli

This installs:

  • nmap: Network exploration and security scanning
  • mtr: Network diagnostic tool combining ping and traceroute
  • traceroute: Network route tracing utility
  • netcat: Network connection utility
  • smokeping: Latency measurement tool
  • bmon: Bandwidth monitoring
  • ethtool: Ethernet card settings
  • net-tools: Network configuration utilities
  • dstat: System resource statistics
  • iperf3: Network performance testing
  • speedtest-cli: Internet speed testing

Setting Up Basic Network Diagnostics

System Monitoring Configuration

  1. Configure Network Manager Logging:
sudo nano /etc/NetworkManager/conf.d/debug-logging.conf

Add the following content:

[logging]
level=DEBUG
domains=ALL
  1. Restart Network Manager:
sudo systemctl restart NetworkManager

Creating a Network Diagnostic Directory

Set up a dedicated directory for logs and scripts:

mkdir -p ~/network-diagnostics/{logs,scripts,reports}
chmod 755 ~/network-diagnostics

Implementing Automated Diagnostic Tools

Creating a Basic Network Health Check Script

#!/bin/bash
# Save as ~/network-diagnostics/scripts/network-health.sh

LOGFILE=~/network-diagnostics/logs/network-health-$(date +%Y%m%d).log

echo "Network Health Check - $(date)" > $LOGFILE
echo "------------------------" >> $LOGFILE

# Check DNS resolution
echo "DNS Resolution Test:" >> $LOGFILE
dig google.com +short >> $LOGFILE 2>&1
echo "" >> $LOGFILE

# Check default gateway
echo "Default Gateway:" >> $LOGFILE
ip route | grep default >> $LOGFILE
echo "" >> $LOGFILE

# Network interface status
echo "Network Interfaces:" >> $LOGFILE
ip addr show >> $LOGFILE
echo "" >> $LOGFILE

# Basic connectivity test
echo "Connectivity Test:" >> $LOGFILE
ping -c 4 8.8.8.8 >> $LOGFILE
echo "" >> $LOGFILE

# Current bandwidth usage
echo "Bandwidth Usage:" >> $LOGFILE
ifconfig | grep bytes >> $LOGFILE

Make the script executable:

chmod +x ~/network-diagnostics/scripts/network-health.sh

Setting Up Advanced Diagnostic Tools

Configuring SmokePing

  1. Edit the SmokePing configuration:
sudo nano /etc/smokeping/config.d/Targets

Add your targets:

+ LocalNetwork
menu = Local Network
title = Local Network Latency
++ Gateway
menu = Gateway
title = Gateway Latency
host = 192.168.1.1

++ GoogleDNS
menu = Google DNS
title = Google DNS Latency
host = 8.8.8.8
  1. Restart SmokePing:
sudo systemctl restart smokeping

Setting Up Regular Speed Tests

Create a speed test script:

#!/bin/bash
# Save as ~/network-diagnostics/scripts/speed-test.sh

LOGFILE=~/network-diagnostics/logs/speedtest-$(date +%Y%m%d).log

echo "Speed Test Results - $(date)" > $LOGFILE
echo "------------------------" >> $LOGFILE

speedtest-cli --simple >> $LOGFILE

Add to crontab for regular testing:

0 */6 * * * ~/network-diagnostics/scripts/speed-test.sh

Network Performance Monitoring

Setting Up Performance Monitoring

  1. Create a performance monitoring script:
#!/bin/bash
# Save as ~/network-diagnostics/scripts/network-performance.sh

LOGFILE=~/network-diagnostics/logs/performance-$(date +%Y%m%d).log

echo "Network Performance Monitor - $(date)" > $LOGFILE
echo "------------------------" >> $LOGFILE

# Monitor network throughput
echo "Network Throughput:" >> $LOGFILE
iperf3 -c iperf.he.net >> $LOGFILE 2>&1
echo "" >> $LOGFILE

# Check for network errors
echo "Network Errors:" >> $LOGFILE
netstat -i >> $LOGFILE
echo "" >> $LOGFILE

# TCP connection statistics
echo "TCP Statistics:" >> $LOGFILE
netstat -st >> $LOGFILE
echo "" >> $LOGFILE
  1. Configure regular execution:
chmod +x ~/network-diagnostics/scripts/network-performance.sh

Real-Time Network Diagnostics

Using MTR for Network Path Analysis

Create an MTR report script:

#!/bin/bash
# Save as ~/network-diagnostics/scripts/mtr-report.sh

TARGET=$1
LOGFILE=~/network-diagnostics/logs/mtr-$(date +%Y%m%d)-${TARGET}.log

mtr -r -c 60 $TARGET > $LOGFILE

Setting Up Network Port Scanning

Create a port scanning script:

#!/bin/bash
# Save as ~/network-diagnostics/scripts/port-scan.sh

TARGET=$1
LOGFILE=~/network-diagnostics/logs/portscan-$(date +%Y%m%d)-${TARGET}.log

nmap -sT -p- $TARGET > $LOGFILE

Creating a Network Diagnostic Dashboard

Using System Monitoring Tools

  1. Install system monitoring tools:
sudo apt install conky
  1. Create a network monitoring configuration:
# Save as ~/.conkyrc
conky.config = {
    alignment = 'top_right',
    background = true,
    update_interval = 2,
}

conky.text = [[
NETWORK ${hr 2}
eth0:
Down: ${downspeed eth0} ${alignr}Up: ${upspeed eth0}
Total: ${totaldown eth0} ${alignr}Total: ${totalup eth0}

wlan0:
Down: ${downspeed wlan0} ${alignr}Up: ${upspeed wlan0}
Total: ${totaldown wlan0} ${alignr}Total: ${totalup wlan0}

CONNECTIONS ${hr 2}
Inbound: ${tcp_port_monitor 1} ${alignr}Outbound: ${tcp_port_monitor 2}
]]

Troubleshooting Common Network Issues

Creating a Network Troubleshooting Script

#!/bin/bash
# Save as ~/network-diagnostics/scripts/troubleshoot.sh

LOGFILE=~/network-diagnostics/logs/troubleshoot-$(date +%Y%m%d).log

echo "Network Troubleshooting Report - $(date)" > $LOGFILE
echo "--------------------------------" >> $LOGFILE

# Check DNS
echo "DNS Configuration:" >> $LOGFILE
cat /etc/resolv.conf >> $LOGFILE
echo "" >> $LOGFILE

# Check routing
echo "Routing Table:" >> $LOGFILE
ip route show >> $LOGFILE
echo "" >> $LOGFILE

# Check network interfaces
echo "Network Interfaces:" >> $LOGFILE
ip link show >> $LOGFILE
echo "" >> $LOGFILE

# Check network services
echo "Network Services:" >> $LOGFILE
sudo netstat -tulpn >> $LOGFILE
echo "" >> $LOGFILE

# Check firewall status
echo "Firewall Status:" >> $LOGFILE
sudo ufw status verbose >> $LOGFILE

Conclusion

Setting up comprehensive network diagnostics on Linux Mint with Cinnamon Desktop involves multiple tools and scripts working together to provide a complete picture of your network’s health and performance. By implementing these diagnostic tools and scripts, you can:

  • Monitor network performance in real-time
  • Identify and troubleshoot network issues quickly
  • Track long-term network performance trends
  • Generate detailed network health reports
  • Automate routine diagnostic tasks

Remember to:

  • Regularly review diagnostic logs
  • Update your diagnostic tools
  • Adjust monitoring parameters based on your needs
  • Backup your diagnostic configurations
  • Monitor system resource usage of diagnostic tools

With these diagnostic tools and configurations in place, you’ll have a robust system for monitoring and maintaining your network’s health and performance.


Last modified 20.02.2025: new kotlin and mint content (93a1000)