This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Bittorrent Client works, but...

My bittorrent client does work very well, but to achieve that I have to set the following packet filter rule:

Source: MyIP -> Service:Any -> Destination:Any 
allways allowed

I had to define this rule cos the ASG had blocked all packets sending from myIP with random outgoing ports. And these connection seems to be needed for using the bittorrent network.[:S]


This thread was automatically locked due to age.
Parents Reply Children
  • Predictable source port? how?

    I think the outgoing port could be the port the other torrentusers have on thei clients. So I have to select almost every port above 1024?
  • Each TCP connection has a SOURCE port and a DEST port.

    If these are outgoing from your internal PC, then the SOURCE port is determined by the software or TCP stack on your PC; it is NOT the other user's port.

    Therefore, if you BT client keeps it's outgoing connections on a single SOURCE port (or a range), you can create rules based upon that source port.

    Vuze (nee Azureus), for example, makes all of it's outgoing connections on the same port you configure for incoming traffic.
    e.g., I have it set for 56881, and I ran IPTraf, and I see all connections to my PC are to/from port 56881.

    Therefore,
    I have definitions for
    TCP/UDP 1024:65535 → 56881
    and
    56881 → 1:65535

    and  I have PF rules (and NAT and QOS settings) to match.

    Barry
  • Thanks a lot for your explanation :-)

    I am using Transmission, and do not find any switches to adjust the portrange. It seems to be accidentally.
  • Each TCP connection has a SOURCE port and a DEST port.

    If these are outgoing from your internal PC, then the SOURCE port is determined by the software or TCP stack on your PC; it is NOT the other user's port.

    Therefore, if you BT client keeps it's outgoing connections on a single SOURCE port (or a range), you can create rules based upon that source port.

    Vuze (nee Azureus), for example, makes all of it's outgoing connections on the same port you configure for incoming traffic.
    e.g., I have it set for 56881, and I ran IPTraf, and I see all connections to my PC are to/from port 56881.

    Therefore,
    I have definitions for
    TCP/UDP 1024:65535 → 56881
    and
    56881 → 1:65535

    and  I have PF rules (and NAT and QOS settings) to match.

    Barry


    Hi Barry

    could you please explain me howto configure the NAT rule and the pf rules?
    i try some but it didn´t work for me[:(]

    THX A LOT and regards
    ACID25
  • Hi Barry

    could you please explain me howto configure the NAT rule and the pf rules?
    i try some but it didn´t work for me[:(]

    THX A LOT and regards
    ACID25


    Hi ACID25

    I am using utorrent and the NAT and PF will be the same (you have to change the ports and client ip that uses the torrent client)


    Definitions:
    ------------
    under network create client_A(basically the pc that uses the torrent )
    Service:  define the ports for utorrent (destination port :***x)


    Packet Filter
    --------
    source :Any
    service :utorrent
    Destination: client_A

    Nat
    ------
    traffic source: Any
    Traffic service :utorrent
    traffic destination: external wan ip
    Nat mode: DNAT
    destination: client_A
    destination service: nothing
    automatic pf rule unchecked

    Now if you configure the same but change the ports to the correct ones(i think bittorrent uses range of ports whereas utorrent uses one) and configure the client everything should work

    hope that helps!
  • Exactly as Wingman said.

    It gets messier if you don't use a client that uses a single port for all torrents, so try to use one that does. Azureus/Vuze works fine for me, but uTorrent reportedly uses much less RAM.

    However, Hans asked earlier about controlling outgoing traffic, so the outgoing rule could look like this:
    source PC, service BitTorrentOUT, dest any, allow
    where BitTorrentOUT is defined as 
    TCP/UDP
    source port: port # you've configured in the client (e.g. 6881).
    dest port 1024:65535

    Barry
  • Exactly as Wingman said.

    It gets messier if you don't use a client that uses a single port for all torrents, so try to use one that does. Azureus/Vuze works fine for me, but uTorrent reportedly uses much less RAM.

    However, Hans asked earlier about controlling outgoing traffic, so the outgoing rule could look like this:
    source PC, service BitTorrentOUT, dest any, allow
    where BitTorrentOUT is defined as 
    TCP/UDP
    source port: port # you've configured in the client (e.g. 6881).
    dest port 1024:65535

    Barry


    Barry I haven't defined outgoing traffic and utorrent works fine. Is it something that you have to configure?
  • If you already have another rule for outgoing traffic (e.g. INT, ANY, ANY), then you're fine.
    The original poster had asked though, so I wanted to make sure I covered that too.

    Barry
  • If you already have another rule for outgoing traffic (e.g. INT, ANY, ANY), then you're fine.
    The original poster had asked though, so I wanted to make sure I covered that too.

    Barry


    I have no torrent outgoing related traffic at all.I've just checked the logs and I need to allow outgoing traffic as well

    2009:03:29-22:08:25 Astaro ulogd[3283]: id="2001" severity="info" sys="SecureNet" sub="packetfilter" name="Packet dropped" action="drop" fwrule="60002" seq="0" initf="eth1" outitf="eth1" dstmac="00:b0:c2:02:e4:4f" srcmac="00:b0:c2:02:e3:c7" srcip="192.168.2.40" dstip="79.166.170.181" proto="17" length="95" tos="0x00" prec="0x00" ttl="127" srcport="54355" dstport="80" 
    2009:03:29-22:08:26 Astaro ulogd[3283]: id="2001" severity="info" sys="SecureNet" sub="packetfilter" name="Packet dropped" action="drop" fwrule="60002" seq="0" initf="eth1" outitf="eth1" dstmac="00:b0:c2:02:e4:4f" srcmac="00:b0:c2:02:e3:c7" srcip="192.168.2.40" dstip="79.103.93.31" proto="17" length="95" tos="0x00" prec="0x00" ttl="127" srcport="54355" dstport="48674" 
    2009:03:29-22:08:26 Astaro ulogd[3283]: id="2001" severity="info" sys="SecureNet" sub="packetfilter" name="Packet dropped" action="drop" fwrule="60002" seq="0" initf="eth1" outitf="eth1" dstmac="00:b0:c2:02:e4:4f" srcmac="00:b0:c2:02:e3:c7" srcip="192.168.2.40" dstip="85.74.87.97" proto="6" length="48" tos="0x00" prec="0x00" ttl="127" srcport="57118" dstport="16595" tcpflags="SYN" 
    2009:03:29-22:08:26 Astaro ulogd[3283]: id="2001" severity="info" sys="SecureNet" sub="packetfilter" name="Packet dropped" action="drop" fwrule="60002" seq="0" initf="eth1" outitf="eth1" dstmac="00:b0:c2:02:e4:4f" srcmac="00:b0:c2:02:e3:c7" srcip="192.168.2.40" dstip="79.107.205.217" proto="6" length="48" tos="0x00" prec="0x00" ttl="127" srcport="57117" dstport="35498" tcpflags="SYN" 
    2009:03:29-22:08:27 Astaro ulogd[3283]: id="2001" severity="info" sys="SecureNet" sub="packetfilter" name="Packet dropped" action="drop" fwrule="60002" seq="0" initf="eth1" outitf="eth1" dstmac="00:b0:c2:02:e4:4f" srcmac="00:b0:c2:02:e3:c7" srcip="192.168.2.40" dstip="85.75.251.40" proto="6" length="48" tos="0x00" prec="0x00" ttl="127" srcport="57119" dstport="63593" tcpflags="SYN" 
    2009:03:29-22:08:31 Astaro ulogd[3283]: id="2001" severity="info" sys="SecureNet" sub="packetfilter" name="Packet dropped" action="drop" fwrule="60002" seq="0" initf="eth1" outitf="eth1" dstmac="00:b0:c2:02:e4:4f" srcmac="00:b0:c2:02:e3:c7" srcip="192.168.2.40" dstip="79.166.255.94" proto="6" length="40" tos="0x00" prec="0x00" ttl="127" srcport="54355" dstport="58271" tcpflags="ACK FIN" 
    2009:03:29-22:08:32 Astaro ulogd[3283]: id="2001" severity="info" sys="SecureNet" sub="packetfilter" name="Packet dropped" action="drop" fwrule="60002" seq="0" initf="eth1" outitf="eth1" dstmac="00:b0:c2:02:e4:4f" srcmac="00:b0:c2:02:e3:c7" srcip="192.168.2.40" dstip="77.49.117.47" proto="17" length="95" tos="0x00" prec="0x00" ttl="127" srcport="54355" dstport="38735" 
    2009:03:29-22:08:33 Astaro ulogd[3283]: id="2001" severity="info" sys="SecureNet" sub="packetfilter" name="Packet dropped" action="drop" fwrule="60002" seq="0" initf="eth1" outitf="eth1" dstmac="00:b0:c2:02:e4:4f" srcmac="00:b0:c2:02:e3:c7" srcip="192.168.2.40" dstip="93.97.171.4" proto="17" length="95" tos="0x00" prec="0x00" ttl="127" srcport="54355" dstport="19087" 
    2009:03:29-22:08:36 Astaro ulogd[3283]: id="2001" severity="info" sys="SecureNet" sub="packetfilter" name="Packet dropped" action="drop" fwrule="60001" seq="0" initf="eth2" outitf="eth2" dstmac="00:b0:c2:02:e3:c7" srcmac="00:00:00:00:00:00" srcip="192.168.0.10" dstip="86.160.205.109" proto="17" length="306" tos="0x00" prec="0x00" ttl="64" srcport="67" dstport="68"



    I need to verify though, which ports are need for utorrent /outgoing traffic

    I found that I need to do the following:

    Action = Allow 
    Protocol = TCP
    Direction = Out
    Description = Rule for outgoing TCP connections
    Source Address = utorrent client
    Destination Address = Any
    Source port = A port range = (start port = 1025 / end port = 65535)
    Destination port = A port range = (start port = 1025 / end port = 65535)


    Action = Allow 
    Protocol = UDP
    Direction = Out
    Description = Rule for outgoing UDP connections
    Source Address = utorrent client
    Destination Address = Any
    Source port = the port of utorrent
    Destination port = A port range = (start port = 1025 / end port = 65535)




    The range is huge. Can someone confirm that that's normal?(These ports can be limited using net.outgoing_port functionality .I am more concern about the rule itself )
  • Hi 

    thx for your help, so here´s what i did but it didn´t work for me

    vuze port is 6881
    service definitions OUT
    bittorent_OUT TCP/UDP 6881 → 1:65535
    service definitions IN
    bittorent_IN TCP/UDP 1024:65535 → 6881

    define the client pc under network

    create pf rules
    client -> bittorent_OUT -> any
    any -> bittorent_IN -> client

    and the NAT rule
    DNAT [bittorrent]
    Traffic selector: Any → bittorent_OUT → External (WAN) (Address)
    Destination translation: client

    mmh so what is wrong here, any hint are welcome, thx for helping me!!!

    best regards
    ACID25