# Intermediate Functional Block (IFB = x-IMQ) usage ?

## tnt

There is Intermediate Functional Block (IFB) that replaces Intermediate Queuing Machine (IMQ) in recent kernels.

Can someone tell me how to use new IFB?

I was able to bring up ifb0 device but I can't redirect traffic to it.

In old IMQ I've been using something like this:

```
iptables -t mangle -A PREROUTING -i eth2 -j IMQ --todev 0
```

but now it doesn't work.

Any ideas?

----------

## PBR

Use tc ???

I found in source code of drivers/net/ifb.c folowing comment:

 *Quote:*   

> You need the tc action  mirror or redirect to feed this device
> 
> packets.

 

Let us know if U will sucesfull. I have no time to test it but I will need it soon  :Smile: 

----------

## frido

check this http://linux-net.osdl.org/index.php/IFB

----------

## tnt

when I try example given there I get:

```
modprobe ifb

ifconfig ifb0 up

ifconfig

eth0      Link encap:Ethernet  HWaddr 00:15:F2:AC:F7:AC

          inet addr:10.0.9.66  Bcast:10.0.9.127  Mask:255.255.255.192

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:2404385 errors:0 dropped:0 overruns:0 frame:0

          TX packets:2203654 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:2592797554 (2472.6 Mb)  TX bytes:1974750383 (1883.2 Mb)

          Interrupt:217 Memory:db000000-0

ifb0      Link encap:Ethernet  HWaddr 4A:98:47:A7:2C:BB

          UP BROADCAST RUNNING NOARP  MTU:1500  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:32

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

lo        Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:17728 errors:0 dropped:0 overruns:0 frame:0

          TX packets:17728 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:3233642 (3.0 Mb)  TX bytes:3233642 (3.0 Mb)

lsmod

Module                  Size  Used by

xt_mark                 2240  0

xt_MARK                 2944  0

ifb                     4104  0

it87                   23268  0

hwmon_vid               2624  1 it87

i2c_isa                 4608  1 it87

tc filter add dev eth0 parent ffff: protocol ip prio 10 u32 \

> match u32 0 0 flowid 1:1 \

> action ipt -j MARK --set-mark 1 \

> action mirred egress redirect dev ifb0

/usr/local/lib/iptables/libipt_mark.so: cannot open shared object file: No such file or directory

 failed to find target MARK

bad action parsing

parse_action: bad value (11:ipt)!

Illegal "action"

```

what do I miss?

----------

## frido

 *Quote:*   

> 
> 
> ```
> 
> tc filter add dev eth0 parent ffff: protocol ip prio 10 u32 \
> ...

 

This is strange. Is your iproute2 installed by emerge ??

----------

## tnt

 *frido wrote:*   

> This is strange. Is your iproute2 installed by emerge ??

 

Yes, it is:

```
emerge -pv iproute2

These are the packages that I would merge, in order:

Calculating dependencies ...done!

[ebuild   R   ] sys-apps/iproute2-2.6.15.20060110  -atm -berkdb -minimal 0 kB

Total size of downloads: 0 kB
```

----------

## tnt

I had to make symbolic link

```
/usr/local/lib/iptables -> /lib/iptables
```

to be able to use those example scripts.

It's 

```
/usr/local/lib/iptables -> /lib64/iptables
```

on amd64 systems.

On x86 system everything works fine, but unfortunately on amd64 I've got hard-lock at this point:

```
manchester tc # ./script.bsh

tablename: mangle hook: NF_IP_PRE_ROUTING

        target: MARK set 0x1  index 0

Action 4 device ifb0 ifindex 5

      
```

Connection with that machine disappeared and I'll have to go there to reset it manualy.  :Sad: 

----------

## tnt

here is the (very sad) epilogue of whole story:

https://forums.gentoo.org/viewtopic-t-458545.html

 :Crying or Very sad: 

----------

