# ipfw tablearg



## Antti (Oct 4, 2009)

Hi there.
I want to use ipfw + ng_car for traffic shaping.
I store ng_ipfw hook number in ipfw table as value, then I use this value as tablearg in the rules.
The problem is that I want to use 2 tables (one for user's IP addresses + ng_ipfw hook number, second one for specific addresses on which shaping rules apply). The manual page says that if 2 tables are used, then tablearg from second(destination) is used. Is there any way to use tablearg from the first table? Tablearg in second table is always 0.


```
ipfw -q add 0200 netgraph tablearg ip from table\(100\) to table\(30\) in via age0
ipfw -q add 0300 netgraph tablearg ip from table\(31\) to table\(100\) out via age0
```

P.S.: Does anyone working on ng_pf, to pass packets to netgraph from PF?


----------



## Alt (Oct 4, 2009)

This is setting ng_ipfw and ng_nat:

```
/usr/sbin/ngctl mkpeer ipfw: nat 60 out
        /usr/sbin/ngctl connect ipfw: 60 61 in
        /usr/sbin/ngctl msg ipfw:60 setaliasaddr $ngnat_aliasaddr
```
Then i give traffic to ng_nat with rules similar to yours

```
netgraph 61 ip from any to any in recv fxp0
netgraph 60 ip from any to any out xmit fxp0
```
You can try same mechanins to create your `tablearg` with ngctl.
You can look ngctl for ng_car config here (in russian  ).

P.S. With PF i think better to user altq instead of using ng_car.


----------



## Antti (Nov 2, 2009)

Ok, thanks.
The only solution for me is to dynamically add rules to ipfw...


----------

