# How to queue ftp-proxy traffic in both directions?



## BLASTER (Mar 4, 2009)

Hello,

I'm using freebsd7 as a gateway with ALTQ + PF for traffic shaping in two directions. Also I'm using ftp-proxy for ftp connections to the local server from outside.

My question is, is it possible to shape ftp traffic in both directions?

ftp-proxy in freebsd7 supports queue for the rules it creates, but doesn't support tags (which would solve the problem). This is what my rc.conf looks like:

```
ftpproxy_enable="YES"
ftpproxy_flags="-q FTPPROXY -R 192.168.0.8"
```
When ftp-proxy is working, it creates two rules with the same queue name (FTPPROXY in our case) via _anchor "ftp-proxy/*"_, like these ones:

```
pass in quick inet proto tcp from 91.78.191.70 to 192.168.0.8 port = 50001 flags S/SA keep state (max 1) queue FTPPROXY rtable 0
pass out quick inet proto tcp from 192.168.0.1 to 192.168.0.8 port = 50001 flags S/SA keep state (max 1) queue FTPPROXY rtable 0
```
It seems that the problem is that there is no way to create queues with the same name on different interfaces, so we can queue traffic on only one interface, but not on both. The following:

```
altq on $int_if bandwidth 100Mb hfsc queue { dflt, user1, user2 }
...
altq on $ext_if bandwidth 100Mb hfsc queue { dflt, user1, user2 } 
...
```
causes an error: queue dflt already exists on interface fxp1.
(Why this is unallowable, I don't understand. It would be very convenient to have one queue name (e.g. user1) defined on both router interfaces. The shaping parameters for that queue could be different for different interfaces and the number of rules would reduce.) 

At the same time, it's possible to use following:

```
altq on {$int_if, $ext_if} bandwidth 100Mb hfsc queue { dflt, user1, user2 }
...
```
Now we have the same queue names for both interfaces, but only with the same shaping parameters. (Why we can't have a queue with different parameters, but only with the same ones â€” that's something I don't understand too.) My internet connection has asymmetric bandwidth, so this above is not a solution for me. 

Is there any way to solve this problem?

Thanks.


----------



## BLASTER (Mar 12, 2009)

It seems that there is no solution for current version of ftp-proxy in Freebsd7, because it has not tags as opposed to ftp-proxy in Openbsd. The only way to queue proxy's traffic on both interfaces is to use default queues for it, so it is no so good solution.

Now, I disable ftp-proxy and just redirect some range of ports for ftp-server on $ext_if, and queue it in an conventional way.


----------

