Forum Discussion
James_Yang_9987
Apr 17, 2005Historic F5 Account
How to use iRules do Bandwidth management with P2P traffic?
The Typical P2P program is Bitorrent , eMule and eDonky。Because this type of program use P2P protocol to transfer file from one user directly to another. And do not need Server to download. So it’s ve...
bl0ndie_127134
Apr 20, 2005Historic F5 Account
From what I understand, BitTorrent clients generally listen on ports 6881–6889, so you could write a rule that looks for those ports in particular. The BitTorrent client to client handshake appears to be fairly easy to detect. The initial handshake has the following signature.
. handshake:
opstrlen: string length of , as a single raw byte
opstr: string identifier of the protocol
oreserved: eight (8) reserved bytes. All current implementations use all zeroes.
oinfo_hash: 20-byte SHA1 hash of the info key in the metainfo file.
opeer_id: 20-byte string used as a unique ID for the client.
In version 1.0 of the BitTorrent protocol, pstrlen=19, and pstr="BitTorrent protocol".
Once you determine that the signature matches this P2P protocol, you could apply a rate filter class that can be used to rate limit the exchange.
A harder way to do this would be to parse the ‘bencoded’ tracker .torrent metainfo file to determine the address and port in which the peers are listening on. This way, you won't have to care if the ports are dynamically generated. If you would like to take a shot at the rule, we would be more than happy to help improve it if necessary.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects