From: Jody Shumaker <jody.shumaker@gmail.com>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] HTB and bittorrent, won't work
Date: Thu, 07 Jul 2005 04:30:40 +0000 [thread overview]
Message-ID: <42CCAFF0.3030305@gmail.com> (raw)
In-Reply-To: <200507061623.38806.donvodka@gmail.com>
You need to use connection marking as well. --l7proto bittorrent will
only recognize the first packet in a bittorrent stream, you need to save
a mark on the whole tcp connection, and restore the mark for all future
packets if you want the entire connection to be classified.
iptables -t mangle -A lay7 -p tcp -j CONNMARK --restore-mark
iptables -t mangle -A lay7 -m layer7 --l7proto bittorrent -j MARK --set-mark 1
iptables -t mangle -A lay7 -o eth1 -m mark --mark 1 -j CLASSIFY --set-class 2:2
iptables -t mangle -A lay7 -m layer7 --l7proto smtp -j MARK --set-mark 2
iptables -t mangle -A lay7 -o eth1 -m mark --mark 2 -j CLASSIFY --set-class 2:3
iptables -t mangle -A lay7 -p tcp -m mark ! --mark 0 -j CONNMARK --save-mark
If you're marking ever gets more complex, it might take a little more work ( -j accepts for matching already classified connections after the --restore-mark) but the above should help get the full bittorrent connection classified, not just the first packet.
- Jody
Edgar wrote:
>Hello,
>
>I've been trying to shape the bittorrent traffic (on my external interface,
>upload), but without luck, for this I'm using layer7 filter right now, but
>I've also tried ipp2p, with the same results, I might say that this is not a
>problem with this packet classifiers, the problem is with HTB, here's why.
>When I open azureus (the bittorrent client I use) I see upload traffic
>getting shapped, but also I see that my download traffic won't go up if I'm
>shaping on the upload interface, if I stop shaping on that interface then
>upload ( as expected) will increase, and so the download rate, this happens
>to me using the default bittorrent client (classic), so its not a client
>problem. Ok, the problem here is that when using bittorrent, although I see
>the traffic is shaped I can't surf web pages, nor chat in msn messenger, nor
>do anything at all, and merely that's all I want to do, shape p2p traffic to
>be able to use my bandwidth fairly, maybe its a bittorrent problem, because
>with the edonkey protocol I have no problem at all, traffic get shaped and I
>can use the rest of my bandwidth, I'll post my iptables rules for marking the
>bittorrent packets and the htb rules I use (using tcng):
>
>### IPTABLES RULES ###
>iptables -t mangle -F
>iptables -t mangle -X
>iptables -t mangle -N lay7
>iptables -t mangle -A POSTROUTING -j lay7
>iptables -t mangle -A lay7 -m layer7 --l7proto bittorrent -j MARK --set-mark 1
>iptables -t mangle -A lay7 -o eth1 -m mark --mark 1 -j CLASSIFY --set-class
>2:2
>iptables -t mangle -A lay7 -m layer7 --l7proto smtp -j MARK --set-mark 2
>iptables -t mangle -A lay7 -o eth1 -m mark --mark 2 -j CLASSIFY --set-class
>2:3
>
>### HTB RULES ###
>
>#define UPLOAD eth1
>#define UPRATE 25kBps
>#define P2P 10kBps
>
>dev UPLOAD {
> egress {
> class ( <$emule> ) ;
> class ( <$smtp> ) ;
> class ( <$ssh> ) if tcp_dport = 8080 ; /*Changed port from 22 to 8080 */
> class ( <$otro> ) if 1 ;
>
> htb () {
> class ( rate UPRATE, ceil UPRATE ) {
> $emule = class ( prio 8, rate 6kBps, ceil P2P ) { sfq; } ;
> $smtp = class ( prio 1, rate 6kBps, ceil 12kBps ) { sfq; } ;
> $ssh = class ( prio 0, rate 3kBps, ceil 5kBps) { sfq; } ;
> $otro = class ( prio 1, rate 8kBps, ceil UPRATE ) { sfq; } ;
> }
> }
> }
>}
>
>Also, given the priorities it's expected to let me surf the web or chat in msn
>messenger rather than take my whole bandwidth.
>
>I hope someone can help me out with this, maybe it not ok to use tcng with
>iptables? thank you in advance
>
>EDGAR MERINO
>_______________________________________________
>LARTC mailing list
>LARTC@mailman.ds9a.nl
>http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
>
>
>
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
next prev parent reply other threads:[~2005-07-07 4:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-06 21:23 [LARTC] HTB and bittorrent, won't work Edgar
2005-07-07 4:29 ` Andreas Klauer
2005-07-07 4:30 ` Jody Shumaker [this message]
2005-07-07 4:51 ` Edgar
2005-07-07 5:42 ` Edgar
2005-07-07 7:22 ` Klaus
2005-07-07 11:36 ` Forte Systems - Iosif Peterfi
2005-07-07 20:34 ` Edgar
2005-07-08 8:49 ` Forte Systems - Iosif Peterfi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42CCAFF0.3030305@gmail.com \
--to=jody.shumaker@gmail.com \
--cc=lartc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.