Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Fabio Marcone <fabio.marcone@duet.it>
To: netfilter@vger.kernel.org
Subject: Re: tc and CONNMARK
Date: Tue, 06 Oct 2009 15:32:02 +0200	[thread overview]
Message-ID: <4ACB46D2.7090703@duet.it> (raw)
In-Reply-To: <4ACB4156.5030608@unipex.it>

Hello,
>
>> iptables -t mangle -A PREROUTING -p TCP -m mac --mac-source 
>> xx:xx:xx:xx:xx:xx--dport 443 -j MARK --set-mark 8
>>
>
> Why not forward or postrouting? Do you choose prerouting for use the 
> mac addrs?

yes, I recognize workstation by macaddress and workstations are divided 
into groups. Different groups can use different rates related at the 
same IP/protocol/port. So, to limit traffic in upload I need to know if 
a packet is related to a connection or an another one.

>
>> iptables version: 1.4.3.2 kernel version: 2.6.29.3
>>
>> both patched to use IMQ devices.
>
> Haven't you said this!
> In _all_ my installations, I always skip to use imq. I don't know why,
> but it's simple to use that are already included inside the vanilla 
> kernel
I use IMQ for services exported by router (like http, smtp, ecc ecc) so 
I can limit upload and download traffic of a particular service 
available on a particular interface.

>
>>>
>>> Normally I don't use connmark because when I try some time ago to 
>>> use it, I found some "not marked" problems, so I switch to classid.
>>>  Better and cleaner for me.
>> what kind of problems?
>
> ip filter don't match my data. But it's true that I didn't lost a lot of
> time following that solution because... I find CLASSIFY
>
>> What do you mean with "I switch to classid" ?
>>
>
> It's a wrong definition, sorry. The right one it CLASSIFY!
>
> Simple example, assuming that you have 192.168.1.0/24, need to limit 
> at 5mb
> the ip .100 on both sides on flow and all the others goes at 1mbit all
> together. eth0 lan, eth1 are wan.
>
> tc qdisc add dev eth0 root handle 1: htb default 1000
> tc class add dev eth0 parent 1: classid 1:1 htb rate 100mbit ceil 100mbit
> tc class add dev eth0 parent 1:1 classid 1:100 htb rate 1mbit ceil 5mbit
> tc class add dev eth0 parent 1:1 classid 1:1000 htb rate 1mbit ceil 1mbit
>
> tc qdisc add dev eth1 root handle 2: htb default 1000
> tc class add dev eth1 parent 2: classid 2:1 htb rate 100mbit ceil 100mbit
> tc class add dev eth1 parent 2:1 classid 2:100 htb rate 1mbit ceil 5mbit
> tc class add dev eth1 parent 2:1 classid 2:1000 htb rate 1mbit ceil 1mbit
>
> iptables -t mangle -F FORWARD
> iptables -t mangle -A FORWARD -o eth0 -d 192.168.1.100 -j CLASSIFY
> --set-class 1:100
> iptables -t mangle -A FORWARD -o eth1 -s 192.168.1.100 -j CLASSIFY
> --set-class 5:100
> #not need since class [12]:1000 are already a fetch-all for the 
> unclassified
> iptables -t mangle -A OUTPUT -o eth0 -j CLASSIFY --set-class 1:1000
> iptables -t mangle -A OUTPUT -o eth1 -j CLASSIFY --set-class 5:1000
Thanks a lot I didn't known CLASSIFY.

Fabio

  reply	other threads:[~2009-10-06 13:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-05  9:32 tc and CONNMARK Fabio Marcone
     [not found] ` <4AC9FF4E.5010307@unipex.it>
2009-10-05 14:38   ` Fabio Marcone
2009-10-05 16:22     ` Michele Petrazzo - Unipex
2009-10-06 11:53       ` Fabio Marcone
     [not found]         ` <56378e320910060516x596cf5abv20e916ae9f694e6d@mail.gmail.com>
2009-10-06 12:21           ` Richard Horton
2009-10-06 13:08         ` Michele Petrazzo - Unipex
2009-10-06 13:32           ` Fabio Marcone [this message]
2009-10-07 11:41 ` tc and CONNMARK [SOLVED] Fabio Marcone

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=4ACB46D2.7090703@duet.it \
    --to=fabio.marcone@duet.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