|
|
|
|
|
|
|
|
|
|
xen-users
Re: [Xen-users] Rate limiting for guests via ebtables
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
|
|
|
|
|