<p dir="ltr">Traditionally this is correct. However now uplink and downlink are possible with Cake. A more advanced fq_codel. You can find it on bufferbloat from Dave Taht. You'll also need his iproute2 to recognize that qdisc. Pretty easy to compilie it in openwrt and have fun with it.<br>
Thanks,</p>
<p dir="ltr">Reinoud.</p>
<div class="gmail_quote">On May 25, 2016 9:04 PM, "Danng" <<a href="mailto:huynhminhdang@gmail.com">huynhminhdang@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hello,<br><br>I am trying to use qos-scripts in OpenWRT AA. I have an issue that the qos-scripts can limit uplink speed but not downlink speed.<br><br>For example: I set 128kbit uplink and 1024kbit downlink, however, the downlink is limitless<br><br>This is the speedtest I captured<br><br><a href="http://speedof.me/show.php?img=160526022701-7038.png" target="_blank">http://speedof.me/show.php?img=160526022701-7038.png</a><br><br>- uplink can go up to 104kbps<span> </span><br>- downlink can go up to 7861kbps (which is higher than the limitation I set)<br><br>---<br><br>I also tried with wshaper and the got same result.<br><br>Here is my setup:<br>- eth1 is the WAN port<br>- eth0 is connect to my PC<br>- OpenWRT AA<br>- Linux kernel 3.3.8</div><div><br><pre style="padding:0.5rem;border-radius:4px;margin-top:0.5rem;margin-bottom:0.2rem;word-break:normal;word-wrap:break-word;border:1px solid rgba(0,0,0,0.14902);background-image:initial;background-color:rgb(251,250,248);background-position:initial;background-repeat:initial"><font color="#333333" face="monaco, menlo, consolas, courier new, monospace"><span style="line-height:18.4px;white-space:pre-wrap">****************************************************************************
* cmd: cat /etc/config/qos
****************************************************************************
# QoS configuration for OpenWrt
# INTERFACES:
config interface wan
option classgroup "Default"
option enabled 1
option upload 128
option download 1024
# RULES:
config classify
option target "Priority"
option ports "22,53"
option comment "ssh, dns"
config classify
option target "Normal"
option proto "tcp"
option ports "20,21,25,80,110,443,993,995"
option comment "ftp, smtp, http(s), imap"
config classify
option target "Express"
option ports "5190"
option comment "AOL, iChat, ICQ"
config default
option target "Express"
option proto "udp"
option pktsize "-500"
config reclassify
option target "Priority"
option proto "icmp"
config default
option target "Bulk"
option portrange "1024-65535"
# Don't change the stuff below unless you
# really know what it means :)
config classgroup "Default"
option classes "Priority Express Normal Bulk"
option default "Normal"
config class "Priority"
option packetsize 400
option avgrate 10
option priority 20
config class "Priority_down"
option packetsize 1000
option avgrate 10
config class "Express"
option packetsize 1000
option avgrate 50
option priority 10
config class "Normal"
option packetsize 1500
option packetdelay 100
option avgrate 10
option priority 5
config class "Normal_down"
option avgrate 20
config class "Bulk"
option avgrate 1
option packetdelay 200
****************************************************************************
* cmd: /usr/lib/qos/generate.sh all
****************************************************************************
| insmod cls_u32 >&- 2>&-
| insmod em_u32 >&- 2>&-
| insmod act_connmark >&- 2>&-
| insmod act_mirred >&- 2>&-
| insmod sch_ingress >&- 2>&-
| insmod cls_fw >&- 2>&-
| insmod sch_hfsc >&- 2>&-
| insmod sch_fq_codel >&- 2>&-
| ifconfig eth1 up txqueuelen 5 >&- 2>&-
| tc qdisc del dev eth1 root >&- 2>&-
| tc qdisc add dev eth1 root handle 1: hfsc default 30
| tc class add dev eth1 parent 1: classid 1:1 hfsc sc rate 128kbit ul rate 128kbit
| tc class add dev eth1 parent 1:1 classid 1:10 hfsc rt m1 74kbit d 6103us m2 12kbit ls m1 74kbit d 6103us m2 71kbit ul rate 128kbit
| tc class add dev eth1 parent 1:1 classid 1:20 hfsc rt m1 68kbit d 15258us m2 64kbit ls m1 68kbit d 15258us m2 35kbit ul rate 128kbit
| tc class add dev eth1 parent 1:1 classid 1:30 hfsc ls m1 0kbit d 100000us m2 17kbit ul rate 128kbit
| tc class add dev eth1 parent 1:1 classid 1:40 hfsc ls m1 0kbit d 200000us m2 3kbit ul rate 128kbit
| tc qdisc add dev eth1 parent 1:10 handle 100: fq_codel
| tc qdisc add dev eth1 parent 1:20 handle 200: fq_codel
| tc qdisc add dev eth1 parent 1:30 handle 300: fq_codel
| tc qdisc add dev eth1 parent 1:40 handle 400: fq_codel
| tc filter add dev eth1 parent 1: prio 1 protocol ip handle 1/0xff fw flowid 1:10
| tc filter add dev eth1 parent 1: prio 2 protocol ip handle 2/0xff fw flowid 1:20
| tc filter add dev eth1 parent 1: prio 3 protocol ip handle 3/0xff fw flowid 1:30
| tc filter add dev eth1 parent 1: prio 4 protocol ip handle 4/0xff fw flowid 1:40
| ifconfig ifb0 up txqueuelen 5 >&- 2>&-
| tc qdisc del dev ifb0 root >&- 2>&-
| tc qdisc add dev ifb0 root handle 1: hfsc default 30
| tc class add dev ifb0 parent 1: classid 1:1 hfsc sc rate 1024kbit ul rate 1024kbit
| tc qdisc del dev eth1 ingress >&- 2>&-
| tc qdisc add dev eth1 ingress
| tc filter add dev eth1 parent ffff: protocol ip prio 1 u32 match u32 0 0 flowid 1:1 action connmark action mirred egress redirect dev ifb0
| tc class add dev ifb0 parent 1:1 classid 1:10 hfsc rt m1 232kbit d 1907us m2 102kbit ls m1 232kbit d 1907us m2 568kbit ul rate 1024kbit
| tc class add dev ifb0 parent 1:1 classid 1:20 hfsc rt m1 533kbit d 1907us m2 512kbit ls m1 533kbit d 1907us m2 284kbit ul rate 1024kbit
| tc class add dev ifb0 parent 1:1 classid 1:30 hfsc ls m1 0kbit d 100000us m2 142kbit ul rate 1024kbit
| tc class add dev ifb0 parent 1:1 classid 1:40 hfsc ls m1 0kbit d 200000us m2 28kbit ul rate 1024kbit
| tc qdisc add dev ifb0 parent 1:10 handle 100: fq_codel
| tc qdisc add dev ifb0 parent 1:20 handle 200: fq_codel
| tc qdisc add dev ifb0 parent 1:30 handle 300: fq_codel
| tc qdisc add dev ifb0 parent 1:40 handle 400: fq_codel
| tc filter add dev ifb0 parent 1: prio 1 protocol ip handle 1/0xff fw flowid 1:10
| tc filter add dev ifb0 parent 1: prio 2 protocol ip handle 2/0xff fw flowid 1:20
| tc filter add dev ifb0 parent 1: prio 3 protocol ip handle 3/0xff fw flowid 1:30
| tc filter add dev ifb0 parent 1: prio 4 protocol ip handle 4/0xff fw flowid 1:40
|
|
|
| iptables -t mangle -F qos_Default
| iptables -t mangle -F qos_Default_ct
| iptables -t mangle -D FORWARD -o eth1 -j qos_Default
| iptables -t mangle -D OUTPUT -o eth1 -j qos_Default
| iptables -t mangle -X qos_Default
| iptables -t mangle -X qos_Default_ct
| insmod ipt_multiport >&- 2>&-
| insmod ipt_CONNMARK >&- 2>&-
| insmod ipt_length >&- 2>&-
| iptables -t mangle -N qos_Default >&- 2>&-
| iptables -t mangle -N qos_Default_ct >&- 2>&-
| iptables -t mangle -A qos_Default_ct -m mark --mark 0/0xff -m tcp -p tcp -m multiport --ports 22,53 -j MARK --set-mark 1/0xff
| iptables -t mangle -A qos_Default_ct -m mark --mark 0/0xff -p udp -m udp -m multiport --ports 22,53 -j MARK --set-mark 1/0xff
| iptables -t mangle -A qos_Default_ct -m mark --mark 0/0xff -p tcp -m tcp -m multiport --ports 20,21,25,80,110,443,993,995 -j MARK --set-mark 3/0xff
| iptables -t mangle -A qos_Default_ct -m mark --mark 0/0xff -m tcp -p tcp -m multiport --ports 5190 -j MARK --set-mark 2/0xff
| iptables -t mangle -A qos_Default_ct -m mark --mark 0/0xff -p udp -m udp -m multiport --ports 5190 -j MARK --set-mark 2/0xff
| iptables -t mangle -A qos_Default_ct -j CONNMARK --save-mark --mask 0xff
| iptables -t mangle -A qos_Default -j CONNMARK --restore-mark --mask 0xff
| iptables -t mangle -A qos_Default -m mark --mark 0/0xff -j qos_Default_ct
| iptables -t mangle -A qos_Default -m mark --mark 0/0xff -p udp -m length --length :500 -j MARK --set-mark 2/0xff
| iptables -t mangle -A qos_Default -p icmp -j MARK --set-mark 1/0xff
| iptables -t mangle -A qos_Default -m mark --mark 0/0xff -m tcp -p tcp --sport 1024:65535 --dport 1024:65535 -j MARK --set-mark 4/0xff
| iptables -t mangle -A qos_Default -m mark --mark 0/0xff -p udp -m udp --sport 1024:65535 --dport 1024:65535 -j MARK --set-mark 4/0xff
| iptables -t mangle -A OUTPUT -o eth1 -j qos_Default
| iptables -t mangle -A FORWARD -o eth1 -j qos_Default
\---------------------------------------------------------------------------
****************************************************************************
* cmd: iptables -L
****************************************************************************
| Chain INPUT (policy ACCEPT)
| target prot opt source destination
| ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
| ACCEPT all -- anywhere anywhere
| syn_flood tcp -- anywhere anywhere tcp flags:FIN,SYN,RST,ACK/SYN
| input_rule all -- anywhere anywhere
| input all -- anywhere anywhere
|
| Chain FORWARD (policy DROP)
| target prot opt source destination
| ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
| forwarding_rule all -- anywhere anywhere
| forward all -- anywhere anywhere
| reject all -- anywhere anywhere
|
| Chain OUTPUT (policy ACCEPT)
| target prot opt source destination
| ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
| ACCEPT all -- anywhere anywhere
| output_rule all -- anywhere anywhere
| output all -- anywhere anywhere
|
| Chain MINIUPNPD (1 references)
| target prot opt source destination
|
| Chain forward (1 references)
| target prot opt source destination
| zone_lan_forward all -- anywhere anywhere
| zone_wan_forward all -- anywhere anywhere
|
| Chain forwarding_lan (1 references)
| target prot opt source destination
|
| Chain forwarding_rule (1 references)
| target prot opt source destination
|
| Chain forwarding_wan (1 references)
| target prot opt source destination
|
| Chain input (1 references)
| target prot opt source destination
| zone_lan all -- anywhere anywhere
| zone_wan all -- anywhere anywhere
|
| Chain input_lan (1 references)
| target prot opt source destination
|
| Chain input_rule (1 references)
| target prot opt source destination
|
| Chain input_wan (1 references)
| target prot opt source destination
|
| Chain output (1 references)
| target prot opt source destination
| zone_lan_ACCEPT all -- anywhere anywhere
| zone_wan_ACCEPT all -- anywhere anywhere
|
| Chain output_rule (1 references)
| target prot opt source destination
|
| Chain reject (5 references)
| target prot opt source destination
| REJECT tcp -- anywhere anywhere reject-with tcp-reset
| REJECT all -- anywhere anywhere reject-with icmp-port-unreachable
|
| Chain syn_flood (1 references)
| target prot opt source destination
| RETURN tcp -- anywhere anywhere tcp flags:FIN,SYN,RST,ACK/SYN limit: avg 25/sec burst 50
| DROP all -- anywhere anywhere
|
| Chain zone_lan (1 references)
| target prot opt source destination
| input_lan all -- anywhere anywhere
| zone_lan_ACCEPT all -- anywhere anywhere
|
| Chain zone_lan_ACCEPT (2 references)
| target prot opt source destination
| ACCEPT all -- anywhere anywhere
| ACCEPT all -- anywhere anywhere
|
| Chain zone_lan_DROP (0 references)
| target prot opt source destination
| DROP all -- anywhere anywhere
| DROP all -- anywhere anywhere
|
| Chain zone_lan_REJECT (1 references)
| target prot opt source destination
| reject all -- anywhere anywhere
| reject all -- anywhere anywhere
|
| Chain zone_lan_forward (1 references)
| target prot opt source destination
| zone_wan_ACCEPT all -- anywhere anywhere
| forwarding_lan all -- anywhere anywhere
| zone_lan_REJECT all -- anywhere anywhere
|
| Chain zone_wan (1 references)
| target prot opt source destination
| ACCEPT udp -- anywhere anywhere udp dpt:bootpc
| ACCEPT icmp -- anywhere anywhere icmp echo-request
| input_wan all -- anywhere anywhere
| zone_wan_REJECT all -- anywhere anywhere
|
| Chain zone_wan_ACCEPT (2 references)
| target prot opt source destination
| ACCEPT all -- anywhere anywhere
| ACCEPT all -- anywhere anywhere
|
| Chain zone_wan_DROP (0 references)
| target prot opt source destination
| DROP all -- anywhere anywhere
| DROP all -- anywhere anywhere
|
| Chain zone_wan_REJECT (2 references)
| target prot opt source destination
| reject all -- anywhere anywhere
| reject all -- anywhere anywhere
|
| Chain zone_wan_forward (1 references)
| target prot opt source destination
| MINIUPNPD all -- anywhere anywhere
| forwarding_wan all -- anywhere anywhere
| zone_wan_REJECT all -- anywhere anywhere
\---------------------------------------------------------------------------
****************************************************************************
* cmd: iptables -t nat -L
****************************************************************************
| Chain PREROUTING (policy ACCEPT)
| target prot opt source destination
| prerouting_rule all -- anywhere anywhere
| zone_lan_prerouting all -- anywhere anywhere
| zone_wan_prerouting all -- anywhere anywhere
|
| Chain INPUT (policy ACCEPT)
| target prot opt source destination
|
| Chain OUTPUT (policy ACCEPT)
| target prot opt source destination
|
| Chain POSTROUTING (policy ACCEPT)
| target prot opt source destination
| postrouting_rule all -- anywhere anywhere
| zone_lan_nat all -- anywhere anywhere
| zone_wan_nat all -- anywhere anywhere
|
| Chain MINIUPNPD (1 references)
| target prot opt source destination
|
| Chain postrouting_rule (1 references)
| target prot opt source destination
|
| Chain prerouting_lan (1 references)
| target prot opt source destination
|
| Chain prerouting_rule (1 references)
| target prot opt source destination
|
| Chain prerouting_wan (1 references)
| target prot opt source destination
|
| Chain zone_lan_nat (1 references)
| target prot opt source destination
|
| Chain zone_lan_prerouting (1 references)
| target prot opt source destination
| prerouting_lan all -- anywhere anywhere
|
| Chain zone_wan_nat (1 references)
| target prot opt source destination
| MASQUERADE all -- anywhere anywhere
|
| Chain zone_wan_prerouting (1 references)
| target prot opt source destination
| MINIUPNPD all -- anywhere anywhere
| prerouting_wan all -- anywhere anywhere
\---------------------------------------------------------------------------
****************************************************************************
* cmd: iptables -t mangle -L
****************************************************************************
| Chain PREROUTING (policy ACCEPT)
| target prot opt source destination
|
| Chain INPUT (policy ACCEPT)
| target prot opt source destination
|
| Chain FORWARD (policy ACCEPT)
| target prot opt source destination
| zone_wan_MSSFIX all -- anywhere anywhere
| qos_Default all -- anywhere anywhere
|
| Chain OUTPUT (policy ACCEPT)
| target prot opt source destination
| qos_Default all -- anywhere anywhere
|
| Chain POSTROUTING (policy ACCEPT)
| target prot opt source destination
|
| Chain qos_Default (2 references)
| target prot opt source destination
| CONNMARK all -- anywhere anywhere CONNMARK restore mask 0xff
| qos_Default_ct all -- anywhere anywhere mark match 0x0/0xff
| MARK udp -- anywhere anywhere mark match 0x0/0xff length 0:500 MARK xset 0x2/0xff
| MARK icmp -- anywhere anywhere MARK xset 0x1/0xff
| MARK tcp -- anywhere anywhere mark match 0x0/0xff tcp spts:1024:65535 dpts:1024:65535 MARK xset 0x4/0xff
| MARK udp -- anywhere anywhere mark match 0x0/0xff udp spts:1024:65535 dpts:1024:65535 MARK xset 0x4/0xff
|
| Chain qos_Default_ct (1 references)
| target prot opt source destination
| MARK tcp -- anywhere anywhere mark match 0x0/0xff tcp multiport ports ssh,domain MARK xset 0x1/0xff
| MARK udp -- anywhere anywhere mark match 0x0/0xff udp multiport ports ssh,domain MARK xset 0x1/0xff
| MARK tcp -- anywhere anywhere mark match 0x0/0xff tcp multiport ports ftp-data,ftp,smtp,www,pop3,https,imaps,pop3s MARK xset 0x3/0xff
| MARK tcp -- anywhere anywhere mark match 0x0/0xff tcp multiport ports 5190 MARK xset 0x2/0xff
| MARK udp -- anywhere anywhere mark match 0x0/0xff udp multiport ports 5190 MARK xset 0x2/0xff
| CONNMARK all -- anywhere anywhere CONNMARK save mask 0xff
|
| Chain zone_wan_MSSFIX (1 references)
| target prot opt source destination
| TCPMSS tcp -- anywhere anywhere tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU
\---------------------------------------------------------------------------
****************************************************************************
* cmd: tc -s qdisc show dev eth0
****************************************************************************
| qdisc pfifo_fast 0: root refcnt 2 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
| Sent 278256856 bytes 260097 pkt (dropped 0, overlimits 0 requeues 0)
| backlog 0b 0p requeues 0
\---------------------------------------------------------------------------
****************************************************************************
* cmd: tc -s qdisc show dev eth1
****************************************************************************
| qdisc hfsc 1: root refcnt 2 default 30
| Sent 1447188 bytes 7376 pkt (dropped 0, overlimits 12468 requeues 0)
| backlog 0b 0p requeues 0
| qdisc fq_codel 100: parent 1:10 limit 10240p flows 1024 quantum 1518 target 5.0ms interval 100.0ms ecn
| Sent 5000 bytes 55 pkt (dropped 0, overlimits 0 requeues 0)
| backlog 0b 0p requeues 0
| maxpacket 256 drop_overlimit 0 new_flow_count 27 ecn_mark 0
| new_flows_len 1 old_flows_len 0
| qdisc fq_codel 200: parent 1:20 limit 10240p flows 1024 quantum 1518 target 5.0ms interval 100.0ms ecn
| Sent 19246 bytes 145 pkt (dropped 0, overlimits 0 requeues 0)
| backlog 0b 0p requeues 0
| maxpacket 350 drop_overlimit 0 new_flow_count 80 ecn_mark 0
| new_flows_len 0 old_flows_len 2
| qdisc fq_codel 300: parent 1:30 limit 10240p flows 1024 quantum 1518 target 5.0ms interval 100.0ms ecn
| Sent 720529 bytes 2687 pkt (dropped 223, overlimits 0 requeues 0)
| backlog 0b 0p requeues 0
| maxpacket 1514 drop_overlimit 0 new_flow_count 750 ecn_mark 0
| new_flows_len 1 old_flows_len 5
| qdisc fq_codel 400: parent 1:40 limit 10240p flows 1024 quantum 1518 target 5.0ms interval 100.0ms ecn
| Sent 702413 bytes 4489 pkt (dropped 1461, overlimits 0 requeues 0)
| backlog 0b 0p requeues 0
| maxpacket 1514 drop_overlimit 0 new_flow_count 271 ecn_mark 0
| new_flows_len 0 old_flows_len 1
| qdisc ingress ffff: parent ffff:fff1 ----------------
| Sent 1639987 bytes 3843 pkt (dropped 0, overlimits 0 requeues 0)
| backlog 0b 0p requeues 0
\---------------------------------------------------------------------------
****************************************************************************
* cmd: tc -s qdisc show dev ifb0
****************************************************************************
| qdisc hfsc 1: root refcnt 2 default 30
| Sent 1391951 bytes 2762 pkt (dropped 0, overlimits 2001 requeues 0)
| backlog 0b 0p requeues 0
| qdisc fq_codel 100: parent 1:10 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms ecn
| Sent 4723 bytes 23 pkt (dropped 0, overlimits 0 requeues 0)
| backlog 0b 0p requeues 0
| maxpacket 299 drop_overlimit 0 new_flow_count 21 ecn_mark 0
| new_flows_len 1 old_flows_len 0
| qdisc fq_codel 200: parent 1:20 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms ecn
| Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
| backlog 0b 0p requeues 0
| maxpacket 256 drop_overlimit 0 new_flow_count 0 ecn_mark 0
| new_flows_len 0 old_flows_len 0
| qdisc fq_codel 300: parent 1:30 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms ecn
| Sent 1387228 bytes 2739 pkt (dropped 127, overlimits 0 requeues 0)
| backlog 0b 0p requeues 0
| maxpacket 1518 drop_overlimit 0 new_flow_count 1052 ecn_mark 0
| new_flows_len 1 old_flows_len 1
| qdisc fq_codel 400: parent 1:40 limit 10240p flows 1024 quantum 1514 target 5.0ms interval 100.0ms ecn
| Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
| backlog 0b 0p requeues 0
| maxpacket 256 drop_overlimit 0 new_flow_count 0 ecn_mark 0
| new_flows_len 0 old_flows_len 0
\---------------------------------------------------------------------------</span></font><span style="color:rgb(51,51,51);font-family:monaco,menlo,consolas,"courier new",monospace;font-size:0.75rem;line-height:1.15rem;white-space:pre-wrap">
</span></pre></div><br></div>
<br>_______________________________________________<br>
openwrt-devel mailing list<br>
<a href="mailto:openwrt-devel@lists.openwrt.org">openwrt-devel@lists.openwrt.org</a><br>
<a href="https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel" rel="noreferrer" target="_blank">https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel</a><br>
<br></blockquote></div>