netfilter.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Beverley <andy@andybev.com>
To: Lloyd Standish <lloyd@crnatural.net>
Cc: netfilter@vger.kernel.org
Subject: Re: htb + prio trouble
Date: Sun, 20 Nov 2011 19:36:10 +0000	[thread overview]
Message-ID: <1321817770.2382.996.camel@andybev-desktop> (raw)
In-Reply-To: <op.v49c0wstx1lyi3@debiandesk2.net>

On Sun, 2011-11-20 at 12:44 -0600, Lloyd Standish wrote:
> Hello All,
> 
> While configuring a load-balancing router, I have run into trouble
>  setting up traffic shaping (at least the load-balancing is working!)
> 
> I am trying to:
> (1) limit total upload speed to somewhat below the interface bandwidth
> (2) do some traffic shaping, particularly avoid queuing of VOIP packets.
> 
> To accomplish this I am trying to create a HTB qdisc on each
>  outward-facing interface, each containing a PRIO qdisc with the
>  default 3 classes.  sfq qdiscs are created for each PRIO class.
> 
> Commands to set up qdiscs and filters for outward-facing interface eth0:
> 
> + tc qdisc del dev eth0 root handle 1
> + tc qdisc del dev eth0 ingress
> + tc qdisc add dev eth0 root handle 1:0 htb
> + tc class add dev eth0 parent 1:0 classid 1:1 htb rate 3200kbit ceil 3200kbit
> + tc qdisc add dev eth0 parent 1:1 handle 2: prio
> + tc qdisc add dev eth0 parent 2:1 handle 10: sfq perturb 10 limit 3000
> + tc qdisc add dev eth0 parent 2:2 handle 20: sfq perturb 10
> + tc qdisc add dev eth0 parent 2:3 handle 30: sfq perturb 10
> + tc filter add dev eth0 protocol ip parent 2: prio 1 u32 match ip dport 5060 0xffff flowid 2:1
> + tc filter add dev eth0 protocol ip parent 2: prio 1 u32 match ip sport 5060 0xffff flowid 2:1
> + tc filter add dev eth0 protocol ip parent 2: prio 1 u32 match ip dport 53 0xffff flowid 2:1
> + tc filter add dev eth0 protocol ip parent 2: prio 1 u32 match ip dport 80 0xffff flowid 2:1

I don't think you're filtering correctly. You've attached the filter to
the prio qdisc, which is below the htb qdisc. Therefore it won't see any
traffic, as there is no filter to send traffic into the prio qdisc
itself. In fact, there is no filter at all for the htb qdisc, hence the
reason you are seeing traffic in it but nowhere else.

The filter needs to sit the level above in order to filter into classes
below it, so you'll need to do something like

tc filter add dev eth0 protocol ip parent 1:0 prio 1 \
	u32 match ip dport 80 0xffff flowid 2:1

You may also need to change the flowid (I've never played with the prio
qdisc)

Andy



  parent reply	other threads:[~2011-11-20 19:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-20 18:44 htb + prio trouble Lloyd Standish
2011-11-20 19:10 ` htb + prio trouble (additional info) Lloyd Standish
2011-11-20 19:43   ` Andrew Beverley
2011-11-20 19:36 ` Andrew Beverley [this message]
2011-11-20 20:46   ` htb + prio trouble Lloyd Standish
2011-11-21 10:16     ` Andy Furniss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1321817770.2382.996.camel@andybev-desktop \
    --to=andy@andybev.com \
    --cc=lloyd@crnatural.net \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).