betolj / ndpi-netfilter

GNU General Public License v2.0
126 stars 69 forks source link

upload traffic shapping with ndpi doesn't work #56

Open TaranehKhalili opened 6 years ago

TaranehKhalili commented 6 years ago

hi betolj. I want to shape traffics such as http_download or http. with your qos-ingress.sh script I could shape ingress(download) traffic. The problem is in egress traffic (upload).egress traffic doesn't go through the right class. can u help me with this?

elico commented 6 years ago

@taranehk share your setup details so we might be able to help you. We need both the iptables rules and also the tc rules.

faizatahir94 commented 6 years ago

@taranehk Can you share the qos-ingress.sh script?

kong156 commented 6 years ago

You can police your ingress traffic aka download an for sure you can shape your egress traffic aka upload. shapers and policers are different things...

TaranehKhalili commented 6 years ago

this is my POSTROUTING chain in mangle table which send packets to the test_qos chain:

target prot opt in out source destination test_qos all -- * enp0s3 0.0.0.0/0 0.0.0.0/0 mark match 0x0

this is test_qos chain:

target prot opt in out source destination
MARK all -- 0.0.0.0/0 0.0.0.0/0 mark match 0x0 MARK set 0x2710 RETURN all -- 0.0.0.0/0 0.0.0.0/0 mark match ! 0x2710 RETURN all -- 0.0.0.0/0 0.0.0.0/0 ! connbytes 10 connbytes mode packets connbytes direction both CONNMARK all -- 0.0.0.0/0 0.0.0.0/0 CONNMARK restore MARK all -- 0.0.0.0/0 0.0.0.0/0 protocol HTTP mark match 0x0 MARK set 0x2 CONNMARK all -- 0.0.0.0/0 0.0.0.0/0 mark match ! 0x2710 CONNMARK save

this is classes of tc on interface enp0s3:

+---(1:1) htb rate 100Mbit ceil 100Mbit burst 1600b cburst 1600b +---(1:2) htb rate 100Kbit ceil 100Kbit burst 1600b cburst 1600b +---(1:4) htb prio 1 rate 100Kbit ceil 100Kbit burst 1600b cburst 1600b

this is filters of the above classes:

filter parent 1: protocol ip pref 1 fw filter parent 1: protocol ip pref 1 fw handle 0x2 classid 1:4

Shaping for ingress is work correctly but for egress traffic it doesn't work.