choke - Linux


Overview

choke is a command-line tool for managing and throttling network bandwidth. It allows you to limit the amount of bandwidth consumed by specific processes or ports, effectively preventing bandwidth hogs from saturating your network.

Syntax

choke [options] <command> [arguments]

Options/Flags

  • -i, –iface: Network interface to monitor (default: all)
  • -p, –port: Port to limit (default: all)
  • -b, –bytes: Maximum number of bytes to allow per second (default: unlimited)
  • -s, –seconds: Period to check for bandwidth usage (default: 1)
  • -d, –debug: Print detailed debug information
  • -v, –version: Display version information

Examples

Limit the bandwidth for a specific process:

choke -b 1000000 -p 8080 nodejs myapp.js

Throttle all incoming traffic on a specific port:

choke -i eth0 -p 5000 -b 500000

Monitor and limit bandwidth usage for a range of ports:

choke -i wlp2s0 -p 22-25 -b 200000

Common Issues

  • Command not found: Ensure that choke is installed on your system.
  • Permission denied: Run choke with root privileges to modify network settings.

Integration

choke can be integrated with scripts and other tools to create advanced bandwidth management solutions.

# Example script to limit bandwidth for a specific IP address
#!/bin/bash

iface="eth0"
ip="192.168.1.100"
port="80"
bytes="1000000"

choke -i $iface -p $port -b $bytes -d | grep $ip

Related Commands

  • tc
  • iptables
  • netstat