When I started using the EdgeRouter Lite, I knew that it was quite powerful and could handle pretty much anything I threw at it. Last week I had to send a very large file to a co-worker, so I put it in Dropbox and soon saw Dropbox use pretty much 100% of my upstream bandwidth; I tried limiting the upstream bandwidth in Dropbox, but the setting failed to do anything. Someone tried to call us on our Ooma and I had trouble with the call, so I stopped the Dropbox upload and turned on the Network Link Conditioner on my Mac to limit the upload.
That evening I started playing with Quality of Service (QoS) on the EdgeRouter Lite to see what I could do to prioritize the voice traffic and limit bandwidth while making calls. After much research over about a week, I finally managed to come up with a configuration that seems to work. There are lots of guides out there, but I didn’t quite understand them, so I’ll do what I can to explain what I’ve done here. If there are any errors or tips, feel free to let me know.
First up, I setup a DOWNLOAD traffic-policy to handle downstream bandwidth. I’m not sure that this is truly necessary as I’ve been unable to continuously max out my downstream connection and when Time Warner Cable upgrade to MAXX this November, it will become less of an issue.
I SSH’d into the box and did the following:
configure
set traffic-policy shaper DOWNLOAD bandwidth 60mbit
DOWNLOAD is an arbitrary label. 60mbit is my total downstream bandwidth.
set traffic policy shaper DOWNLOAD class 10 bandwidth 25%
set traffic policy shaper DOWNLOAD class 10 burst 2.5k
set traffic policy shaper DOWNLOAD class 10 ceiling 50%
set traffic policy shaper DOWNLOAD class 10 description RTP
set traffic policy shaper DOWNLOAD class 10 match VOIP-RTP ip dscp 46
set traffic policy shaper DOWNLOAD class 10 match VOIP-RTP-ipv6 ipv6 dscp 46
set traffic policy shaper DOWNLOAD class 10 priority 7
set traffic policy shaper DOWNLOAD class 10 queue-type fair-queue
This sets up a “rule” given this particular traffic a minimum of 25% of the total bandwidth and caps it at 50% of the total bandwidth. It matches on the VOIP RTP packet header. The docs say that the priority is 0 to 7 where 7 is the highest priority. Note that the docs say that for default, 7 is the lowest priority.
set traffic policy shaper DOWNLOAD class 20 bandwidth 5%
set traffic policy shaper DOWNLOAD class 20 burst 2.5k
set traffic policy shaper DOWNLOAD class 20 ceiling 50%
set traffic policy shaper DOWNLOAD class 20 description RTP
set traffic policy shaper DOWNLOAD class 20 match VOIP-SIP ip dscp 24
set traffic policy shaper DOWNLOAD class 20 match VOIP-SIP-ipv6 ipv6 dscp 24
set traffic policy shaper DOWNLOAD class 20 priority 7
set traffic policy shaper DOWNLOAD class 20 queue-type fair-queue
The bandwidth values are pretty arbitrary as VOIP should never use that much bandwidth on my network.
set traffic policy shaper DOWNLOAD class 30 bandwidth 10%
set traffic policy shaper DOWNLOAD class 30 burst 2.5k
set traffic policy shaper DOWNLOAD class 30 ceiling 20%
set traffic policy shaper DOWNLOAD class 30 description OOMA
set traffic policy shaper DOWNLOAD class 30 match OOMA-ADDRESS ip destination 10.0.1.102/32
set traffic policy shaper DOWNLOAD class 30 match OOMA-MAC there destination 00:00:00:00:00:00
set traffic policy shaper DOWNLOAD class 30 priority 7
set traffic policy shaper DOWNLOAD class 30 queue-type fair-queue
This rules gives my Ooma box guaranteed bandwidth; the matching is an ANY so either match will work. I really don’t need both matches, but I put it here to try things out.
set traffic policy shaper DOWNLOAD default bandwidth 65%
set traffic policy shaper DOWNLOAD default burst 15k
set traffic policy shaper DOWNLOAD default ceiling 100%
set traffic policy shaper DOWNLOAD default priority 7
set traffic policy shaper DOWNLOAD default queue-type fair-queue
This is for any traffic that doesn’t match the other rules. Note that the total bandwidth (not ceiling) should add up to 100%.
Something similar for UPLOAD:
set traffic-policy shaper UPLOAD bandwidth 6mbit
set traffic policy shaper UPLOAD class 10 bandwidth 25%
set traffic policy shaper UPLOAD class 10 burst 2.5k
set traffic policy shaper UPLOAD class 10 ceiling 50%
set traffic policy shaper UPLOAD class 10 description RTP
set traffic policy shaper UPLOAD class 10 match VOIP-RTP ip dscp 46
set traffic policy shaper UPLOAD class 10 match VOIP-RTP-ipv6 ipv6 dscp 46
set traffic policy shaper UPLOAD class 10 priority 7
set traffic policy shaper UPLOAD class 10 queue-type fair-queue
set traffic policy shaper UPLOAD class 20 bandwidth 5%
set traffic policy shaper UPLOAD class 20 burst 2.5k
set traffic policy shaper UPLOAD class 20 ceiling 50%
set traffic policy shaper UPLOAD class 20 description RTP
set traffic policy shaper UPLOAD class 20 match VOIP-SIP ip dscp 24
set traffic policy shaper UPLOAD class 20 match VOIP-SIP-ipv6 ipv6 dscp 24
set traffic policy shaper UPLOAD class 20 priority 7
set traffic policy shaper UPLOAD class 20 queue-type fair-queue
set traffic policy shaper UPLOAD class 30 bandwidth 10%
set traffic policy shaper UPLOAD class 30 burst 2.5k
set traffic policy shaper UPLOAD class 30 ceiling 20%
set traffic policy shaper UPLOAD class 30 description OOMA
set traffic policy shaper UPLOAD class 30 match OOMA-ADDRESS ip source 10.0.1.102/32
set traffic policy shaper UPLOAD class 30 match OOMA-MAC there source 00:00:00:00:00:00
set traffic policy shaper UPLOAD class 30 priority 7
set traffic policy shaper UPLOAD class 30 queue-type fair-queue
set traffic policy shaper UPLOAD default bandwidth 60%
set traffic policy shaper UPLOAD default burst 15k
set traffic policy shaper UPLOAD default ceiling 100%
set traffic policy shaper UPLOAD default priority 7
set traffic policy shaper UPLOAD default queue-type fair-queue
set interfaces ethernet eth1 redirect ifb1
set interfaces ethernet eth1 traffic-policy out DOWNLOAD
set interfaces input ifb1 traffic-policy out UPLOAD
commit
save
The last bit above tells eth1 (my LAN interface) to use the download policy (out means leaving the box). In order to get the upload to work, I’ve told the interface to redirect the traffic to the “input” interface and then applied the QoS policy.
One drawback to QoS is that with the 1.7 firmware, traffic analysis doesn’t work. Ubiquiti has said that they may add traffic analysis to QoS packets. In addition, the release notes indicate that at higher bandwidths, QoS bogs down the box and limits the bandwidth. So, when my cable modem gets upgraded, I may turn off the DOWNLOAD policy, but can still keep the UPLOAD policy which is where most of the problem lies.
After setting all of this up, I was able to run a download test and still maintain a voice call, so I succeeded in my mission. I’m sure something isn’t quite right and I’ll be tweaking this again when iOS 9 brings WiFi calling as I’m not sure that my policies will match the correct traffic.
Putting this all together, I got the following configuration:
traffic-policy {
shaper DOWNLOAD {
bandwidth 60mbit
class 10 {
bandwidth 25%
burst 2.5k
ceiling 50%
description RTP
match VOIP-RTP {
ip {
dscp 46
}
}
match VOIP-RTP-IPv6 {
ipv6 {
dscp 46
}
}
priority 7
queue-type fair-queue
}
class 20 {
bandwidth 5%
burst 2.5k
ceiling 50%
description SIP
match VOIP-SIP {
ip {
dscp 24
}
}
match VOIP-SIP-IPv6 {
ipv6 {
dscp 24
}
}
priority 7
queue-type fair-queue
}
class 30 {
bandwidth 5%
burst 2.5k
ceiling 10%
description OOMA
match OOMA-ADDRESS {
ip {
destination {
address 10.0.1.102/32
}
}
}
match OOMA-MAC {
ether {
destination 00:00:00:00:00:00
}
}
priority 7
queue-type fair-queue
}
default {
bandwidth 65%
burst 15k
ceiling 100%
priority 7
queue-type fair-queue
}
}
shaper UPLOAD {
bandwidth 6mbit
class 10 {
bandwidth 25%
burst 2.5k
ceiling 50%
description RTP
match VOIP-RTP {
ip {
dscp 46
}
}
match VOIP-RTP-IPv6 {
ipv6 {
dscp 46
}
}
priority 7
queue-type fair-queue
}
class 20 {
bandwidth 5%
burst 2.5k
ceiling 50%
description SIP
match VOIP-SIP {
ip {
dscp 24
}
}
match VOIP-SIP-IPv6 {
ipv6 {
dscp 24
}
}
priority 7
queue-type fair-queue
}
class 30 {
bandwidth 10%
burst 2.5k
ceiling 20%
description OOMA
match OOMA-ADDRESS {
ip {
source {
address 10.0.1.102/32
}
}
}
match OOMA-MAC {
ether {
source 00:00:00:00:00:00
}
}
priority 7
queue-type fair-queue
}
default {
bandwidth 60%
burst 15k
ceiling 100%
priority 7
queue-type fair-queue
}
}
}
interfaces {
ethernet eth1 {
address 10.0.1.1/24
description Local
duplex auto
redirect ifb1
speed auto
traffic-policy {
out DOWNLOAD
}
}
input ifb1 {
traffic-policy {
out UPLOAD
}
}
}