All of lore.kernel.org
 help / color / mirror / Atom feed
* [LARTC] Incoming trafic shaping (depending on src IP)
@ 2001-02-20 10:47 Spyou
  2001-02-20 13:40 ` bert
  2001-02-23  3:07 ` Oki
  0 siblings, 2 replies; 3+ messages in thread
From: Spyou @ 2001-02-20 10:47 UTC (permalink / raw)
  To: lartc

<PRE>
Hi there,


i'm trying to shape incoming trafic on my linux box.

I want it to depend on the source IP adress of the packets (in fact, i got 
a VPN on an ADSL link and wanted to get at least/max 64Kbit/s for the VPN)

So i tried this :

tc qdisc add dev ppp0 root handle 1:0 cbq bandwidth 512Kbit avpkt 1000 cell 8
tc class add dev ppp0 parent 1:0 classid 1:1 cbq bandwidth 512Kbit rate 
512Kbit weight 50Kbit prio 8 allot 1514 cell 8 maxburst 20 avpkt 1000
tc class add dev ppp0 parent 1:1 classid 1:10 cbq bandwidth 512Kbit rate 
64Kbit weight 6Kbit prio 8 allot 1514 cell 8 maxburst 20 avpkt 1000 bounded 
isolated
tc qdisc add dev ppp0 parent 1:10 tbf rate 64Kbit buffer 10Kb/8 limit 15Kb 
mtu 1500
tc filter add dev ppp0 parent 1:0 protocol ip prio 100 u32 match ip src 
&lt;the SRC IP of my VPN&gt; flowid 1:10

Okay, so, with this, packets comming trought ppp0 and from &lt;the SRC IP of 
my VPN&gt; should be shaped at 64Kbit/s, right ?

Where's my error ? Is there something more simple (eg. with iptables and 
packet marking ?)


thx for help :)
____________________________________
  'Spyou' - www.spyou.org - <A HREF="mailto:root@spyou.org">root@spyou.org</A>
     #gtr / ircnet.grolier.net - UIN : 6871374

We've done so much, for so long, with so little
We're now qualified to do anything with nothing.



</PRE>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [LARTC] Incoming trafic shaping (depending on src IP)
  2001-02-20 10:47 [LARTC] Incoming trafic shaping (depending on src IP) Spyou
@ 2001-02-20 13:40 ` bert
  2001-02-23  3:07 ` Oki
  1 sibling, 0 replies; 3+ messages in thread
From: bert @ 2001-02-20 13:40 UTC (permalink / raw)
  To: lartc

<PRE>On Tue, Feb 20, 2001 at 11:47:25AM +0100, Spyou wrote:

&gt;<i> tc filter add dev ppp0 parent 1:0 protocol ip prio 100 u32 match ip src 
</I>&gt;<i> &lt;the SRC IP of my VPN&gt; flowid 1:10
</I>&gt;<i> 
</I>&gt;<i> Okay, so, with this, packets comming trought ppp0 and from &lt;the SRC IP of 
</I>&gt;<i> my VPN&gt; should be shaped at 64Kbit/s, right ?
</I>
This line shapes outgoing traffic with a source address of your VPN!

&gt;<i> Where's my error ? Is there something more simple (eg. with iptables and 
</I>&gt;<i> packet marking ?)
</I>
Look into the ingress scheduler.

Regards,

bert

-- 
<A HREF="http://www.PowerDNS.com">http://www.PowerDNS.com</A>      Versatile DNS Services  
Trilab                       The Technology People   
'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet


</PRE>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [LARTC] Incoming trafic shaping (depending on src IP)
  2001-02-20 10:47 [LARTC] Incoming trafic shaping (depending on src IP) Spyou
  2001-02-20 13:40 ` bert
@ 2001-02-23  3:07 ` Oki
  1 sibling, 0 replies; 3+ messages in thread
From: Oki @ 2001-02-23  3:07 UTC (permalink / raw)
  To: lartc

<PRE>On Tue, 20 Feb 2001, Spyou wrote:
&gt;<i> i'm trying to shape incoming trafic on my linux box.
</I>
I think putting the following on your system is a must:
<A HREF="http://defiant.coinet.com/iproute2/equinox/cbq_init.html">http://defiant.coinet.com/iproute2/equinox/cbq_init.html</A>
 
&gt;<i> I want it to depend on the source IP adress of the packets (in fact, i got 
</I>&gt;<i> a VPN on an ADSL link and wanted to get at least/max 64Kbit/s for the VPN)
</I>&gt;<i> 
</I>&gt;<i> So i tried this :
</I>[all those commands that would make iproute newbies like hitting a thick
wall at 100mph; and after two weeks, the wall is as thick as before;
deleted] 

&gt;<i> Okay, so, with this, packets comming trought ppp0 and from &lt;the SRC IP of 
</I>&gt;<i> my VPN&gt; should be shaped at 64Kbit/s, right ?
</I>
It is explained that iproute limits outgoing bandwidth only (&quot;outgoing&quot;
if seen _from_ your net devices). Recently, I tried something that seems
to be working; my setup:

          128Kbit      100Mbit  
[Internet]-------[eth1]-------[eth0]
                              192.168.1.x
                              Squid

I wanted to limit web access to about 40Kbit. The entry file for cbq.init:
DEVICE=eth0,100Mbit,10Mbit
RATE@Kbit
WEIGHT=4Kbit
PRIO=7
RULE=:80,192.168.1.x
BOUNDED=no
ISOLATED=yes

Meaning: the device used is eth0, at 100Mbit. Transfer rate is at 40Kbit. 
The traffic from port 80, from any addresses that go to 192.168.1.x, will
use 40Kbit, at least. It is unbounded, so if the line still permits
(128Kbit), the traffic from port 80 would borrow the remaining bandwidth.
But the limiter has priority of 7, which will release the borrowed
bandwidth to any higher (1-6) priority limiters.

I thought that this setting wouldn't work. But it seems that iproute
limits the traffic &quot;from eth0 to 192.168.1.x&quot;; which, in a sense, is
&quot;outgoing&quot;.

I monitor the traffic using MRTG, the graphs are fine. And also, cbg.init
has &quot;stats&quot; command so you can see which unbounded limiters that borrow
bandwidth from the others.  

&gt;<i> Where's my error ? 
</I>
For not using cbq.init...?

&gt;<i>Is there something more simple (eg. with iptables and 
</I>&gt;<i> packet marking ?)
</I>
You can use iptables along with cbq.init (no, cbq.init doesn't support
packet marking yet); all you need is to name the entry-files correctly
(the names become the classid of the limiters), and then execute iptables
for packet filtering after cbq.init (use the flowid's accordingly;
according to the entry-file names).

Oki
ps: the above cbq.init's config would have problem if the machine accessed
other internal machines at port 80; so the web traffic would be limited
also.  But for the problem that was at hand, is no problem. 
 
--
					So much free software
					So little time...



</PRE>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-02-23  3:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-02-20 10:47 [LARTC] Incoming trafic shaping (depending on src IP) Spyou
2001-02-20 13:40 ` bert
2001-02-23  3:07 ` Oki

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.