From: Georgi Alexandrov <georgi.alexandrov@gmail.com>
To: lartc@vger.kernel.org
Subject: Re: [LARTC] shareaza
Date: Sun, 11 Dec 2005 15:30:55 +0000 [thread overview]
Message-ID: <439C462F.6050308@gmail.com> (raw)
In-Reply-To: <20051211144541.GA4079@ncrfgs3.ncrfgs>
ncrfgs wrote:
>Hi,
>
>A, B and C are three machines. A and C directly access to
>theInternet while B access to the Internet through A.
>
> +-------------------------------------------------------------+
> | +-------------+ +-------------+ |
> | | A | | B | |
> | | | --- eth0 ---> <--- eth0 --- | | |
> | | 192.168.0.1 | | 192.168.0.2 | |
> | +-------------+ +-------------+ |
> +-------------------------------------------------------------+
> |
> ppp0
> |
> v
> Internet
> ^
> |
> +---+
> | C |
> +---+
>
>A runs GNU/Linux and is configured to MASQUERADE B and in
>such a way that packets incoming on ppp0 are DROP'd unless
>their state is either ESTABLISHED or RELATED or unless
>their destination is port 6346 (both tcp and udp), in which
>case they are redirected to B.
>
>B runs Shareaza, a P2P that is able to access several kind
>of networks such as edonkey, gnutella and gnutella2 and it
>should only use port 6346.
>
>
>I'd like to shape outgoing traffic, that is, I'd like to
>limit the bandwidth B uses to upload files over the
>Internet.
>
>I'm sharing the connection with other individuals and I
>don't have much control over B... I only have very little
>informations about it, sorry, and most of them comes from
>tcpdump.
>
>
>If B uploads a file to C through gnutella everything works
>like a charm since packets look just like this:
>
> 192.168.0.2:6346 > xxx.xxx.xxx.xxx:yyyyy
>
>With tc I filter packets whose source port is 6346 and
>everything is fine.
>
>
>Problems come when B uploads a file to C through edonkey.
>Packets don't always look like the former ones. Sometimes
>the source port is 6346 in this case as well, but more
>often they look like this:
>
> 192.168.0.2:zzzzz > xxx.xxx.xxx.xxx:4662
>
>Port 4662 is the most common one but it isn't always the
>same.
>
>
>How can I work around it?
>
>
>
>Thanks in advance.
>
>Best regards.
>
>
You can classify the traffic from B going out trough ppp0 with
netfilter/iptables like this:
iptables -t mangle -A POSTROUTING -o ppp0 -s 192.168.0.2 -j CLASSIFY
--set-class 0001:0010
And then shape it:
tc qdisc del dev ppp0 root
tc qdisc add dev ppp0 root handle 1: htb
tc class add dev ppp0 parent 1: classid 1:1 htb rate 128kbit
tc class add dev ppp0 parent 1:1 classid 1:10 htb rate 128kbit
tc qdisc add dev ppp0 parent 1:10 handle 10: sfq perturb 10
that's for 128kbits/sec upload from 192.168.0.2.
I've attached a sfq to the htb class for "smoothness".
regards,
Georgi Alexandrov
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
next prev parent reply other threads:[~2005-12-11 15:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-11 14:45 [LARTC] shareaza ncrfgs
2005-12-11 15:30 ` Georgi Alexandrov [this message]
2005-12-11 17:00 ` ncrfgs
2005-12-11 17:12 ` Andreas Unterkircher
2005-12-11 17:49 ` ncrfgs
2005-12-11 18:45 ` Andreas Unterkircher
2005-12-11 20:03 ` Georgi Alexandrov
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=439C462F.6050308@gmail.com \
--to=georgi.alexandrov@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox