0

I'm trying to slow down the traffic on my TCP forking proxy.

The code is no longer located on the proxy, I'm still testing on my laptop; all HTTP(S) requests on Chrome are redirected with SwitchyOmega plugin on a given port (so maybe I just need OUTPUT rules and not FORWARD).

Ookla speedtest I get 13.92 Mbps down/15.89 Mbps up while the max rate and ceil set is 256 and 316 Kbps.

I'm working on Ubuntu 14.04 x86_64. Since I have a HTTP proxy, the only ports I care about are 80 and 443 (I deal with HTTPS requests too):

# usage: sudo ./filename.sh {set|clean} interface

IF=$2
#delete existing rules
tc qdisc del root dev wlan0

iptables -t mangle -F

if [ "$1" = "clean" ]
then
    exit 0
fi

echo "Setting.."
# Turn on queuing discipline, enter:
tc qdisc add dev wlan0 root handle 1: htb
tc class add dev wlan0 parent 1: classid 1:1 htb rate 512kbps
# Define a class with limitations:
tc class add dev wlan0 parent 1:1 classid 1:5 htb rate 256kbps ceil 312kbps prio 1
# Define another class with limitations:
tc class add dev wlan0 parent 1:1 classid 1:6 htb rate 256kbps ceil 312kbps prio 0
# Assign it to appropriate qdisc:
tc filter add dev wlan0 parent 1:0 prio 1 protocol ip handle 5 fw flowid 1:5
# Assign it to appropriate qdisc:
tc filter add dev wlan0 parent 1:0 prio 0 protocol ip handle 6 fw flowid 1:6
# Port 80 is NOT defined anywhere in above class. You will use iptables mangle rule as follows:
iptables -A FORWARD -t mangle -p tcp --sport 80 -j MARK --set-mark 5
iptables -A OUTPUT -t mangle -p tcp --sport 80 -j MARK --set-mark 5
# Port 443 is NOT defined anywhere in above class. You will use iptables mangle rule as follows:
iptables -A FORWARD -t mangle -p tcp --sport 443 -j MARK --set-mark 6
iptables -A OUTPUT -t mangle -p tcp --sport 443 -j MARK --set-mark 6
iptables-save

It still goes too fast: what could be the matter?

Ajacmac
  • 116
  • 1
  • 1
  • 6
elmazzun
  • 153
  • 1
  • 2
  • 7
  • 1
    At first glance I would say that the traffic a web proxy generates would not **originate from** the HTTP/HTTPS (`--sport 80/443`) but have that as the **destination** port. – HBruijn Sep 06 '16 at 20:29
  • Set all my rules with `--dport`, still having a more than a decent speedtest. Maybe I should've said that the software I'm testing for my proxy is not on my proxy: I'm on my laptop, using Chrome with SwitchyOmega plugin, which lets me redirect traffic to a fixed port on which my proxy is binding, listening and accepting (a simple forking proxy). – elmazzun Sep 06 '16 at 20:46

0 Answers0