[OpenWireless Tech] OpenWRT: traffic prioritization between WLANs

michi1 at michaelblizek.twilightparadox.com michi1 at michaelblizek.twilightparadox.com
Fri Nov 16 21:08:54 PST 2012


Hi!

On 14:59 Fri 16 Nov     , Dan Auerbach wrote:
> Hi everyone,
> 
> This question is about OpenWRT, but I'd also be interested to know if
> others have solutions for dd-wrt or Tomato or other firmware.
> 
> I'm looking into how to best to traffic prioritization beyond simple QoS
> between two wireless networks: let's say, "home" and "guest". I
> understand there are out-of-the-box ways to do bandwidth limiting
> (wshaper, qos-scripts, etc). But the behavior I'm seeking is for the
> "home" network to be first in line no matter what, and for the "guest"
> network to have maximum bandwidth otherwise (although I understand this
> is not quite optimal -- see #3 below). I have a series of questions
> along these lines that maybe folks on the list can help me with.

What bottleneck are we talking about?
- internet downstream:
  attach ingress qdisc (messy) or a transparent proxy (messy too)
  ... or just limit the wlan guest interface outgoing to 1/3rd of your
  downstream bandwidth
- internet upstream:
  attach qdisc htb (you need to know upload bandwidth) or fifo
  (no external modems, may starve guest network) or gred (no external
  modems, guest network may slow home network)
- wlan ap-to-client:
  not sure this is implemented; This is something the wlan layer/driver
  needs to take care of.
- wlan client-to-ap:
  The same as in "internet downstream".

> 2. I'm looking at trying to achieve this with tc and a Qdisc.
> Unfortunately, Qdiscs are attached to an interface, and in this case
> there will be two virtual interfaces corresponding to the different
> WLANs. Is there a way to use the physical interface underlying both
> virtual interfaces to create a Qdisc that prioritizes based on the
> virtual interface (or something like the ssid)? I hope that this is
> doable and if anyone has pointers, that would be fantastic.

For outgoing packets, you should be able to send them to a traffic class of
your joice like this:
iptables -t mangle -A POSTROUTING -i guestnetwork -o internet -j CLASSIFY \
  --set-class 1:0
iptables -t mangle -A POSTROUTING -i guestnetwork -o internet -j CLASSIFY \
  --set-class 2:0

> 3. I understand that my description above might be suboptimal. For
> example, a guest using SSH might have their connection break as soon as
> someone on the home network downloads a video file, even though the home
> network user couldn't notice the difference in download speed if the SSH
> connection TCP packets got enough priority to maintain the connection
> (supposing a normal SSH session, not using SSH to tunnel
> bandwidth-intensive traffic).

This can happen. It is called starvation.

> Ideally, the guest should be able to use
> SSH while the video file download still gets the lion's share of the
> bandwidth. I think a more advanced approach would be to guarantee a
> small portion of bandwidth for the guest connection if needed. My rough
> understanding is that I can achieve this using the htb Qdisc, but
> wondered if others have experience doing this / pointers to good
> resources about it.

htb is for outgoing traffic only. For the purpose of shaping outgoing
internet traffic it works like a charm. However, you need to know the
internet bandwidth (no auto detection) and you need to create the rules
about what should get how much bandwidth.

	-Michi
-- 
programing a layer 3+4 network protocol for mesh networks
see http://michaelblizek.twilightparadox.com



More information about the Tech mailing list