Network Tuner Script
The Network Tuner script optimizes your network settings for high throughput by adjusting system buffer sizes and configuring the network interface for optimal performance.
Features
- Increases network buffer sizes for improved throughput
- Disables network offloading features that might limit performance
- Configures traffic control with Fair Queuing (FQ) for better flow management
- Simple to use with sensible defaults
Usage
./network-tuning-script.sh [interface]
If no interface is specified, eth1
will be used as the default.
Example
sudo ./network-tuning-script.sh eth0
This will optimize network settings for the eth0 interface.
Details
The script performs the following optimizations:
- Sets system-wide receive and send buffer maximums to 100MB
- Configures TCP buffer sizes for optimal throughput
- Disables TCP Segmentation Offload (TSO), Generic Segmentation Offload (GSO), Generic Receive Offload (GRO), and Large Receive Offload (LRO)
- Sets up Fair Queuing discipline with large flow limits
Traffic Shaper Script with Dual PI² Support
The Traffic Shaper script allows you to shape network traffic with asymmetric rate support and optional dual PI² queuing for improved latency under load.
Features
- Independent download and upload rate limiting
- Automatic burst size calculation based on RTT
- Support for dual PI² queuing discipline for better bufferbloat mitigation
- Option to disable PI² and use simple FIFO queuing instead
- Configures both eth1 (download) and eth2 (upload) interfaces
Usage
./traffic_shaper_dq.sh [DOWNLOAD_RATE] [UPLOAD_RATE] [RTT_MS] [DISABLE_DUALPI]
Parameters
Parameter | Description | Default |
---|---|---|
DOWNLOAD_RATE | Download bandwidth limit (e.g., 100Mbit) | 50Mbit |
UPLOAD_RATE | Upload bandwidth limit (e.g., 20Mbit) | Same as download rate |
RTT_MS | RTT in milliseconds for burst calculation | 20ms |
DISABLE_DUALPI | Set to 1 to disable dual PI² queuing | 0 (enabled) |
Example 1: Basic Configuration
sudo ./traffic_shaper_dq.sh 100Mbit 20Mbit
This sets download bandwidth to 100Mbit, upload to 20Mbit, with default 20ms RTT and dual PI² queuing enabled.
Example 2: High Latency Network
sudo ./traffic_shaper_dq.sh 50Mbit 10Mbit 100
For a high-latency network with 100ms RTT, this configures appropriate burst sizes automatically.
Example 3: Disable Dual PI² Queuing
sudo ./traffic_shaper_dq.sh 75Mbit 15Mbit 30 1
This disables the dual PI² queuing and uses FIFO queuing instead, with 30ms RTT.
Technical Details
The script performs the following operations:
- Calculates appropriate burst sizes based on bandwidth and RTT
- Disables network offloading features that might interfere with shaping
- Configures Hierarchical Token Bucket (HTB) queuing discipline
- Sets up traffic filtering for both IPv4 and IPv6
- Applies either dual PI² or FIFO queuing based on the configuration
Note: The dual PI² (Proportional Integral controller) queuing discipline is designed to minimize bufferbloat and maintain low latency even under load. It's particularly useful for interactive applications like gaming or video conferencing.
Download Traffic Shaper ScriptInstallation
To use these scripts, you need to:
- Download the scripts using the links above
- Make them executable with:
chmod +x script-name.sh
- Run them with sudo privileges as shown in the examples
Note: These scripts require root privileges to modify network settings. They are
designed for Linux systems with the tc
(traffic control) utility installed.
Requirements
- Linux operating system
- Root/sudo privileges
- iproute2 package (for tc command)
- ethtool package