Hi! I’ve just bought a GL-MT1300 in order to do packet shaping on our Internet connection. But it doesn’t work, because most of the traffic that should go through the br-wan bridge isn’t counted in traffic stats, and so no packet-shaping occurs. In addition, if I use tcpdump to examine the traffic on br-wan, some packets that go through the MT1300 show up, but most don’t. Despite this, network traffic flows normally across the MT1300. Connectivity is fine; it’s just that I can’t do packet shaping, which is what I bought the device to do.
The MT1300 sits between the ADSL router and the Lan – no machine, including our wireless access point, can access the Internet without going through the MT1300. The ADSL router is on 192.168.1.1, all client machines are on 192.168.0.x/24, and the MT1300 is the gateway between them, with its Wan port on 192.168.1.4 and its Lan port (middle socket) on 192.168.0.3. Pardon my terrible drawing skills!
My desktop PC has only one route to the ADSL router:
[msl@localhost ~]$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.0.3 0.0.0.0 UG 100 0 0 enp9s0
192.168.0.0 0.0.0.0 255.255.255.0 U 100 0 0 enp9s0
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
[msl@localhost ~]$ traceroute -In 192.168.1.1
traceroute to 192.168.1.1 (192.168.1.1), 30 hops max, 60 byte packets
1 192.168.0.3 0.964 ms 1.130 ms 1.332 ms
2 192.168.1.1 2.083 ms 2.278 ms 2.475 ms
[msl@localhost ~]$
On the MT1300, I have these bridges, which were preconfigured when I bought the device:
root@GL-MT1300:~# brctl show
bridge name bridge id STP enabled interfaces
br-guest 7fff.000000000000 no
br-lan 7fff.9483c40da929 no eth0.1
br-wan 7fff.9483c40da928 no eth0.2
root@GL-MT1300:~#
The MT1300’s routing table looks like this – note, the only path to the ADSL router on 192.168.1.1 is through the br-wan bridge:
root@GL-MT1300:~# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 br-wan
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 br-lan
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 br-wan
192.168.9.0 0.0.0.0 255.255.255.0 U 0 0 0 br-guest
root@GL-MT1300:~#
There’s also a vlan on eth0. I confess that I know almost nothing about vlans. Again, this was preconfigured when I bought the device.
root@GL-MT1300:~# ip -d link show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN mode DEFAULT group default qlen 1000
link/ether 94:83:c4:0d:a9:28 brd ff:ff:ff:ff:ff:ff promiscuity 3 addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
root@GL-MT1300:~# ip -d link show eth0.1
14: eth0.1@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-lan state UP mode DEFAULT group default qlen 1000
link/ether 94:83:c4:0d:a9:29 brd ff:ff:ff:ff:ff:ff promiscuity 1
vlan protocol 802.1Q id 1 <REORDER_HDR>
bridge_slave state forwarding priority 32 cost 100 hairpin off guard off root_block off fastleave off learning on flood on port_id 0x8001 port_no 0x1 designated_port 32769 designated_cost 0 designated_bridge 7fff.94:83:C4:0D:A9:29 designated_root 7fff.94:83:C4:0D:A9:29 hold_timer 0.00 message_age_timer 0.00 forward_delay_timer 0.00 topology_change_ack 0 config_pending 0 proxy_arp off proxy_arp_wifi off mcast_router 1 mcast_fast_leave off mcast_flood on neigh_suppress off vlan_tunnel off addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
root@GL-MT1300:~# ip -d link show eth0.2
16: eth0.2@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-wan state UP mode DEFAULT group default qlen 1000
link/ether 94:83:c4:0d:a9:28 brd ff:ff:ff:ff:ff:ff promiscuity 1
vlan protocol 802.1Q id 2 <REORDER_HDR>
bridge_slave state forwarding priority 32 cost 100 hairpin off guard off root_block off fastleave off learning on flood on port_id 0x8001 port_no 0x1 designated_port 32769 designated_cost 0 designated_bridge 7fff.94:83:C4:0D:A9:28 designated_root 7fff.94:83:C4:0D:A9:28 hold_timer 0.00 message_age_timer 0.00 forward_delay_timer 0.00 topology_change_ack 0 config_pending 0 proxy_arp off proxy_arp_wifi off mcast_router 1 mcast_fast_leave off mcast_flood on neigh_suppress off vlan_tunnel off addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
root@GL-MT1300:~#
Here’s a demonstration of the problem. I list the traffic stats on all interfaces; I email myself an incompressible 4MiB file using SMTP; I wait for my desktop computer to stop sending data, and then leave an extra few seconds for the MT1300 to send the last few packets to the ADSL router; and then I list the traffic stats again. Here are the stats before the transfer; for brevity, I’ve removed stats for ifb0, ifb1, teql0, ra0 and br-guest, which are all zero.
root@GL-MT1300:~# ip -s a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
RX: bytes packets errors dropped overrun mcast
4641 46 0 0 0 0
TX: bytes packets errors dropped carrier collsns
4641 46 0 0 0 0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000
link/ether 94:83:c4:0d:a9:28 brd ff:ff:ff:ff:ff:ff
inet6 fe80::9683:c4ff:fe0d:a928/64 scope link
valid_lft forever preferred_lft forever
RX: bytes packets errors dropped overrun mcast
45615662 86789 0 21 0 0
TX: bytes packets errors dropped carrier collsns
46698563 77590 0 0 0 0
13: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 94:83:c4:0d:a9:29 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.3/24 brd 192.168.0.255 scope global br-lan
valid_lft forever preferred_lft forever
RX: bytes packets errors dropped overrun mcast
2436457 25421 0 2631 0 5778
TX: bytes packets errors dropped carrier collsns
3940709 15090 0 0 0 0
14: eth0.1@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-lan state UP group default qlen 1000
link/ether 94:83:c4:0d:a9:29 brd ff:ff:ff:ff:ff:ff
RX: bytes packets errors dropped overrun mcast
2450851 25715 0 79 0 5859
TX: bytes packets errors dropped carrier collsns
3940709 15090 0 0 0 0
15: br-wan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 94:83:c4:0d:a9:28 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.4/24 brd 192.168.1.255 scope global br-wan
valid_lft forever preferred_lft forever
RX: bytes packets errors dropped overrun mcast
1473416 7241 0 0 0 80
TX: bytes packets errors dropped carrier collsns
1185804 8015 0 0 0 0
16: eth0.2@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-wan state UP group default qlen 1000
link/ether 94:83:c4:0d:a9:28 brd ff:ff:ff:ff:ff:ff
RX: bytes packets errors dropped overrun mcast
1473416 7241 0 0 0 80
TX: bytes packets errors dropped carrier collsns
1185804 8015 0 0 0 0
root@GL-MT1300:~#
Here are the stats after the transfer:
root@GL-MT1300:~# ip -s a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
RX: bytes packets errors dropped overrun mcast
4641 46 0 0 0 0
TX: bytes packets errors dropped carrier collsns
4641 46 0 0 0 0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000
link/ether 94:83:c4:0d:a9:28 brd ff:ff:ff:ff:ff:ff
inet6 fe80::9683:c4ff:fe0d:a928/64 scope link
valid_lft forever preferred_lft forever
RX: bytes packets errors dropped overrun mcast
51946640 93912 0 21 0 0
TX: bytes packets errors dropped carrier collsns
53054822 84599 0 0 0 0
13: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 94:83:c4:0d:a9:29 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.3/24 brd 192.168.0.255 scope global br-lan
valid_lft forever preferred_lft forever
RX: bytes packets errors dropped overrun mcast
2456376 25720 0 2667 0 5844
TX: bytes packets errors dropped carrier collsns
3962172 15266 0 0 0 0
14: eth0.1@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-lan state UP group default qlen 1000
link/ether 94:83:c4:0d:a9:29 brd ff:ff:ff:ff:ff:ff
RX: bytes packets errors dropped overrun mcast
2471092 26021 0 80 0 5926
TX: bytes packets errors dropped carrier collsns
3962172 15266 0 0 0 0
15: br-wan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 94:83:c4:0d:a9:28 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.4/24 brd 192.168.1.255 scope global br-wan
valid_lft forever preferred_lft forever
RX: bytes packets errors dropped overrun mcast
1479256 7303 0 0 0 80
TX: bytes packets errors dropped carrier collsns
1192931 8093 0 0 0 0
16: eth0.2@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-wan state UP group default qlen 1000
link/ether 94:83:c4:0d:a9:28 brd ff:ff:ff:ff:ff:ff
RX: bytes packets errors dropped overrun mcast
1479256 7303 0 0 0 80
TX: bytes packets errors dropped carrier collsns
1192931 8093 0 0 0 0
root@GL-MT1300:~#
You can see that the byte-counts for br-wan are 1185804 before and 1192931 after. So br-wan claims to have sent only 7,127 bytes while the 4MiB file was being emailed. The byte-counts for the underlying interface, eth0.2, are identical.
Eth0 claims to have sent 6,356,259 byes, which is about what I’d expect when emailing a 4MiB file. But the TX count goes up by a similar amount when I download the big file I’ve just emailed myself. That makes it useless for packet-shaping – I only want to control data going out to the Internet.
Unsurprisingly, when I attempt packet-shaping on br-wan, nothing useful happens. The traffic still flows out to the ADSL router at full speed, and we get buffer bloat that slows down interactive use. Enabling OpenWrt’s SQM doesn’t help, either, because the traffic stats are (wrongly) so low than no shaping occurs.
In contrast, when I pipe data directly into and out of the MT1300 using socat, both on the Wan side and on the Lan side, the byte counts on br-lan and br-wan increase as you’d expect. But, if I place a laptop on the Wan side and use socat to piipe data from the Lan side to the Wan side, using the MT1300 as a gateway, the MT1300’s traffoc stats don’t increase. So the problem seems to be restricted to times when the MT1300 is used as a gateway, and not to all network traffic flowing into and out of the device.
How can I make Linx report accurate traffic stats and use them in packet-shaping when the MT1300 is routing?