Throttle bandwidth per IP/Mac?

So I've got the SQM QOS setup on my current network in order to combat bufferbloat and keep my internet running smooth. I've been searching absolutely everywhere online for a way to be able to further throttle internet towards certain devices.

I get 80 down / 12 up at my house and would like to throttle how much bandwidth my Xbox recieves to about 5 down and 2.5 up.

If anyone has any insight on how to do this, it would greatly be appreciated. Thank you

-Latest LEDE build on Linksys WRT-1900ACS

I don't have an answer to your question, but I'm curious about your request:

Why is it important to limit your Xbox to 5 mbps down and 2.5 mbps up? What do you plan to do with the "other" capacity? How could you tell whether the Xbox is "using more" than that?

SQM is really targeted at network management and not so much host-quota management. There have been similar requests on the development repo, and the core team has indicated they wish to keep a narrow focus on the project. There is some tuning with the CAKE qdisc that allows it to enforce host fairness rather than connection fairness. https://github.com/tohojo/sqm-scripts; and also https://github.com/dtaht/sch_cake/issues/46;

Yes, I'm quite familiar with the capabilities of SQM. My question to @Admir1387 is more to learn about situations that require per-IP or per-MAC throttling.

(I have a sense that people cannot believe that SQM does a good enough job, so they think they need to "do more work" to ensure good responsiveness... It's always my recommendation they try SQM alone, and see if they can tell whether it's doing a good job. If it is, they can go on to investigate more useful projects. And if it's not, then of course, look for alternatives that solve their problem.)

Previously, I also looked for the same thing and realize it could not: Want to optimize the bufferbloat performance while limiting certain device's bandwidth

The scenario are:

  1. Some game download version is in low priority, just let them update at controlled speed hoping it can reserve more bandwidth

  2. IPTV box somehow consume a lot of bandwidth, more than actually they need because of a problem in the architecture: do not know if the box itself will mirror the content or not, so better limit it's up/down speed to hope that they do not take too much bandwidth

  3. Some P2P video app do serve as a server and stream content from the client side. I do not have this problem, but I see someone want to watch from those apps but don't want to stream it out

  4. Those US based ISP now cap the bandwidth, the money I pay for will only good for the 1st 1TB of the month. So have to choose between limiting bandwidth use of certain device by QoS, disable them on scheduled, or optimizing performance by SQM

Thanks for these scenarios.

SQM is specifically designed to solve the first two (game downloads, IPTV bandwidth). Instead of seeking some set of arcane QoS config's, SQM is likely to provide great performance without any additional work. I'd recommend you try SQM to see if things work OK.

The third (preventing P2P Video app from streaming out) may work fine with SQM as well. If not, then perhaps there's a way to turn off its streaming out (instead of trying to limit its bandwidth).

The final choice (ISP-imposed bandwidth caps) is a tough one. You might be right to look for a way to disable them on schedule.

Thanks!

I take this one.... As far as I can tell they cap volume not bandwidth (they either restrict bandwidth after the included volume is used up, or even more likely bill semi-automatically for more volume). Since the relevant measure is volume not bandwidth, you should monitor volume used by certain devices (and potentially restrict their bandwidth after making sure that this is going to help). After all 1TB per months equals only 3.4 Mbps for the whole time...

I was sleepy and typed in a wrong wording.

Yes, what's more, for comcast, they charge $10 per 50GB after 1st 1TB.

The limit bandwidth trick aimed at limiting bandwidth, so even multiple by 7x24x30 could still not significant. At the moment, I get an old router and link it to XinifityWifi, the speed is not fast, around 25Mbps, port are all closed, even netcat cannot be run (it was a problem on my ddns, yet I ignore it now), but the good thing is they said it is not counting towards my 1TB

Thanks for advice

I have SQM set up and happily using without problem - I revised my expectation and just let them load.

those P2P video apps have problem of doing what they want and reset user's settings on each update. With SQM, at least normal web browsing will remain fast I supposed. Anyway, not apply to me

[quote="enri, post:8, topic:1641, full:true"]
I was sleepy and typed in a wrong wording.

Yes, what's more, for comcast, they charge $10 per 50GB after 1st 1TB.

The limit bandwidth trick aimed at limiting bandwidth, so even multiple by 7x24x30 could still not significant. At the moment, I get an old router and link it to XinifityWifi, the speed is not fast, around 25Mbps, port are all closed, even netcat cannot be run (it was a problem on my ddns, yet I ignore it now), but the good thing is they said it is not counting towards my 1TB
[/quote]Okay, that is clever, using the comcast wifi against itself (I assume you are connecting to the comcast-customer wifi shared from your own device). I would have thought that would be impossible, but even if it is a close neighbour's comcast wifi, still clever!

Best Regards

P.S.: Sorry for my first email appearing grumpy, I had not intended it that way, but on re-reading it I realize that my messaging was way off. For what it is worth I was aiming for funny not grumpy.

If throttling must be used, here's how

Use iptables to mark/connmark the traffic based on IP/MAC etc
Add a speed limiting qdisc (e.g. tbf) to your qdisc tree.
Add a tc fw filter to assign the marked traffic to the tbf qdisc

If your XBOX is not behind NAT, you have the option of matching IP using tc u32 filter instead of iptables

The above only throttles the upload speed (which might also affect download speed a bit). Download speed is hard to control because you can only control the traffic when it's in your router, and the moment ingress/download traffic reaches your router, the bandwidth is used, therefore dropping those packets would not save any bandwidth (it'd only waste bandwidth).

You can only throttle download if you can affect the way the sender sends data, for TCP traffic one way to do this is reduce MSS, this would decrease the throughput (and also increase the overhead), another way is drop some ACK packets to simulate network congestion to allow the sender's congestion control to slow down the transmission rate. Both can be done using iptables and tc. You would not get precise throttling though.

Throttling may not be the best option as it could result in bandwidth underutilization, e.g. the throttled device/application cannot use the full bandwidth even if nothing else is using the Internet. This means it would take longer for a throttled entity to complete the task (e.g. download) which could actually end up competing for bandwidth (still within the throttling limit) later on that could've been avoided if it completed the download by using the full bandwidth earlier. That's why I peronsally prefer traffic prioritization that high priority traffic always gets ahead of lower ones, and packets are dropped only when necessary, my QOS script would even starve low priority queues to allow higher ones to use all the bandwidth.

Well, interestingly most senders (tCP especially) will respond to dripped packets with decreasing the sending bandwidth, so dropping on ingress actually does work (just not as quickly and well as egress drops). If you are really concerned about the lost bandwidth you can use ECN marking instead of droopping at ingress (and that is what cake and sqm do in general, but you still need to a) enable ECN on the internal computers, and b) talk to internet hosts that support ECN).

Dropping ingress packets will lead to dup ACKs that will also tell the sender to slow down... I agree about the precision though.

And that is what cake and sqm do, if uncontended all DSCP marking can use the full bandwidth, only on contention things receede to their threshold bandwidths.

I disagree about the [quote="tmp, post:11, topic:1641"]
Throttling may not be the best option as it could result in bandwidth underutilization
[/quote]

part, ingress shaping will (not could) result in using less than your true downlink bandwidth, but it will offer less latency under load, which for many things seems more important; e.g. any "interactive" traffic suffers from increased latency under load, basically only bulk and background transfers profit from more bandwidth as they essentially do not care about latency...

Best Regards

Xbox and Playstation have a built in speed-test inside their network settings. When doing a speed-test the console hogged about 60+ mbps down and a majority of my upload. The rest of the bandwidth would be distributed evenly between my house hold computers and tablets, etc.

Do you have any idea about the duration of the test and whether it uses UDP or TCP? It would also be interesting to learn how far away the servers are located (so effectively the RTT). Maybe you could use tcpdump on your router and simply record a packet capture (then use wireshark to look into that capture). Maybe with that additional information we can gain some insight in the observed behaviour.

Oh, and please also post:
cat /etc/config/sqm
tc -d qdisc
tc -s qdisc
(all assuming that you are using sqm-scripts).

Best Regards

As far as the duration goes i'm not very sure, the test overall takes about 20~ seconds or so. I'm positive that the console uses UDP as those are the types of ports that need to be forwarded in the router to achieve an open NAT on the console.

There are lots of OpenWRT "Software" do the bandwidth per IP job. Google search those: eqos (tested working), luci-app-nft-qos (tested working, active development), qosv4(a tomato shaping per IP merge, works on older version of WRT)

1 Like

Hi, I used LinkSys WRT3200 openWRT and I need to limit bandwidth per IP or MAC
Any help please?