Hi all,
Let’s take voip for example - as the moment voice data and say YouTube data are fighting for priority in my router… I just want to say… ok, all traffic to and from this IP (known static) must be prioritized over any other traffic.
All I seem to come across is “queues”, but they seem unrelated to what I want - Queues seem to “throttle” traffic… I would not want that, firstly, although I have say 20mb fiber… it floats around anything from 12mb to 20mb… so if i was to “cut up” my traffic into some kind of voice and normal data… what possible values would i use in each… also i don’t want to cap my voice data at all… what if im on 5 calls, or 10 or 50… There is simply no two values it could put in either “channel” that would suite. Also if I do make a voice channel of say 5mb, and leave the remaining 15mb for browsing (in this completely unrealistic situation), now what if im not on any calls… now my 20mb fiber is capped at 15mb for no real reason.
For a start, let’s make clear that you cannot really determine the priority used at the ISP side. It is up to the ISP to do that for you. A decent ISP that also offers VoIP will have done that, if not then you will be facing challenges.
Limiting traffic is crucial. When you just pump out traffic at full rate, queues will form at places you cannot control, and all traffic will enqueue first-in first-out so your VoIP traffic will queue behind other data.
So you at least setup a queue system with 2 queues on the upload, with different priority, so VoIP is queued ahead of other traffic.
You need to limit the rate of the data traffic below the actual maximum, so the queues that are outside your control do not fill, and all queues are in the router.
There is no need to “reserve” capacity for voice, it is sufficient to set it to a higher priority, you can set limit-at and max-limit to the capacity of your line.
Then you have a data queue at lower priority which you can set at a quite low limit-at value and max-limit slightly below your line speed.
The data queue will use leftover capacity up to max-limit but when there is voice traffic it always goes first.
When your actual rate is not constant, also not to the VoIP provider (it is no problem when it varies towards remote internet servers), well you are out of luck.
You should understand that voice over IP has quality requirements for the connection, when you cannot meet them it is not going to work or not working satisfactorily.
Lets assume my ISP is perfect - but at some times during the day, my router is at full capacity of the fiber line - lets say that’s 20mb/s
Let’s for the argument sake say I set up a “voip” queue, and an “all-other-traffic”. (I have marked my voip traffic with a mangle rule, so that’s sorted.). Now I make a 2mb voip queue, how do i set that up so that the “all-other-traffic” consumes the rest of the bandwidth, but doesnt eat into the 2mb voip channel?
Also, should i be using simple queues or queue tree?
If your connection speed is truly fluctuating like this, then you need to set the queue limit at just under the slowest speed your connection drops to. Everything will be throttled to this rate all the time, which isn’t ideal. This is the only way to make QoS work, as otherwise the queuing happens on your modem / ISP and you have no control over the priority there.
By setting the priority of the VoIP queue higher than of the other one.
Note that higher priority means a lower value in the priority field in the queue member.
Also, should i be using simple queues or queue tree?
For this, use a queue tree with parent set to the interface you use for the internet link. When that is PPPoE over ethernet, use the PPPoE interface not the ethernet interface. When it is using a VLAN, use the VLAN interface.
simple queue is more targeted towards distributing the available bandwidth over several users inside your home.
However, this can be done with queue tree as well. Select pcq-upload-default as queue type for your low prio queue to do that. It does not make much sense to do this for the VoIP queue.
Well, I was able to set something up just now - something that i realized is that, going to the speedtest site, and clicking the “GO” button cant really test your internet connection… it can only test what your browser session is able to download at right now… if your sister in the other room is downloading movies at the time you are doing a speed test, this shows as fluctuations in the speed… giving you this sense that your speed isn’t quite what you purchased from your ISP…
Taking that into account, I have made 2 queues, priority 1(voip) and 8(other), and, and simply set the limits accordingly. I made a call, and clicked the “Go” button on the speed test - with a bit of fiddling, I have the “other” queue going bright red! - while my voip queue is all green, and the call quality was fine.
I wouldn’t say this is ideal, but the call quality is fine now.
Yes, this shows it works OK.
By setting the pcq-upload-default you can equalize the bandwidth between users.
But unfortunately, it is not possible to do that for download. You can trick it by setting a similar queue on your local network, also at a rate just lower than the download rate you should have, but it will not work well because it will be dropping packets after they already have been received.
What you really need is your ISP having a similar setup. E.g. based on DSCP value of the traffic (46 for VoIP traffic).
Incompetent ISPs will claim “not allowed to to that because of net neutrality laws” and it means they are unusable for really reliable VoIP.
I figured I’d post my standard HTB config that I start with. Fasttrack effectively breaks queuing, so I exclude marked packets (this also applies to my mangle rules for IPSec, but that a different example).
In this case, I use mangle to mark typical DSCP VOIP traffic, but it can be anything.
eth6 is my internet interface, and vlan 28 is my internal interface. Since I can’t control the ISP flow to my router, I set vlan 28’s queues to traffic shape/limit traffic based on my max internet download (300Mbps). It isn’t perfect, but if I limit flows to internal hosts at certain bandwidths, then the data flows from ISP to my router should roughly match what I’ve set on vlan 28’s queues.
My queue configs may not be ideal (probably not) but they are effective for what I’m doing in this particular case. I think this could be a good starting place for someone looking at implementing typical queuing.
You do not need to set limit on each priority, you can just cap overall bandswidth to 85 to 90% ideally and just arrange them accordingly to your case. The limit-at will guarantee that priority to get that amount
if higher priority packets consumes bandwidth, then lower priority packets will get less, its just the way it is. But as you see, you do not need to hard cap.