[Solved] Packet-shaping with a single network interface

I've just bought a GL.iNet MT1300 because I need to prioritise certain traffic on our slow ADSL link. I'm new to OpenWrt, to packet shaping, to vlans and to iptables (so please forgive my ignorance on certain points), but I've spent a solid six days learning hard and trying to make this work, going at it morning until night, and I've not managed it.

It looks to me as if the MT1300 has a single network interface, eth0, and a switch, and some vlans -- so the Lan side of the box uses vlan 1 and interface eth0.1 and the Wan side uses vlan 2 and interface eth0.2.

There are two relevant bridges, called br-lan and br-wan, but it's not clear to me whether traffic routed across the MT1300 goes across those bridges. If I squirt 60MB of data from the Lan side to the Wan side, the only interface whose traffic stats go up significantly, according to ip -s a, is eth0. (OTOH, if I disable br-wan, the 60MB transfer immediately fails. Maybe the traffic does use br-wan, but just isn't counted correctly.) All attempts at packet-shaping on br-wan have failed, because the amount of traffic seen by qdiscs on br-wan is negligible, even though the data is routed through the MT1300 correctly. I'm therefore trying to set up packet shaping on eth0. Let's set up an absolutely minimal example:

root@GL-MT1300:/etc/init.d# tc qdisc replace dev eth0 root handle 1: htb
root@GL-MT1300:/etc/init.d# tc -s qdisc show dev eth0
qdisc htb 1: root refcnt 2 r2q 10 default 0 direct_packets_stat 292 direct_qlen 1000
 Sent 42576 bytes 292 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
root@GL-MT1300:/etc/init.d# ip -s a show dev eth0 | grep -A1 TX
    TX: bytes  packets  errors  dropped carrier collsns 
    303022813  339757   0       0       0       0       
root@GL-MT1300:/etc/init.d# ip -s a show dev eth0 | grep -A1 TX
    TX: bytes  packets  errors  dropped carrier collsns 
    367168628  402196   0       0       0       0       
root@GL-MT1300:/etc/init.d# tc -s qdisc show dev eth0
qdisc htb 1: root refcnt 2 r2q 10 default 0 direct_packets_stat 687 direct_qlen 1000
 Sent 121678 bytes 689 pkt (dropped 0, overlimits 0 requeues 0) 
 backlog 0b 0p requeues 0
root@GL-MT1300:/etc/init.d#

Between the two ip -s a commands, I transferred 60MB from the Lan side to the Wan side. You can see it in ip -s a above, but the qdisc didn't see the data and therefore couldn't packet-shape it.

I notice that eth0 has rx-vlan-offload and tx-vlan-offload enabled. Disabling rx-vlan-offload (via ethtool -K) made the MT1300 unpingable -- I had to yank the power cable to get it back. Disabling tx-vlan-offload had no visible effect.

Is it actually possible to do packet-shaping with a single network interface, or do I need to send the MT1300 back to Amazon and buy something else?

A friend and I solved this together. The problem was that flow offloading was turned on by default when I bought the MT1300, and flow offloading is incompatible with QoS and SQM.

It's easy to turn off software offloading in LuCI: go to "Network: Firewall" and unset "Software flow unloading".

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.