Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Michele Petrazzo - Unipex srl <michele.petrazzo@unipex.it>
To: netfilter@vger.kernel.org
Subject: Re: Bandwidth Management - By MAC Address
Date: Sat, 22 Mar 2008 11:36:03 +0100	[thread overview]
Message-ID: <47E4E113.60309@unipex.it> (raw)
In-Reply-To: <665B03CFBE2C1346A66B0CB9A9A0EE3801C7EC44@ASM220.aspen.com>

Eric Estes wrote:
> I'm hoping someone could shed some light on this.
> 
> I'm trying to throttle a specific MAC Address to 200Kbits but it only
> seems to work for outgoing traffic. Can anyone see anything wrong with
> the code below?
> 

At first sight, you make a mistake here:

> /sbin/tc qdisc add dev eth1 handle 1: root htb default 1
> /sbin/tc qdisc add dev eth0 handle 1: root htb default 1

You have to add two differents handle for the incoming and outgoing data.

/sbin/tc qdisc add dev $OUT_IF handle 5: root htb default 5
/sbin/tc qdisc add dev $IN_IF handle 1: root htb default 5

/sbin/tc class add dev $OUT_IF parent 5: classid 5:1 htb rate 5320Kbit
/sbin/tc class add dev $OUT_IF parent 5: classid 5:5 htb rate 100Kbit
/sbin/tc class add dev $OUT_IF parent 5:1 classid 5:11 htb rate 200Kbit

/sbin/tc class add dev $IN_IF parent 1: classid 1:1 htb rate 5320Kbit
/sbin/tc class add dev $IN_IF parent 1: classid 1:5 htb rate 100Kbit
/sbin/tc class add dev $IN_IF parent 1:1 classid 1:11 htb rate 200Kbit

iptables -t mangle -F FORWARD -m mac --mac-source -o $OUT_IF -j CLASSIFY 
--set-class 5:11
iptables -t mangle -F FORWARD -d $PC_IP -i $IN_IF -j CLASSIFY 
--set-class 1:11

P.s. For incoming traffic you can't base your rules on the mac. See 
iptables(8)

Hope this help,
Michele

      reply	other threads:[~2008-03-22 10:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-21 16:24 Bandwidth Management - By MAC Address Eric Estes
2008-03-22 10:36 ` Michele Petrazzo - Unipex srl [this message]

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=47E4E113.60309@unipex.it \
    --to=michele.petrazzo@unipex.it \
    --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