Blame doc/actions/ifb-README

Packit Service 3880ab
Packit Service 3880ab
IFB is intended to replace IMQ.
Packit Service 3880ab
Advantage over current IMQ; cleaner in particular in in SMP;
Packit Service 3880ab
with a _lot_ less code.
Packit Service 3880ab
Packit Service 3880ab
Known IMQ/IFB USES
Packit Service 3880ab
------------------
Packit Service 3880ab
Packit Service 3880ab
As far as i know the reasons listed below is why people use IMQ.
Packit Service 3880ab
It would be nice to know of anything else that i missed.
Packit Service 3880ab
Packit Service 3880ab
1) qdiscs/policies that are per device as opposed to system wide.
Packit Service 3880ab
IFB allows for sharing.
Packit Service 3880ab
Packit Service 3880ab
2) Allows for queueing incoming traffic for shaping instead of
Packit Service 3880ab
dropping. I am not aware of any study that shows policing is
Packit Service 3880ab
worse than shaping in achieving the end goal of rate control.
Packit Service 3880ab
I would be interested if anyone is experimenting.
Packit Service 3880ab
Packit Service 3880ab
3) Very interesting use: if you are serving p2p you may want to give
Packit Service 3880ab
preference to your own locally originated traffic (when responses come back)
Packit Service 3880ab
vs someone using your system to do bittorent. So QoSing based on state
Packit Service 3880ab
comes in as the solution. What people did to achieve this was stick
Packit Service 3880ab
the IMQ somewhere prelocal hook.
Packit Service 3880ab
I think this is a pretty neat feature to have in Linux in general.
Packit Service 3880ab
(i.e not just for IMQ).
Packit Service 3880ab
But i won't go back to putting netfilter hooks in the device to satisfy
Packit Service 3880ab
this.  I also don't think its worth it hacking ifb some more to be
Packit Service 3880ab
aware of say L3 info and play ip rule tricks to achieve this.
Packit Service 3880ab
--> Instead the plan is to have a conntrack related action. This action will
Packit Service 3880ab
selectively either query/create conntrack state on incoming packets.
Packit Service 3880ab
Packets could then be redirected to ifb based on what happens -> eg
Packit Service 3880ab
on incoming packets; if we find they are of known state we could send to
Packit Service 3880ab
a different queue than one which didn't have existing state. This
Packit Service 3880ab
all however is dependent on whatever rules the admin enters.
Packit Service 3880ab
Packit Service 3880ab
At the moment this 3rd function does not exist yet. I have decided that
Packit Service 3880ab
instead of sitting on the patch for another year, to release it and then
Packit Service 3880ab
if there is pressure i will add this feature.
Packit Service 3880ab
Packit Service 3880ab
An example, to provide functionality that most people use IMQ for below:
Packit Service 3880ab
Packit Service 3880ab
--------
Packit Service 3880ab
export TC="/sbin/tc"
Packit Service 3880ab
Packit Service 3880ab
$TC qdisc add dev ifb0 root handle 1: prio
Packit Service 3880ab
$TC qdisc add dev ifb0 parent 1:1 handle 10: sfq
Packit Service 3880ab
$TC qdisc add dev ifb0 parent 1:2 handle 20: tbf rate 20kbit buffer 1600 limit 3000
Packit Service 3880ab
$TC qdisc add dev ifb0 parent 1:3 handle 30: sfq
Packit Service 3880ab
$TC filter add dev ifb0 protocol ip pref 1 parent 1: handle 1 fw classid 1:1
Packit Service 3880ab
$TC filter add dev ifb0 protocol ip pref 2 parent 1: handle 2 fw classid 1:2
Packit Service 3880ab
Packit Service 3880ab
ifconfig ifb0 up
Packit Service 3880ab
Packit Service 3880ab
$TC qdisc add dev eth0 ingress
Packit Service 3880ab
Packit Service 3880ab
# redirect all IP packets arriving in eth0 to ifb0
Packit Service 3880ab
# use mark 1 --> puts them onto class 1:1
Packit Service 3880ab
$TC filter add dev eth0 parent ffff: protocol ip prio 10 u32 \
Packit Service 3880ab
match u32 0 0 flowid 1:1 \
Packit Service 3880ab
action ipt -j MARK --set-mark 1 \
Packit Service 3880ab
action mirred egress redirect dev ifb0
Packit Service 3880ab
Packit Service 3880ab
--------
Packit Service 3880ab
Packit Service 3880ab
Packit Service 3880ab
Run A Little test:
Packit Service 3880ab
Packit Service 3880ab
from another machine ping so that you have packets going into the box:
Packit Service 3880ab
-----
Packit Service 3880ab
[root@jzny action-tests]# ping 10.22
Packit Service 3880ab
PING 10.22 (10.0.0.22): 56 data bytes
Packit Service 3880ab
64 bytes from 10.0.0.22: icmp_seq=0 ttl=64 time=2.8 ms
Packit Service 3880ab
64 bytes from 10.0.0.22: icmp_seq=1 ttl=64 time=0.6 ms
Packit Service 3880ab
64 bytes from 10.0.0.22: icmp_seq=2 ttl=64 time=0.6 ms
Packit Service 3880ab
Packit Service 3880ab
--- 10.22 ping statistics ---
Packit Service 3880ab
3 packets transmitted, 3 packets received, 0% packet loss
Packit Service 3880ab
round-trip min/avg/max = 0.6/1.3/2.8 ms
Packit Service 3880ab
[root@jzny action-tests]#
Packit Service 3880ab
-----
Packit Service 3880ab
Now look at some stats:
Packit Service 3880ab
Packit Service 3880ab
---
Packit Service 3880ab
[root@jmandrake]:~# $TC -s filter show parent ffff: dev eth0
Packit Service 3880ab
filter protocol ip pref 10 u32
Packit Service 3880ab
filter protocol ip pref 10 u32 fh 800: ht divisor 1
Packit Service 3880ab
filter protocol ip pref 10 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1
Packit Service 3880ab
  match 00000000/00000000 at 0
Packit Service 3880ab
        action order 1: tablename: mangle  hook: NF_IP_PRE_ROUTING
Packit Service 3880ab
        target MARK set 0x1
Packit Service 3880ab
        index 1 ref 1 bind 1 installed 4195sec  used 27sec
Packit Service 3880ab
         Sent 252 bytes 3 pkts (dropped 0, overlimits 0)
Packit Service 3880ab
Packit Service 3880ab
        action order 2: mirred (Egress Redirect to device ifb0) stolen
Packit Service 3880ab
        index 1 ref 1 bind 1 installed 165 sec used 27 sec
Packit Service 3880ab
         Sent 252 bytes 3 pkts (dropped 0, overlimits 0)
Packit Service 3880ab
Packit Service 3880ab
[root@jmandrake]:~# $TC -s qdisc
Packit Service 3880ab
qdisc sfq 30: dev ifb0 limit 128p quantum 1514b
Packit Service 3880ab
 Sent 0 bytes 0 pkts (dropped 0, overlimits 0)
Packit Service 3880ab
qdisc tbf 20: dev ifb0 rate 20Kbit burst 1575b lat 2147.5s
Packit Service 3880ab
 Sent 210 bytes 3 pkts (dropped 0, overlimits 0)
Packit Service 3880ab
qdisc sfq 10: dev ifb0 limit 128p quantum 1514b
Packit Service 3880ab
 Sent 294 bytes 3 pkts (dropped 0, overlimits 0)
Packit Service 3880ab
qdisc prio 1: dev ifb0 bands 3 priomap  1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
Packit Service 3880ab
 Sent 504 bytes 6 pkts (dropped 0, overlimits 0)
Packit Service 3880ab
qdisc ingress ffff: dev eth0 ----------------
Packit Service 3880ab
 Sent 308 bytes 5 pkts (dropped 0, overlimits 0)
Packit Service 3880ab
Packit Service 3880ab
[root@jmandrake]:~# ifconfig ifb0
Packit Service 3880ab
ifb0    Link encap:Ethernet  HWaddr 00:00:00:00:00:00
Packit Service 3880ab
          inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
Packit Service 3880ab
          UP BROADCAST RUNNING NOARP  MTU:1500  Metric:1
Packit Service 3880ab
          RX packets:6 errors:0 dropped:3 overruns:0 frame:0
Packit Service 3880ab
          TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
Packit Service 3880ab
          collisions:0 txqueuelen:32
Packit Service 3880ab
          RX bytes:504 (504.0 b)  TX bytes:252 (252.0 b)
Packit Service 3880ab
-----
Packit Service 3880ab
Packit Service 3880ab
You send it any packet not originating from the actions it will drop them.
Packit Service 3880ab
[In this case the three dropped packets were ipv6 ndisc].
Packit Service 3880ab
Packit Service 3880ab
cheers,
Packit Service 3880ab
jamal