# Comcast — Simulate Bad Network Conditions for Testing > Comcast is a CLI tool that simulates degraded network conditions such as latency, bandwidth throttling, packet loss, and jitter. It helps developers test how their applications behave under realistic adverse network scenarios. ## Install Save in your project root: # Comcast — Simulate Bad Network Conditions for Testing ## Quick Use ```bash # Install go install github.com/tylertreat/comcast@latest # Add 250ms latency and 10% packet loss sudo comcast --device=eth0 --latency=250 --packet-loss=10% # Remove all traffic shaping sudo comcast --device=eth0 --stop ``` ## Introduction Comcast is a lightweight command-line tool for simulating poor network conditions on your local machine. Named after the notoriously unreliable ISP experience, it lets developers inject latency, throttle bandwidth, drop packets, and add jitter to any network interface. This makes it straightforward to verify application resilience before deploying to production. ## What Comcast Does - Injects configurable latency (in milliseconds) on outgoing network traffic - Throttles bandwidth to a specified rate in kbps for upload and download - Simulates packet loss at a configurable percentage - Adds jitter to create variable latency that mimics real-world networks - Targets specific ports, protocols, or IP ranges for focused testing ## Architecture Overview Comcast wraps platform-native traffic control utilities to apply network rules. On Linux it uses `tc` (traffic control) and `iptables`, on macOS it uses `ipfw` or `pfctl`, and on Windows it uses the built-in packet scheduling. The tool builds the appropriate system commands based on the user-specified parameters and applies them to the chosen network interface. ## Self-Hosting & Configuration - Install via `go install` or download a prebuilt binary from the GitHub releases page - Requires root or administrator privileges to modify network interface settings - Specify the network device with `--device` (e.g., eth0, en0, Wi-Fi) - Target specific traffic with `--target-addr`, `--target-port`, and `--target-proto` flags - Remove all applied rules with `--stop` to restore normal network behavior ## Key Features - Cross-platform support for Linux, macOS, and Windows - Fine-grained control over latency, bandwidth, packet loss, and jitter independently - Port and protocol targeting to isolate specific service traffic - Stateless operation with no daemon or background process required - Simple one-command interface with no configuration files needed ## Comparison with Similar Tools - **tc (Linux)** — Comcast wraps tc with a friendlier interface and cross-platform support - **Toxiproxy** — Toxiproxy operates as a TCP proxy between client and server; Comcast works at the network interface level - **Clumsy (Windows)** — GUI-based Windows tool; Comcast offers CLI automation across all platforms - **netem** — Comcast uses netem under the hood on Linux but adds simpler command-line ergonomics - **Pumba** — Pumba targets Docker containers specifically; Comcast shapes traffic system-wide ## FAQ **Q: Does Comcast require a special network setup?** A: No. It uses built-in OS networking tools (tc/iptables on Linux, pfctl on macOS) and only needs root access. **Q: Can I target traffic to a specific service?** A: Yes. Use `--target-port` and `--target-addr` flags to limit shaping to traffic headed for a particular IP and port. **Q: Will Comcast affect all traffic on my machine?** A: By default it shapes all traffic on the specified device. Use targeting flags to narrow the scope to specific destinations. **Q: How do I undo all changes?** A: Run `sudo comcast --device=eth0 --stop` to remove all traffic shaping rules and restore normal behavior. ## Sources - https://github.com/tylertreat/comcast - https://github.com/tylertreat/comcast#readme --- Source: https://tokrepo.com/en/workflows/asset-ab2d5558 Author: AI Open Source