tc: Linux HTTP Outgoing Traffic Shaping (Port 80 Traffic Shaping)

You can use tc to shape the outgoing HTTP traffic (i.e., port 80) on a Linux machine. Here is an example of how to do it:

  1. Identify the network interface that is connected to the internet. You can use the ifconfig command to get a list of all network interfaces and their IP addresses.
  2. Create a traffic shaping class for HTTP traffic. In this example, we will use class ID 1:10 for HTTP traffic:
    sudo tc qdisc add dev <interface> root handle 1: htb
    sudo tc class add dev <interface> parent 1: classid 1:10 htb rate 1mbit

    Replace <interface> with the name of the network interface that you identified in step 1.

  3. Create a filter to match HTTP traffic (i.e., traffic on port 80) and attach it to the traffic shaping class:
    sudo tc filter add dev <interface> protocol ip parent 1:0 prio 1 u32 match ip protocol 6 0xff match ip dport 80 0xffff flowid 1:10

    This filter matches only outgoing TCP traffic with a destination port of 80 and attaches it to the traffic shaping class that we created in step 2.

  4. Verify the configuration by running the following command:
    sudo tc -s qdisc show dev <interface>

    This will show the current traffic shaping configuration for the specified interface. You should see a htb qdisc with class 1:10 attached to it.

This configuration limits the outgoing HTTP traffic to 1 Mbit/s. You can adjust the rate to suit your needs. (Clonazepam)

Leave a Comment