Dummynet for IPF and IPNAT

Hello.

I'm stuck with configuring my router/server. Everything's working so far, but the thing I left out is traffic shaping. I will try to describe the situation:

All traffic from the LAN goes into the box through ath0.
There, the packets get filtered by IPF and routed by IPNAT to the Internet through fxp0, and vice versa.

The routing box itself runs a torrent client, and when it's active, nothing really works anymore as it should. I want to give priority to the clients' application, mostforward web browsing, but also everything else, over the torrent client.

So I added IPFW with pass all configuration to the equation to be able to use dummynet for traffic shaping.
I wanted to add one pipe for upstream, one for downstream. Each one containing three differently weighed queues:
weight 100 for ports 80/443 from network clients
weight 50 for all other from network clients
weight 10 for torrent traffic from the router (192.168.0.1)

Yet it doesn't seem to be working, pings are through the roof and so forth.

Maybe you can use some of this output:

Code:
[b]ipnat -l[/b]
List of active MAP/Redirect filters:
map fxp0 0.0.0.0/0 -> 0.0.0.0/32
map fxp0 0.0.0.0/32 -> 0.0.0.0/0

Code:
[B]ipfw list[/B]
00100 allow ip from any to any via lo0
00200 deny ip from any to 127.0.0.0/8
00300 deny ip from 127.0.0.0/8 to any
65000 allow ip from any to any
65100 pipe 1 ip from any to any out
65200 pipe 1 ip from 192.168.0.0/24 to any
65300 pipe 1 ip from 192.168.0.0/24 to any out
65400 queue 1 ip from 192.168.0.0/24 to any out
65500 queue 1 ip from 192.168.0.0/24 to any out
65500 queue 2 ip from 192.168.0.0/24 to any out
65500 queue 3 ip from 192.168.0.1 to any out
65500 pipe 2 ip from any to [public_ip] in
65500 queue 4 ip from any to 192.168.0.0/24 in
65500 queue 5 ip from any to 192.168.0.0/24 in
65500 queue 6 ip from any to 192.168.0.1 in
65535 deny ip from any to any

I'm not in any way familiar with ipfw but that doesn't seem to list all the criteria i used for traffic shaping, so here are the cmds i used for adding pipes/queues:

Code:
ipfw add pipe 1 ip from 192.168.0.0/24 to any out
ipfw pipe 1 config bw 2048Kbit/s

ipfw add queue 1 ip from 192.168.0.0/24 to any out
ipfw queue 1 config pipe 1 weight 100 mask src-ip 192.168.0.0/24 dst-port 80, 443
ipfw add queue 2 ip from 192.168.0.0/24 to any out
ipfw queue 2 config pipe 1 weight 50 mask src-ip 192.168.0.0/24
ipfw add queue 3 ip from 192.168.0.1 to any out
ipfw queue 3 config pipe 1 weight 10 mask src-ip 192.168.0.1 src-port 50000-50010 dst-port 50000-50010

ipfw add pipe 2 ip from any to [public_ip] in
ipfw pipe 2 config bw 256Kbit/s

ipfw add queue 4 ip from any to 192.168.0.0/24 in
ipfw queue 4 config pipe 2 weight 100 mask dst-ip 192.168.0.0/24 src-port 80, 443
ipfw add queue 5 ip from any to 192.168.0.0/24 in
ipfw queue 5 config pipe 2 weight 50 mask dst-ip 192.168.0.0/24
ipfw add queue 6 ip from any to 192.168.0.1 in
ipfw queue 6 config pipe 1 weight 10 mask dst-ip 192.168.0.1 dst-port 50000-50010


Any help, or links to places containing useful information about dummynet, would very much be appreciated. The documentation I've come about so far was very unsatisfying, and I can't help but thinking I missed out on something..
 
so, i played around with the rules a little more, this is what i ended up so far:

Code:
ipfw add 65534 allow ip from any to any

ipfw add 101 pipe 1 ip from [public_ip] to any out via fxp0
ipfw pipe 1 config bw 2048Kbit/s
ipfw add 102 queue 1 ip from 192.168.0.1 to any out
ipfw queue 1 config pipe 1 weight 10 mask src-ip 192.168.0.1 src-port 50000-50010
ipfw add 103 queue 2 ip from 192.168.0.0/24 to any out
ipfw queue 2 config pipe 1 weight 100 mask src-ip 192.168.0.0/24 dst-port 80, 443
ipfw add 104 queue 3 ip from 192.168.0.0/24 to any out
ipfw queue 3 config pipe 1 weight 50 mask src-ip 192.168.0.0/24

ipfw add 201 pipe 2 ip from any to [public_ip] in via fxp0
ipfw pipe 2 config bw 256Kbit/s
ipfw add 202 queue 4 ip from any to 192.168.0.1 in
ipfw queue 4 config pipe 2 weight 10 mask dst-ip 192.168.0.1 dst-port 50000-50010
ipfw add 203 queue 5 ip from any to 192.168.0.0/24 in
ipfw queue 5 config pipe 2 weight 100 mask dst-ip 192.168.0.0/24 src-port 80, 443
ipfw add 204 queue 6 ip from any to 192.168.0.0/24 in
ipfw queue 6 config pipe 2 weight 50 mask dst-ip 192.168.0.0/24

now, at least the traffic's going through the pipes but it's still not working out.
all the outbound traffic seems to go through queue#1, thus limiting the overall bandwidth to 25kbps, which seems reasonable given the weight.
i think it's due to ipfw not being able to distinguish between packages from the network clients and the router. what can i probably do about this?
 
Back
Top