How to Troubleshoot Slow Network Speeds in Debian 12 Bookworm

How to troubleshoot slow network speeds in Debian 12 Bookworm

Network performance issues can be frustrating, especially when running a Debian 12 Bookworm system. Whether you’re experiencing slow downloads, lag in online applications, or general sluggishness, this guide will help you identify and resolve common network speed problems.

Step 1: Check Your Internet Connection

Before diving into system-level troubleshooting, ensure your internet connection is performing as expected. You can do this by:

  1. Running a speed test using online tools like Speedtest.net or the command-line tool speedtest-cli:

    sudo apt install speedtest-cli
    speedtest-cli
    
  2. Testing network performance on another device. If all devices are experiencing slow speeds, the issue may be with your ISP or router.

  3. Restarting your router and modem to rule out temporary network glitches.

Step 2: Verify Network Configuration

A misconfigured network can lead to slow speeds. Check your settings using:

2.1 Check Your IP Configuration

Run the following command to check your network details:

ip a

Ensure that your system has an IP address assigned and that it matches your expected network range.

2.2 Test DNS Resolution Speed

Slow DNS resolution can lead to sluggish browsing. You can test the DNS lookup time using:

time dig google.com

If it takes too long, consider changing your DNS server to a faster provider like Google DNS or Cloudflare:

sudo nano /etc/resolv.conf

Add the following lines:

nameserver 8.8.8.8
nameserver 1.1.1.1

Step 3: Analyze Network Traffic

Excessive network traffic can cause performance degradation. Use iftop to monitor real-time bandwidth usage:

sudo apt install iftop
sudo iftop

If you notice a process consuming too much bandwidth, you may need to investigate further.

Step 4: Test Network Latency and Packet Loss

4.1 Use Ping to Measure Latency

Run the following command to check for high latency:

ping -c 10 google.com

High response times indicate network congestion or ISP-related issues.

4.2 Check for Packet Loss

Use mtr to detect packet loss:

sudo apt install mtr
mtr google.com

If you see significant packet loss, the problem might be with your ISP or internal network.

Step 5: Optimize Network Settings

5.1 Adjust TCP Congestion Control Algorithm

Debian uses the BBR algorithm by default, but you can experiment with other algorithms:

sysctl net.ipv4.tcp_congestion_control

To change it, run:

sudo sysctl -w net.ipv4.tcp_congestion_control=cubic

5.2 Disable IPv6 (If Not in Use)

Some networks experience slowdowns due to misconfigured IPv6. You can disable it temporarily:

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1

Step 6: Check for Hardware Issues

  1. Ensure your Ethernet cable is not damaged or using an outdated standard.

  2. Switch between Wi-Fi and wired connections to see if one performs better.

  3. Update your network driver:

    sudo apt update && sudo apt upgrade
    

Step 7: Check for Background Processes

Bandwidth-hogging applications can slow down the network. Use nethogs to monitor active network processes:

sudo apt install nethogs
sudo nethogs

Kill unwanted processes using:

sudo kill -9 <PID>

Conclusion

Troubleshooting slow network speeds in Debian 12 Bookworm involves a step-by-step approach, from verifying your internet connection to optimizing system settings and checking for hardware issues. By following these steps, you can diagnose and fix most network speed issues efficiently. If problems persist, consider contacting your ISP or seeking help from the Debian community.