OpenVZ Forum


Home » General » Support » How to use tc to limit traffic?
How to use tc to limit traffic? [message #51222] Tue, 11 March 2014 17:01 Go to previous message
postcd is currently offline  postcd
Messages: 73
Registered: April 2013
Member
Hello, how one can use tc (man page) to limit outgoing and incoming traffic on OpenVZ virtual machines?

There is a guide:
https://wiki.openvz.org/Traffic_shaping_with_tc#Limiting_inc oming_bandwidth

says:
Quote:

Limiting outgoing bandwidth

We can limit container outgoing bandwidth by setting the tc filter on eth0.

DEV=eth0
tc qdisc del dev $DEV root
tc qdisc add dev $DEV root handle 1: cbq avpkt 1000 bandwidth 100mbit
tc class add dev $DEV parent 1: classid 1:1 cbq rate 256kbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV parent 1: protocol ip prio 16 u32 match ip src X.X.X.X flowid 1:1
tc qdisc add dev $DEV parent 1:1 sfq perturb 10


X.X.X.X is an IP address of container.
[edit] Limiting incoming bandwidth

This can be done by setting the tc filter on venet0:

DEV=venet0
tc qdisc del dev $DEV root
tc qdisc add dev $DEV root handle 1: cbq avpkt 1000 bandwidth 100mbit
tc class add dev $DEV parent 1: classid 1:1 cbq rate 256kbit allot 1500 prio 5 bounded isolated
tc filter add dev $DEV parent 1: protocol ip prio 16 u32 match ip dst X.X.X.X flowid 1:1
tc qdisc add dev $DEV parent 1:1 sfq perturb 10


Note that X.X.X.X is an IP address of container.


I see these are commands, probably need to run one by one?
But first is DEV=venet0 and DEV=eth0 , so im unsure how to limit certain container in example?

Thanks if you have any idea
 
Read Message
Read Message
Previous Topic: VPS download speed is higher than allowed
Next Topic: How to prevent total unavailability due Unable to fork
Goto Forum:
  


Current Time: Mon Jul 29 21:16:17 GMT 2024

Total time taken to generate the page: 0.02904 seconds