OpenVZ Forum


Home » General » Support » tc htb question regarding sharing bandwidth (How do I limit each connection while using the total uplink?)
icon5.gif  tc htb question regarding sharing bandwidth [message #47874] Mon, 17 September 2012 19:28 Go to next message
KuJoe is currently offline  KuJoe
Messages: 11
Registered: November 2011
Junior Member
Here's the issue I am facing:

I have a 1Gbps port on my host node and would like to limit each container to 100Mbps. The problem is, I cannot find a way to cap each connection at 100Mbps while utilizing the 1Gbps "pool" (i.e. 10 100Mbps connections, 20 50Mbps connections, etc...). I have it setup so with a rate limit of 100Mbps, but when 2 downloads are running it will take the 100Mbps and divide it by 2. I would like each of the connections to be able to download at 100Mbps. I'm out of ideas.

tc qdisc del dev venet0 root
tc qdisc add dev venet0 root handle 1: htb default 10
tc class add dev venet0 parent 1: classid 1:1 htb rate 1000mbit burst 15k
tc class add dev venet0 parent 1:1 classid 1:10 htb rate 100mbit burst 15k
tc qdisc add dev venet0 parent 1:10 handle 10: sfq perturb 10
Re: tc htb question regarding sharing bandwidth [message #47882 is a reply to message #47874] Tue, 18 September 2012 13:50 Go to previous messageGo to next message
shaggy63 is currently offline  shaggy63
Messages: 4
Registered: August 2011
Junior Member
Do an ifconfig on the host. Do you have a separate virtual adapter for each guest? If so set the dev class to each virtual adapter for each guest.
Re: tc htb question regarding sharing bandwidth [message #47960 is a reply to message #47882] Thu, 20 September 2012 01:31 Go to previous messageGo to next message
KuJoe is currently offline  KuJoe
Messages: 11
Registered: November 2011
Junior Member
Nope, only venet0.
Re: tc htb question regarding sharing bandwidth [message #47965 is a reply to message #47874] Thu, 20 September 2012 13:54 Go to previous message
dr4g0nl0rd is currently offline  dr4g0nl0rd
Messages: 17
Registered: May 2008
Junior Member
Limit to 10Mbit in / out

WANDEV="eth0"
LANDEV="venet0"
TC="/sbin/tc"
IPTABLES="/sbin/iptables"

$TC qdisc add dev $WANDEV root handle 1: cbq avpkt 1000 bandwidth 1000mbit
$TC class add dev $WANDEV parent 1: classid 1:1 cbq rate 10mbit allot 1500 prio 1 bounded isolated
$TC qdisc add dev $WANDEV parent 1:1 sfq perturb 10

$TC qdisc add dev $LANDEV root handle 1: cbq avpkt 1000 bandwidth 1000mbit
$TC class add dev $LANDEV parent 1: classid 1:1 cbq rate 10mbit allot 1500 prio 1 bounded isolated
$TC qdisc add dev $LANDEV parent 1:1 sfq perturb 10

$IPTABLES -t mangle -I POSTROUTING -o eth0 -s x.x.x.x -j CLASSIFY --set-class 1:1
$IPTABLES -t mangle -I POSTROUTING -o venet0 -d y.y.y.y -j CLASSIFY --set-class 1:1

replace x.x.x.x and y.y.y.y with CTID IP Adress
Previous Topic: Vzdump exclude path
Next Topic: SERVER CRASH WITH RHEL6 2.6.32-042stab061.2
Goto Forum:
  


Current Time: Fri Aug 09 02:11:01 GMT 2024

Total time taken to generate the page: 0.03173 seconds