# PF ALTQ + transmission daemon



## lemurid (Mar 30, 2010)

I am trying to limit upload priority of transmission daemon. But a little bit confused how to set the rule to tag transmission's traffic to the right queue. Sockstat shows me that except for peer port which is set to 6889 i have a lot of connections on ports 19000-45000 used by transmission


----------



## DutchDaemon (Mar 30, 2010)

You can add traffic sent by/to a user/group to a queue, see the user <user> and group <group> directives in pf.conf(5).

A starting point would be something like this:


```
pass  out quick inet proto tcp all user transmission modulate state queue( torrents, acks )
pass  out quick inet proto udp all user transmission keep state queue( torrents, acks )
pass  in quick inet proto { tcp udp } all user transmission keep state queue( torrents, acks )
```


----------



## lemurid (Mar 31, 2010)

Thanks that's excelent idea.
But is there any point in 

```
pass  in quick inet proto { tcp udp } all user transmission keep state queue( torrents, acks )
```
As that will put the traffic in queue when it has already reached the BSD box, that can lead to dropped packets and the other side resending them again and again, leading even to more clogged channel. Correct? Or i am missing something?


----------



## DutchDaemon (Mar 31, 2010)

Only *outbound* traffic gets queued if you use altq on the Internet side. All traffic on pass-in and pass-out rules should be put in queues. In the case of pass-in queuing the *return traffic* caused by incoming connections (like outbound tcp acks, udp low-delay, served content from your web sites etc.) gets queued correctly.


----------



## sniper007 (Apr 2, 2010)

I figure out that the best way to queue transmission trafic is to sent all traffic to standard queue and than create some additional queues with higher priority for other more importat traffic:

something like that:


```
queue std_out           priq(default)
queue http              priority 9
queue radio_ntp         priority 10
queue rdp               priority 11
queue ssh               priority 12
queue dns               priority 13
```

it works like a charm, queues with high priority number doesn't have any dropped packets


```
queue std_out on ng0 priq( default )
  [ pkts:     497414  bytes:   64744899  dropped pkts:     69 bytes:  69024 ]
  [ qlength:   0/ 50 ]
  [ measured:     0.3 packets/s, 98.40 b/s ]
queue http on ng0 priority 9
  [ pkts:     824986  bytes:   74476953  dropped pkts:    638 bytes: 141320 ]
  [ qlength:   0/ 50 ]
  [ measured:     8.0 packets/s, 2.63Kb/s ]
queue radio_ntp on ng0 priority 10
  [ pkts:     563636  bytes:   38168645  dropped pkts:     19 bytes:   1463 ]
  [ qlength:   0/ 50 ]
  [ measured:     0.4 packets/s, 246.40 b/s ]
queue rdp on ng0 priority 11
  [ pkts:     115452  bytes:   15769529  dropped pkts:     79 bytes:  48943 ]
  [ qlength:   0/ 50 ]
  [ measured:     0.0 packets/s, 0 b/s ]
queue ssh on ng0 priority 12
  [ pkts:      13224  bytes:    3375760  [B]dropped pkts:      0 bytes:      0[/B] ]
  [ qlength:   0/ 50 ]
  [ measured:     0.9 packets/s, 5.64Kb/s ]
queue dns on ng0 priority 13
  [ pkts:      28684  bytes:    2178507  [B]dropped pkts:      0 bytes:      0[/B] ]
  [ qlength:   0/ 50 ]
  [ measured:     0.0 packets/s, 0 b/s ]
```


----------

