From: Marek Kierdelewicz <marek@piasta.pl>
To: wilson@optimumwireless.com
Cc: netfilter@vger.kernel.org
Subject: Re: How can I test my tc script?
Date: Sun, 6 Feb 2011 01:05:27 +0100 [thread overview]
Message-ID: <20110206010527.4457d220@catus> (raw)
In-Reply-To: <20110205212151.27f217e0@catus>
And here's a bit more complex example for shaping upload with tc u32
hashing filters and IFB.
As in download example, we want to share 100mbit connection. Internet
access is connected to the router on eth0 and lan in on eth1. We do
ingress shaping of upload traffic on ifb0 after ingress eth1 traffic
is redirected to the device.
---------------------complete script------------------------------
tc qdisc add dev ifb0 root handle 1: htb default 1
tc class add dev ifb0 parent 1: classid 1:1 htb rate 100Mbit
tc filter add dev ifb0 parent 1:1 prio 11 handle 2: protocol ip \
u32 divisor 256
tc filter add dev ifb0 protocol ip parent 1:1 prio 11 u32 match \
ip dst 0.0.0.0/0 hashkey mask 0x000000ff at 12 link 2:
tc class add dev ifb0 parent 1:1 classid 1:400 htb rate 5mbit
tc qdisc add dev ifb0 parent 1:400 handle 400: sfq perturb 1
tc filter add dev ifb0 protocol ip prio 11 u32 ht 2:46: match ip \
src 10.5.0.70 flowid 1:400
tc class add dev ifb0 parent 1:1 classid 1:401 htb rate 5mbit
tc qdisc add dev ifb0 parent 1:401 handle 401: sfq perturb 1
tc filter add dev ifb0 protocol ip prio 11 u32 ht 2:a: match ip \
src 10.5.0.10 flowid 1:401
tc qdisc add dev eth1 ingress
tc filter add dev eth1 protocol ip parent ffff: prio 4 u32 match \
ip dst 0.0.0.0/0 flowid :1 action mirred egress redirect dev ifb0
---------------------------------------------------------------------
Now lets go line by line.
>tc qdisc add dev eth1 root handle 1: htb default 1
>tc class add dev eth1 parent 1: classid 1:1 htb rate 100Mbit
>tc filter add dev eth1 parent 1:1 prio 11 handle 2: protocol ip \
>u32 divisor 256
analogous to download example
>tc filter add dev eth1 protocol ip parent 1:1 prio 11 u32 match \
>ip dst 0.0.0.0/0 hashkey mask 0x000000ff at 12 link 2:
"at 12" instead of 16, because we want to hash on source ip address
>tc class add dev eth1 parent 1:1 classid 1:400 htb rate 5mbit
>tc qdisc add dev eth1 parent 1:400 handle 400: sfq perturb 1
analogous to download example
>tc filter add dev eth1 protocol ip prio 11 u32 ht 2:46: match ip \
>src 10.5.0.70 flowid 1:400
compared to download shaping, dst is changed to src
>tc class add dev ifb0 parent 1:1 classid 1:401 htb rate 5mbit
>tc qdisc add dev ifb0 parent 1:401 handle 401: sfq perturb 1
>tc filter add dev ifb0 protocol ip prio 11 u32 ht 2:a: match ip \
>src 10.5.0.10 flowid 1:401
analogous to previous client
>tc qdisc add dev eth1 ingress
add ingress qdisc to eth1 interface
>tc filter add dev eth1 protocol ip parent ffff: prio 4 u32 match \
>ip dst 0.0.0.0/0 flowid :1 action mirred egress redirect dev ifb0
redirect any ip traffic from ingress qdisc on device eth1 to ifb0;
note! redirection to ifb doesn't interfere with routing/firewalling/nat;
Best regards,
Marek Kierdelewicz
--
To unsubscribe from this list: send the line "unsubscribe netfilter" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2011-02-06 0:05 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-03 2:17 How can I test my tc script? Optimum Wireless Services
2011-02-03 11:01 ` Marek Kierdelewicz
2011-02-03 14:13 ` Optimum Wireless Services
2011-02-03 15:06 ` Marek Kierdelewicz
2011-02-03 16:18 ` Optimum Wireless Services
2011-02-04 13:45 ` Optimum Wireless Services
2011-02-04 16:49 ` Optimum Wireless Services
2011-02-04 19:57 ` Optimum Wireless Services
2011-02-05 12:29 ` Andrew Beverley
2011-02-05 19:32 ` Marek Kierdelewicz
2011-02-05 19:29 ` Marek Kierdelewicz
2011-02-05 20:21 ` Marek Kierdelewicz
2011-02-06 0:05 ` Marek Kierdelewicz [this message]
2011-02-06 2:24 ` Optimum Wireless Services
2011-02-04 14:22 ` Michele Petrazzo - Unipex
2011-02-05 2:08 ` Andrew Beverley
2011-02-05 14:58 ` Marek Kierdelewicz
2011-02-05 16:37 ` Andrew Beverley
2011-02-05 16:48 ` good tutorial J Webster
2011-02-05 19:22 ` Andrew Beverley
2011-02-05 19:33 ` J Webster
2011-02-05 19:51 ` Bob Miller
2011-02-05 22:47 ` Andrew Beverley
2011-02-05 22:44 ` Andrew Beverley
2011-02-05 17:04 ` How can I test my tc script? Marek Kierdelewicz
2011-02-06 2:12 ` Optimum Wireless Services
2011-02-06 16:13 ` Andrew Beverley
2011-02-07 8:20 ` Michele Petrazzo - Unipex
2011-02-03 19:38 ` Andrew Beverley
2011-02-05 2:44 ` Optimum Wireless Services
2011-02-05 6:07 ` Optimum Wireless Services
2011-02-05 12:27 ` Andrew Beverley
2011-02-06 2:14 ` Optimum Wireless Services
2011-02-06 16:15 ` Andrew Beverley
2011-02-06 16:35 ` Optimum Wireless Services
2011-02-06 17:02 ` Andrew Beverley
2011-02-06 23:27 ` Optimum Wireless Services
2011-02-08 0:56 ` Andrew Beverley
2011-02-08 2:11 ` Optimum Wireless Services
2011-02-08 6:52 ` Andrew Beverley
2011-02-08 2:20 ` Optimum Wireless Services
2011-02-08 6:53 ` Andrew Beverley
2011-02-06 16:44 ` Marek Kierdelewicz
2011-02-06 23:31 ` Optimum Wireless Services
2011-02-08 0:58 ` Andrew Beverley
2011-02-05 12:35 ` Andrew Beverley
2011-02-06 2:17 ` Optimum Wireless Services
2011-02-06 15:54 ` Andrew Beverley
2011-02-06 16:28 ` Optimum Wireless Services
2011-02-06 17:11 ` Andrew Beverley
2011-02-06 23:33 ` Optimum Wireless Services
2011-02-08 1:01 ` Andrew Beverley
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=20110206010527.4457d220@catus \
--to=marek@piasta.pl \
--cc=netfilter@vger.kernel.org \
--cc=wilson@optimumwireless.com \
/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