Saving Data: How to Shape & Limit Traffic in Ubuntu Linux and Windows: A Step-by-Step Guide

6 min read 1,192 words 0 views

How to Shape Traffic in Ubuntu Linux and Windows: A Step-by-Step Guide

Article Credit: dotifi.com

Network bandwidth management, commonly known as traffic shaping, allows you to allocate, throttle, and prioritize network speed across applications and devices. Whether you need to prevent background downloads from saturating your bandwidth, simulate slow network conditions, or cap usage at specific limits (like 355 Kbps), traffic shaping gives you total control over your network behavior.

Below is a guide on how to configure traffic limits in Ubuntu Linux using WonderShaper and Windows using NetLimiter, along with steps for interface identification, Git checking, troubleshooting, speed testing, and key network terms.

Part 1: Traffic Shaping in Ubuntu Linux (using WonderShaper)

WonderShaper is a lightweight bash script designed to set maximum upload and download speed limits on specific Linux network interfaces using kernel-level traffic control (tc).

Step 1: Identify Your Active Wi-Fi or Internet Connection Name

Before applying speed caps, you must know the exact system name of your network interface.

  1. Open your terminal (Ctrl + Alt + T).

  2. Run one of the following commands:

    Bash

    ip link show
    

    Or:

    Bash

    ip addr
    
  3. Look for your active network interface:

    • Wi-Fi interfaces typically begin with wlan0, wlp2s0, or wlp1s0.

    • Wired Ethernet interfaces typically begin with eth0, enp3s0, or eno1.

Step 2: Check if Git is Installed & Install WonderShaper

Checking Git Installation

Run:

Bash

git --version
  • If installed: The terminal displays the version number (e.g., git version 2.x.x).

  • If not installed: You can install Git by running:

    Bash

    sudo apt update && sudo apt install git -y
    

Installing WonderShaper

You can install WonderShaper directly via apt or clone the repository using Git for the latest updates.

Method A: APT Install (Quickest)

Bash

sudo apt update
sudo apt install wondershaper -y

Method B: Git Clone (Latest Version)

Bash

cd /usr/local/bin
sudo git clone https://github.com/magnific0/wondershaper.git
cd wondershaper
sudo make install

Step 3: Set Traffic Limits at 355 Kbps

WonderShaper measures speeds in kilobits per second (Kbps).

Assuming your interface name is wlp1s0 (replace wlp1s0 with your actual Wi-Fi or Ethernet name):

  • Set Download and Upload limits to 355 Kbps:

    Bash

    sudo wondershaper -a wlp1s0 -d 355 -u 355
    

    (Flags: -a specifies the interface, -d sets download rate in Kbps, and -u sets upload rate in Kbps.)

  • Check status of applied limits:

    Bash

    sudo wondershaper -sa wlp1s0
    
  • Clear/Reset traffic limits:

    Bash

    sudo wondershaper -ca wlp1s0
    

Step 4: Ubuntu Troubleshooting

Issue Cause Solution
command not found: wondershaper Binary is not in system PATH. Use /usr/bin/wondershaper or complete make install inside the cloned directory.
Operation not permitted Missing root permissions. Always execute WonderShaper with sudo.
Limits don’t seem to apply Wrong interface specified. Re-check active connection via ip addr to confirm correct adapter selection.

Part 2: Traffic Shaping in Windows (using NetLimiter)

NetLimiter is an internet traffic control and monitoring application designed for Windows that allows setting granular download and upload speed limits per application or per adapter.

Step 1: Download & Install NetLimiter

  1. Download NetLimiter from the official website (netlimiter.com).

  2. Run the executable installer (.exe) and complete the installation wizard.

  3. Restart your PC if prompted to complete driver installation.

Step 2: Identify Your Wi-Fi or Network Connection

  1. Open Settings > Network & Internet.

  2. Click Properties on your active Wi-Fi or Ethernet network to view its name (e.g., Wi-Fi 2, Ethernet 1).

  3. Alternatively, open NetLimiter; its Network Adapters tab lists all active connections and their assigned system interface names.

Step 3: Set Traffic Limits at 355 Kbps

  1. Launch NetLimiter.

  2. In the Activity window, locate either your Global / Adapter connection or a specific application (e.g., chrome.exe).

  3. Check the box under the DL Limit (Download Limit) or UL Limit (Upload Limit) column next to the entry.

  4. Right-click the limit value and select Edit Rule.

  5. Set the speed value to 355 and change the unit dropdown to KB/s or Kbps depending on requirement:

    • Note: 355 Kbps = ~44.37 KB/s.

  6. Click Save to enable real-time throttling.

Step 4: Windows Troubleshooting

  • Throttling is non-responsive: Ensure the main toggle switch (“Enable Traffic Control”) in the NetLimiter toolbar is switched ON.

  • Driver Conflict: If speeds fluctuate, open Windows Device Manager, expand Network Adapters, update drivers, or temporarily disable conflicting third-party VPN virtual adapters.

Part 3: How to Test Traffic Shaping

To confirm your 355 Kbps cap is actively functioning:

  1. Terminal Test (iperf3 / curl): Run a download stream in Linux:

    Bash

    curl -o /dev/null http://speedtest.tele2.net/10MB.zip
    

    Observe the transfer rate—it should stabilize near ~44 KB/s (~355 Kbps).

  2. Browser Test: Open any web speed test tool and run a check. The resulting graph should peak and flatten out directly at your configured threshold.

Part 4: 10 Alternatives to Fast.com for Speed Testing

While Netflix’s Fast.com provides quick download reads, these 10 platforms offer detailed network diagnostics, latency tracking, and multi-server benchmarking:

  1. Speedtest.net by Ookla – Comprehensive network speed test featuring global testing servers, historical log retention, and jitter metrics.

  2. Cloudflare Speed Test – Designed for gamers and real-time app testing; measures packet loss, jitter, and latency distributions.

  3. TestMy.net – Server-side HTML5 testing platform that doesn’t rely on third-party browser extensions.

  4. M-Lab (Measurement Lab) – Open-source speed test used directly inside Google search results.

  5. Opensignal – Mobile-first platform evaluating carrier coverage, Wi-Fi performance, and streaming quality.

  6. SpeedOf.Me – Lightweight HTML5 speed test that works seamlessly on desktop and mobile browsers.

  7. Xfinity Speed Test – Simple broadband speed test utility built by Comcast.

  8. Google Fiber Speedtest – Minimalist speed test measuring gigabit capability without heavy ads.

  9. nPerf – Speed test suite offering bitrate, video streaming stability, and web browsing assessments.

  10. DSLReports Speed Test – Advanced diagnostic utility that reports bufferbloat levels across multiple connection types.

Part 5: Key Network & Latency Terms Explained

Understanding traffic shaping requires clarity on how latency and queueing impact internet performance:

1. Latency (Ping)

Latency is the round-trip time (measured in milliseconds, ms) it takes for a data packet to travel from your device to a remote server and back. Lower numbers mean higher responsiveness.

2. Unloaded Latency

Unloaded Latency represents your network’s baseline response time when no other traffic is active on your connection. It reflects the raw speed of your ISP connection under ideal conditions.

3. Loaded Latency

Loaded Latency measures response times while heavy network transfers (e.g., a large file download or 4K video stream) are occurring simultaneously. If loaded latency jumps significantly higher than unloaded latency, online games will lag and video calls will freeze.

4. Bufferbloat

Bufferbloat occurs when routers queue excessive amounts of data packets in memory buffers instead of transmitting them efficiently. This creates high loaded latency and degrades real-time interactive traffic. Traffic shaping tools (like WonderShaper) eliminate bufferbloat by throttling saturation levels.

5. Jitter

Jitter measures the variability or fluctuation in network latency over time. Consistent 30ms latency is ideal, whereas latency swinging between 20ms and 250ms indicates high jitter and unstable packet delivery.

6. Bandwidth vs. Throughput

  • Bandwidth: The maximum theoretical capacity of your internet link (e.g., 100 Mbps).

  • Throughput: The actual volume of data successfully transmitted over the connection per second in real-world conditions.

Article Credit: dotifi.com