WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

Re: [Xen-users] Rate limiting for guests via ebtables

To: tim.post@xxxxxxxxxxxxxxx
Subject: Re: [Xen-users] Rate limiting for guests via ebtables
From: "Peter Braun" <xenware@xxxxxxxxx>
Date: Mon, 27 Nov 2006 22:12:32 +0100
Cc: Xen users mailing list <xen-users@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Mon, 27 Nov 2006 13:12:46 -0800
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=nd8LXaczKTLgPsttc3JpSBdgUFDnJjhn8LdVAtT7Bb2I2VjfdJFbvM5YjFiEh33t6vC8HOjiHvztgOSD6XUFI51ULY67ybTJukV/emlpZyVHRSl7XJuurYsPS5vWh2XuApYp+BJ7fzDTjhcesGaDRZO25bCid/32XTCREJD1zPg=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <1164605920.14309.377.camel@tower>
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
References: <1164605920.14309.377.camel@tower>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
Hello to all,

the only mention about guest bandwidth limiting in dom0 I have found
on internet is from

Carson McDonald.

You can find original on his blog:
http://www.ioncannon.net/system-administration/57/limiting-bandwidth-usage-on-xen-linux-setup/

Xen seems to be gaining speed these days and has a lot of useful
features for those who want to resale or otherwise split a single box.
Now that you have your Xen system set up you may be interested in
going farther with bandwidth limiting.

The hardest part of setting up bandwidth limiting is understanding the
traffic control system under Linux. This mainly revolves around the tc
command.

The first thing you will want to do is select a queue discipline.
Although you can select from a number of disciplines I picked HTB for
the following instructions because it seems to be the simplest to set
up. All of the following is done on Xen0.

  1. The first thing you will need to do is find the name of your
real ethernet device. This seems to change depending on what version
of Xen you are running. For my setup it was peth0 and I was able to
find it by looking at dmesg right after the system booted.
  2. After finding the name of your ethernet device you will need to
set up a default queuing discipline that will catch anything that
doesn't hit a child rule. Here we set the handle to 1 and a class sub
id of 99.
     tc qdisc add dev peth0 root handle 1: htb default 99
  3. Next we define a default rate that will be used as a total for
all child rates as well as anything that doesn't fall into a child
bucket. In this case I'm setting the total rate to 20mbps with a burst
of 15k.
     tc class add dev peth0 parent 1: classid 1:1 htb rate 20mbps burst 15k

     Setting a burst lets small amounts of traffic go faster than the
normal rate. The burst is also shared with the children so make sure
to set it higher than any one child. Also note that parent 1:
references the parents classid that we created above.
  4. Now that we have our default class and rate set up we set up
child classes and rates for each node. Here I set up classes for 2
XenU nodes and the Xen0 node.
     tc class add dev peth0 parent 1:1 classid 1:13 htb rate 5mbps burst 15k
     tc class add dev peth0 parent 1:1 classid 1:14 htb rate 10mbps burst 15k
     tc class add dev peth0 parent 1:1 classid 1:99 htb rate 5mbps burst 15k

     Note that the parent classid is referenced here as 1:1 that we
created above. We also assign each bucket its own unique classid.
  5. Now we need to determine who gets serviced in what order. In
this example I use sfq for each class so that each class should get
equal time as traffic is coming in.
     tc qdisc add dev peth0 parent 1:13 handle 13: sfq perturb 10
     tc qdisc add dev peth0 parent 1:14 handle 14: sfq perturb 10
     tc qdisc add dev peth0 parent 1:99 handle 22: sfq perturb 10
  6. Now the final step is to attach the defined classes to the
routing system. This is done by using iptables and the given classid
from the class setup step.
     iptables -t mangle -A POSTROUTING -p tcp -s 192.168.1.103 -j
CLASSIFY –set-class 1:13
     iptables -t mangle -A POSTROUTING -p tcp -s 192.168.1.104 -j
CLASSIFY –set-class 1:14
     iptables -t mangle -A POSTROUTING -p tcp -s 192.168.1.111 -j
CLASSIFY –set-class 1:21


Hope this will help you.


BR

Peter






2006/11/27, Tim Post <tim.post@xxxxxxxxxxxxxxx>:
Hello to all,

I've got some guests that are really beginning to become bandwidth hogs.
Some of them are file mirrors, some of them are just simple ftp backup
servers.

I'd like to try ebtables with my public bridges to try and tame things a
bit, and was wondering if anyone has some snippets or scripts they would
like to share.

I'm new to ebtables, and am finding it a little bit of a leap from my
familiar ground (iptables). The servers I need to adjust are in
production, so my hope is to fully understand it prior to going in and
effecting changes.

I love to learn by example ... so if anyone has something (even trivial)
using ebtables to help limit guests, I'd love to take a look at it if
you don't mind sharing :) All of my guests have static macs.

Thanks in advance!

Best,
--Tim


_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users


_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users

<Prev in Thread] Current Thread [Next in Thread>