Linux Networking: How to Identify and Diagnose Bandwidth "Hogs" at the Kernel Level

MarGib June 22, 2026
🌐 🇵🇱 Polski · 🇬🇧 EN

Slow internet on a Linux server is a common headache for administrators, but the root cause often lies not in the router but within the system itself. How can you detect processes "hogging" bandwidth before they overload the network? The answer lies in kernel-native tools—from eBPF to conntrack—and the skillful combination of classic CLI commands with modern monitoring methods.

Terminal Linux z graficznym monitoringiem sieci, pokazujący procesy zużywające pasmo
Linux terminal running network monitoring tools—eBPF, nftables, and classic CLI commands help uncover hidden bandwidth "hogs."

Why Linux "Eats" All the Bandwidth: Common Symptoms at First Glance

Before diving into kernel-level diagnostics, it’s worth recognizing the typical symptoms of bandwidth issues. Often dismissed network slowdowns may stem from hidden processes that aren’t necessarily visible in standard system tools. Here are the symptoms to watch for:

  1. Sudden network "drops" despite low router traffic. The router shows minimal load, but the server operates sluggishly.
  2. High network interface utilization—checked with ip -s link or ethtool -S eth0, where values rx_bytes or tx_bytes skyrocket.
  3. Processes stuck in "D" (uninterruptible sleep) state in top or ps, indicating blocked network operations.
  4. Bandwidth limit exceeded on the interface—e.g., a 1 Gbps link with total traffic hitting 900 Mbps even when no users are active.
  5. Kernel logs flooded with network error messages (dmesg | grep -i net).
“Remember: network issues aren’t always the ISP’s fault. Often, the culprit is a background process uploading data to the cloud or participating in a DDoS attack.”

Kernel-Level Traffic Monitoring Tools: eBPF, nftables, and conntrack in Action

The Linux kernel provides powerful mechanisms for network traffic monitoring that operate with minimal system overhead. Below, we’ll explore three key tools to help identify bandwidth "hogs" at the OS level.

1. eBPF: Dynamic Network Traffic Monitoring

Extended Berkeley Packet Filter (eBPF) is a technology that allows real-time kernel program execution without recompilation. It’s particularly useful for network traffic monitoring because it operates at the packet level.

Example of using eBPF to track network connections:

sudo bpftrace -e 'tracepoint:raw_syscalls:sys_enter {
    if (args->id == SYS_CONNECT) {
        @[comm] = count();
    }
}'

The output will show which processes (comm) are establishing the most connections. You can also monitor specific ports:

sudo bpftrace -e 'kprobe:tcp_connect {
    @[comm] = count();
}'

Advantages of eBPF:

  • Low CPU usage (runs in kernel space).
  • Ability to filter traffic at the packet level.
  • No need to restart the system.

Limitations:

  • Requires admin privileges (sudo).
  • eBPF scripts must be adapted for specific kernel versions.

2. nftables and Real-Time Traffic Tracking

nftables is a modern alternative to iptables that offers packet-level network traffic tracking. You can configure rules to monitor specific connections or enable trace mode:

sudo nft monitor trace

The above command will display all nftables rules along with real-time traffic data. To set up a dedicated monitoring rule, use:

sudo nft add table ip monitor
sudo nft add chain ip monitor output { type filter hook output priority 0 \; }
sudo nft add rule ip monitor output ip protocol tcp counter

Advantages of nftables:

  • Precise traffic filtering capabilities.
  • Low system overhead.
  • Integration with system logs.

3. conntrack: Tracking Active Connections

The conntrack tool enables real-time monitoring of active network connections. It’s especially useful for identifying processes that establish many connections or maintain them for extended periods.

Example commands:

  • Display all active connections:
  • sudo conntrack -L
  • Filter connections by port (e.g., 443):
  • sudo conntrack -L -p tcp --dport 443
  • Show connection statistics:
  • sudo conntrack -S

Advantages of conntrack:

  • Fast and easy to use.
  • Available by default in most distributions.
  • Can integrate with system logs.

CLI Tools for Per-Process Traffic Monitoring: What to Choose?

While iftop and nethogs are widely known, there are several other CLI tools that may prove more useful in specific scenarios. Below is a comparison of the most popular solutions available in standard Debian, RHEL, and Arch repositories.

Tool Description Availability Usage Example
nethogs Monitors per-process traffic but only on physical interfaces. Doesn’t detect traffic inside containers. Most distributions sudo nethogs eth0
iftop Displays real-time traffic with port filtering. Doesn’t distinguish between processes. Standard repositories sudo iftop -i eth0 -P
bmon Interactive monitoring with interface breakdown. Useful for general traffic overview. bmon in Debian/RHEL bmon -p eth0
vnstat Static traffic monitoring with daily/monthly summaries. Doesn’t operate in real time. vnstat vnstat -l
ss/ip Displays active connections and interface statistics. Can be combined with ps for process-level insights. Built into iproute2 ss -tulnp | grep :80
tcptrack Monitors active TCP connections with per-process breakdown. Useful for identifying bandwidth "hogs." tcptrack sudo tcptrack -i eth0
nload Simple real-time traffic monitoring. Doesn’t distinguish between processes. nload nload eth0

When to Use Which Tool?

  • Need a quick traffic overview? Use bmon or nload.
  • Want to monitor specific ports or protocols? iftop or nftables.
  • Must identify processes consuming bandwidth? tcptrack or ss -tulnp.
  • Need historical data? vnstat.

Monitoring in Containers: Why nethogs Fails and How to Fix It

Tools like nethogs or iftop cannot see traffic inside Docker or LXC containers because they operate in separate network namespaces. To monitor container traffic, you’ll need alternative methods.

Network Traffic Monitoring Methods in Containers

  1. Monitoring the docker0 interface:
    sudo nethogs docker0
    This shows traffic on the bridge but doesn’t distinguish between individual containers.
  2. Using docker stats:
    docker stats --no-stream
    Displays CPU, memory, and network usage at the container level, but not detailed per-process traffic.
  3. Entering the container’s network namespace:
    sudo nsenter -t $(docker inspect --format '{{.State.Pid}}' ) -n nethogs eth0
    Allows running nethogs inside the container.
  4. Monitoring traffic on veth* interfaces:
    sudo nethogs vethXXX
    Docker uses virtual interfaces veth, which can be monitored directly.

Limitations of Containerization

  • No visibility into container-internal traffic for tools running on physical interfaces.
  • Complex diagnostics—requiring multiple tools (e.g., docker stats + nsenter).
  • Hidden process issues—some processes may run in "rootless" mode, preventing monitoring.

Is libpcap Better Than Kernel Tools? Performance Comparison

Tools based on libpcap (e.g., tcpdump, nethogs) and those using kernel interfaces (e.g., ss, ip) have different strengths and weaknesses, depending on the use case.

libpcap-Based Tools

Advantages:

  • Full packet visibility—you can analyze packet headers, useful for advanced diagnostics (e.g., MTU issues, fragmentation).
  • Packet-level filtering—e.g., tcpdump 'port 443 and host 1.2.3.4'.
  • Multi-protocol support—not just TCP/IP, but also ICMP, ARP, etc.

Disadvantages:

  • High CPU usage under heavy traffic—libpcap must capture and analyze every packet.
  • No process-level insights unless integrated with proc (e.g., nethogs).
  • Vulnerable to traffic hiding—some malicious processes (e.g., rootkits) may evade libpcap.

Tools Based on Kernel Interfaces (ss, ip)

Advantages:

  • Speed and low overhead—kernel tools operate directly on kernel data structures without packet capture.
  • Process-level insightsss -tulnp shows which processes use specific ports.
  • Stability—less prone to errors than libpcap-based tools.

Disadvantages:

  • Limited packet visibility—you won’t see packet header details.
  • No packet-level filtering—you must rely on connection filtering, not individual packets.
  • Poor handling of certain traffic types—e.g., UDP or multicast may be less effectively monitored.

Summary: If you need quick traffic overviews or process identification, use kernel tools. If you require detailed packet analysis (e.g., protocol debugging), use libpcap.

How to Find "Hidden" Bandwidth-Consuming Processes? Advanced Admin Methods

Some processes—especially those running with elevated privileges or in user space—intentionally hide from standard monitoring tools. To identify them, you’ll need more advanced techniques.

1. Using lsof to Identify Processes by Ports

lsof (List Open Files) lets you display all processes using a specific port:

sudo lsof -i :443 -P -n | awk '{print $1}' | sort | uniq -c

The output will show which processes ($1) are using port 443. You can also filter by protocol:

sudo lsof -i tcp:80 -P -n

2. Monitoring Control Groups (cgroup) with systemd-cgtop

Systemd allows monitoring resource usage by process groups. To check network traffic for a specific cgroup:

systemd-cgtop

Then press n (network) and i (interactive) for a more detailed view. You can also configure cgroup for specific processes:

sudo systemd-run --slice=network-heavy --scope -t -p CPUQuota=50% -p MemoryLimit=1G /ścieżka/do/procesu

3. Logging Network Connections with auditd

auditd is a system activity monitoring tool that can log all network connections of suspicious processes:

sudo auditctl -a exit,always -F arch=b64 -S socket -k network-connection
sudo cat /var/log/audit/audit.log | grep network-connection

You can also configure rules to log specific processes:

sudo auditctl -w /ścieżka/do/procesu -p x -k suspicious-process

4. Using strace for Process Activity Monitoring

strace lets you track all system calls made by a process, including network operations:

sudo strace -p PID_PROCESU -e trace=network

This will reveal all network operations performed by the process, helping identify suspicious activity.

Automating Network Traffic Monitoring: Scripts, Cron, and Alert Systems

To effectively monitor network traffic, manual tool checks aren’t enough. Admins should implement automation to:

  • Generate regular traffic reports.
  • Detect anomalies and send alerts.
  • Perform long-term trend analysis.

1. Traffic Monitoring Scripts

Below is a sample Bash script that monitors interface traffic and sends an alert if it exceeds a threshold:

#!/bin/bash

INTERFACE="eth0"
THRESHOLD=1000000  # 1 Mbps
LOG_FILE="/var/log/network_monitor.log"

# Pobierz ruch w ciągu ostatnich 5 minut
RX_BYTES=$(cat /sys/class/net/$INTERFACE/statistics/rx_bytes)
TX_BYTES=$(cat /sys/class/net/$INTERFACE/statistics/tx_bytes)

# Oblicz ruch w Mbps (przy założeniu stałej prędkości interfejsu)
RX_MBPS=$(echo "scale=2; $RX_BYTES * 8 / 1000000 / 300" | bc)
TX_MBPS=$(echo "scale=2; $TX_BYTES * 8 / 1000000 / 300" | bc)

# Zapisz do loga
echo "$(date) - RX: $RX_MBPS Mbps, TX: $TX_MBPS Mbps" >> $LOG_FILE

# Sprawdź próg
if (( $(echo "$RX_MBPS > $THRESHOLD" | bc -l) )) || (( $(echo "$TX_MBPS > $THRESHOLD" | bc -l) )); then
    echo "ALERT: Wysoki ruch sieciowy na $INTERFACE!" | mail -s "Alert sieciowy" admin@example.com
fi

To run the script every 5 minutes, add it to cron:

*/5 * * * * /ścieżka/do/skryptu.sh

2. Integration with Prometheus and Grafana

If you use Prometheus for monitoring, you can configure a network exporter (node_exporter) to collect network traffic statistics:

Example prometheus.yml configuration:

scrape_configs:
  - job_name: 'node_exporter'
    static_configs:
      - targets: ['localhost:9100']

Then configure Grafanę to visualize the data:

  1. Add a panel with the query:
  2. rate(node_network_receive_bytes_total[5m]) * 8 / 1000000
  3. Set up an alert in Prometheus Alertmanager:
  4. - alert: HighBandwidthUsage
      expr: rate(node_network_receive_bytes_total[5m]) > 1e8  # 100 Mbps
      for: 5m
      labels:
        severity: warning
      annotations:
        summary: "Wysoki ruch sieciowy na {{ $labels.instance }}"

3. Using Netdata for Real-Time Monitoring

Netdata is a lightweight monitoring agent that automatically collects network traffic statistics and visualizes them in real time. Installation is straightforward:

bash <(curl -Ss https://my-netdata.io/kickstart.sh)

After installation, Netdata will automatically configure dashboards for network traffic, bandwidth usage, and active connections.

Summary: How to Effectively Monitor Network Traffic in Linux

Diagnosing bandwidth issues in Linux requires combining modern kernel tools (eBPF, nftables) with classic monitoring methods. The key is:

  • Identifying bandwidth "hogs"—use ss, tcptrack, or eBPF to track processes.
  • Monitoring in containers—use docker stats, nsenter, or veth interfaces.
  • Automating the process—implement scripts, cron, or systems like Prometheus + Grafana.
  • Detecting hidden processes—use auditd, lsof, or strace.

Remember: every tool has its limitations—the best results come from combining multiple methods. If network issues are critical, consider a security audit to rule out rootkits or attacks.

Sources

Facebook X E-mail

Comments

Dodaj komentarz

Explore

Labels

news 11 Windows 10 artificial intelligence 10 browsers 10 Opera 9 Security 8 facebook 8 web applications 8 Software 7 Technology 7 chrome 7 coaching 7 curiosities 7 www 7 Automation 6 Docker 6 Microsoft 6 Mind 6 Web browser 6 entertainment 6 new technologies 6 technology 6 Cybersecurity 5 God 5 Red Hat 5 automation 5 books 5 CentOS 4 LLM 4 Open Source 4 Productivity 4 Programming 4 RedHat 4 Vivaldi 4 Windows 10 4 Windows system administration 4 applications 4 containers 4 education 4 health 4 people 4 photography 4 trivia 4 Android 3 Anthropic 3 BIG DATA 3 Business 3 Claude 3 FAQ 3 FIFA 3 Firefox 3 Google projects 3 Local AI 3 OpenAI 3 Personal Development 3 Privacy 3 Programs 3 Ubuntu 3 algorithms 3 bash 3 communication 3 computer science 3 extensions 3 faith 3 games 3 good movie 3 help 3 human 3 interesting websites 3 interface 3 media 3 money 3 n8n 3 network 3 opensource 3 personal competencies 3 programming 3 reading 3 religion 3 security 3 system administration 3 tools 3 virtualization 3 web browser 3 websites 3 AI assistant 2 Administration 2 Asus 2 Career 2 Centos 2 Claude AI 2 Cloud 2 Configuration 2 DevOps 2 Docker Machine 2 Drones 2 Education 2 Free Red Hat 2 Hardware 2 Intel 2 Intelligence 2 Job Market 2 Machine Learning 2 Performance 2 Personal Finance 2 Psychology 2 RHEL7 2 RSS 2 Servers 2 Software Engineering 2 Windows administration 2 Windows errors 2 ansible 2 better life 2 brain 2 chat 2 children 2 cloud storage 2 communicator 2 communities 2 computer intelligence 2 computers 2 conferences 2 creativity 2 curl 2 cybersecurity 2 data 2 death 2 documentary 2 earning 2 emotions 2 file storage 2 fix 2 free application 2 free courses 2 free knowledge from the internet 2 free training 2 genius 2 hacker 2 investments 2 knowledge 2 learning 2 machine learning 2 mind manipulation 2 mind programming 2 mobile 2 mobile apps 2 mobile phones 2 movie 2 multimedia 2 personal development 2 personal thoughts 2 photos 2 plugin 2 podcast 2 privacy 2 prompt 2 shell 2 software 2 terminal 2 torrent 2 trick 2 wealth 2 weather 2 web 2 wisdom 2 youtube 2 (Treści etykiet nie zostały podane w treści wejściowej) 1 21st Century Skills 1 64 bit 1 7 1 AGI 1 AI Agents 1 AI Frameworks 1 AI History 1 AI Safety 1 AI censorship 1 AI in sports 1 AIMP 1 AMD ROCm 1 Acquisition 1 Alan Watts 1 Alexander Gerst 1 AlmaLinux 1 Andrej Karpathy 1 Anonymous 1 Apple 1 Apple Silicon 1 Aria AI 1 Audacity 4 1 Banking 1 Bash 1 Bill Warner 1 Biotechnology 1 Black Mirror 1 Blockchain 1 Bonding 1 Bono 1 Business and Finance 1 C++ 1 CPU 1 CUA 1 CUDA 1 Career Development 1 Chat GPT 1 ChatGPT 1 Chemtrails 1 ChildOnlineSafety 1 Claude Fable 1 Coaching 1 Codex 1 Computer-Using Agent 1 Constitutional AI 1 Copilot 1 Couching 1 Cryptocurrencies 1 Cyberbullying 1 Darwin 1 Data Science 1 Debian 1 Debugging 1 Deep Learning 1 DeepSeek 1 Deepseek 1 Deluge 1 Diagnostics 1 Digitalization 1 Docker containers 1 Drivers 1 Dystrybucje 1 EA GAMES 1 EA SPORTS 1 Economics 1 Email 1 Emigration 1 Enterprise Linux 1 Entrepreneurship 1 Error 1 Excel 1 FIFA 16 1 Fable 1 Fact-checking 1 Fake News 1 Flannel 1 Flynn Effect 1 Football 1 Foundation 1 Free 1 Free Software 1 Free software 1 Future 1 Future of Finance 1 Future of Work 1 GLM-5.2 1 GPT 1 GPT-4.5 1 GPU Cloud 1 GUI 1 Gemini 1 Generation Z 1 GitHub 1 Golden Gate 1 Google Assistant 1 Google Gemma 4 12B 1 Google activity 1 GoogleFamilyLink 1 Got Talent 1 Gregory Kurtzer 1 Guide 1 Guides 1 HTML 1 Hardware Requirements 1 Homelab 1 Hygge 1 IBM 1 IDE 1 IQ 1 ISIS 1 ISS 1 IT 1 IT history 1 Intelligent email 1 Internet Browser 1 Internet browser 1 InternetEducation 1 Interview 1 Islam 1 Islamic State 1 Jacquard 1 Japan 1 Jboss 1 Kali Linux 1 Kernel 1 Khan Academy 1 Kylian Mbappé 1 LLM Deployment 1 Labor Market 1 Legal regulations 1 LibreOffice 1 Linux diagnostics 1 Londoners 1 MLX 1 Maps 1 MarGib_Film 1 Marek Jankowski 1 Mars helicopter 1 Material Design 1 Medicine 1 Microsoft 365 1 Military 1 Mindfulness 1 Miłosz Brzeziński 1 My take 1 Mythos 1 NTFS 1 NVIDIA 1 National security 1 Netflix 1 Neural Networks 1 New 1 No comment 1 Non-profit 1 Notion 1 Nvidia 1 Odysseus 1 Opera Air 1 Opera Neon 1 Opera Touch 1 P2P 1 Pac-Man 1 Pekao S.A 1 Peperclips 1 Perceptron 1 Personal development 1 Philosophy 1 Photoshop 1 Poland 1 Poles 1 PowerShell 1 Project TANGO 1 Proton Drive 1 PyTorch 1 Qt Creator 1 Quotes 1 RHEL8 1 Raspberry PI 1 Raspbian 1 Red Hat 8 1 Red Hat Enterprise Linux Developer Suite 1 RedHat 8 1 Regex 1 Robo-advisors 1 Rocky Linux 1 Rust 1 SUSE 1 SafeInternet 1 SaferInternetDay 1 Safety 1 Search 1 Security Auditing 1 Self-hosting 1 September 23 2017 1 Server Administration 1 Smart City 1 Snip. 1 Social Media 1 Soli 1 Solo Projects 1 Solopreneurship 1 Something from myself 1 Sound 1 Sovereign AI 1 Sport 1 Steam Deck 1 SysAdmin 1 System Administration 1 Tech 1 TensorFlow 1 The Shack 1 Time Management 1 Tips 1 Tokenomics 1 Tools 1 Tribler 1 Tutorial 1 U2 1 USB 1 Ubuntu 26.04 1 VentuSky 1 WBC 1 WSL 3 1 WWDC 2026 1 WWDC26 1 Warsaw 1 Weave 1 Websites 1 Windows update 1 Work 1 Workflow 1 World Cup 1 World Cup 2026 1 World Wide Web 1 X-Files 1 X-files 1 YouTube 1 ZUS 1 ZenFone 1 a drop of motivation 1 about this blog 1 achieving goals 1 ad blocking 1 addiction 1 administrator 1 aids 1 animations 1 assertiveness 1 audio 1 audio editing 1 automateit 1 autonomous cars 1 awareness 1 bank 1 bash on windows 1 bat files 1 batch 1 battery 1 beliefs 1 beta 1 better living 1 better quality 1 bin/bash 1 blocking 1 blogger 1 body language 1 bookmarks 1 boot 1 bootable usb 1 boxing 1 business intelligence 1 c# 1 calc 1 campaign 1 cards 1 centralized platforms 1 chemistry 1 clearance 1 clothing industry 1 cmd 1 code editor 1 cognitive psychology 1 coldplay 1 command history 1 command line 1 command prompt 1 comments 1 computer interaction 1 concentration 1 configuration management 1 conntrack 1 console 1 conspiracy 1 conspiracy theories 1 controversial 1 converter 1 corporate world 1 courses 1 courses for free 1 cyberattacks 1 dark mode 1 data security 1 date and time 1 deep learning 1 developer tools 1 digital clothing 1 disqus 1 document 1 dreams 1 drop of motivation 1 dubai 1 dying 1 e-book 1 eBPF 1 economy 1 end of the world 1 end of world 1 energy 1 environment and health 1 evolution 1 excel 1 exploitation 1 extreme 1 file sharing 1 file size 1 film zone 1 flash drive 1 flat earth 1 flying 1 food 1 football 1 for sale 1 format change 1 free 1 free software 1 friend location 1 future of transport 1 future of work 1 game 1 geoengineering 1 google chat 1 graphics 1 graphics editors 1 growing up 1 hacking 1 hard-link 1 hashing 1 helion 1 history 1 hobby 1 hostname 1 hostnamectl 1 how many people live on earth 1 humanity 1 humor 1 iOS 1 iftop 1 immortality 1 infrastructure 1 innovation 1 installation 1 intelligence 1 internet applications 1 investing 1 javascript 1 kuba wojewódzki 1 labor market 1 light 1 local AI 1 login 1 macOS 1 magic 1 make life harder 1 making money 1 material design 1 meditation 1 memory 1 messenger 1 meteorology 1 mindfulness 1 mobile applications 1 mobile photography 1 motivation 1 mounting 1 mp3 player 1 music 1 music player 1 mysteries 1 net use 1 nethogs 1 network monitoring 1 network resources 1 network security 1 networking 1 neuropsychology 1 new life 1 new player 1 new things 1 nftables 1 office 1 onestep4red 1 online 1 online courses 1 open source 1 open-source 1 operating systems 1 outage 1 paper clips 1 parenting 1 parents 1 password 1 password change 1 password recovery 1 pdf 1 penetration testing 1 performance 1 personal data 1 philosophy 1 php 1 plague 1 player 1 poison 1 police 1 predictions 1 promissory notes 1 protection 1 psychology 1 questions 1 radar 1 red 1 relax 1 relaxation 1 remote work 1 reportage 1 rest 1 robotaxi 1 root 1 science 1 scientific facts 1 screen 1 screenshot 1 series 1 show 1 skydive 1 sleep 1 small big company 1 smart clothing 1 smartphone 1 social engineering 1 social media 1 society 1 space 1 sport 1 sports 1 spreadsheet 1 stalking 1 statistics 1 sub-millimeter sensor 1 symbolic link 1 syngrapha 1 system acceleration 1 tablet 1 talk show 1 technological innovations 1 television 1 terrorism 1 testing 1 the world in numbers 1 threats 1 time management 1 time travel 1 timelapse 1 tips 1 ubuntu 1 upbringing 1 users 1 viral 1 virtualbox 1 walking 1 walking meetings 1 weather forecasting 1 webmaster 1 windows automation 1 word processing 1 work 1 world 1 world cup 2026 1 world wide web 1 you are a miracle 1 zeitgeist 1

Blog archive

Table of contents