# rtorrent and ipf settings



## rblon (Apr 19, 2011)

I am using IPFILTER and an inclusive ruleset. But I don't get rtorrent to work. If I disable the firewall (i.e. let all outgoing and incoming traffic pass), rtorrent works fine.

In ~/.rtorrent.rc I have the following setting

```
# Port range to use for listening
port_range = 6890-6999
```

And in /etc/ipf.rules I have added the following rule

```
pass out quick on re0 proto tcp from any to any port 6890 >< 6999 flags S keep state
```

I am not sure if I should add a rule for incoming traffic, but I tried that and it didn't solve the issue.


----------



## SirDice (Apr 19, 2011)

The port range for listening is for incoming traffic, not outgoing. You'll need to allow all traffic out because torrent clients run on all sorts of ports.


----------



## rblon (Apr 19, 2011)

Ok thanks, that sounds logical. But I am still not getting there...

I have changed the last line for the outgoing rules

```
#block out log first quick on re0 all
pass out quick on re0 all
```
which basically makes all the outgoing rules redundant...

And I have added to the incoming rules:

```
pass in quick on re0 proto tcp/udp from any to any port 6890 >< 6999
```

just before

```
block in log first quick on re0 all
```

But it still doesn't work.

Also, I am bit confused about this incoming rule. The FreeBSD machine is behind a router with firewall, which is not configured to forward ports 6890-6999. But rtorrent works fine when IPF passes all traffic.


----------



## SirDice (Apr 19, 2011)

You need to open and forward the ports on your router too. Bittorrents will work without but it will be very slow.


----------



## rblon (Apr 19, 2011)

The router allows all outgoing traffic, it is just not forwarding those incoming ports.

But:

* when IPF passes all traffic, rtorrent seems to work fine, both downloading and uploading (perhaps it can go faster when forwarding the incoming ports, as you suggest, but speed appears to be ok).
* when I have an inclusive incoming ruleset, rtorrent is not working at all

So it seems I am still missing something.


----------

