<div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial"><p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;mso-bidi-font-size:
11.0pt;font-family:"Calibri","sans-serif";mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-theme-font:
minor-latin;mso-bidi-font-family:"Times New Roman";mso-bidi-theme-font:minor-bidi;
color:#1F497D;mso-themecolor:dark2"></span></p><p class="MsoNormal" style="color: rgb(0, 0, 0);"><span lang="EN-US" style="font-size:10.5pt;mso-bidi-font-size:
11.0pt;font-family:"Calibri","sans-serif";mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:宋体;mso-fareast-theme-font:minor-fareast;mso-hansi-theme-font:
minor-latin;mso-bidi-font-family:"Times New Roman";mso-bidi-theme-font:minor-bidi;
color:#1F497D;mso-themecolor:dark2"><span style="color: rgb(0, 0, 0);"></span></span></p><span style="font-size: 14px;"><p class="MsoNormal" style="color: rgb(0, 0, 0);"><span lang="EN-US" style="font-family: Calibri, sans-serif; color: rgb(31, 73, 125);"><span style="color: rgb(0, 0, 0);">Sorry for the late response. For your
question , you could not limit the network traffic in that way. Because TC will
only limit the traffic send out from the target device .  And for the device of veth type , the device
on the host end will “send out” the traffic to the container , and  it will “receive”  the traffic come from the container . Thus ,
you have to go into the  container to run
your command , and that is not what we want. 
So I’ve added a new option “peer” to support running the command on the
host. And for your command , it may run like this (on the host) :</span><o:p></o:p></span></p><p class="MsoNormal" style="color: rgb(0, 0, 0); text-indent: 21pt;"><span lang="EN-US" style="font-family: Calibri, sans-serif; color: rgb(0, 0, 0);">sudo tc
qdisc add dev </span><span lang="EN-US" style="font-family: Calibri, sans-serif; color: rgb(0, 0, 0);">peer</span><span lang="EN-US" style="font-family: Calibri, sans-serif; color: rgb(0, 0, 0);"> xxx root tbf rate 0.5mbit burst
5kb latency 70ms peakrate 1mbit minburst 1540</span></p><span style="color: rgb(0, 0, 0);">

</span><p class="MsoNormal"><span lang="EN-US" style="color: rgb(0, 0, 0); font-family: Calibri, sans-serif;">         Which
will take effective on the peer end of the xxx.</span><span lang="EN-US" style="font-family: Calibri, sans-serif;"><font color="#1f497d"> </font></span><span style="color: rgb(0, 0, 0); line-height: 1.7; font-family: Calibri, sans-serif; text-indent: 21pt;">In this way , we may control the network traffic of the container from the host end .</span></p></span><p class="MsoNormal"><span style="color: rgb(31, 73, 125); font-family: Calibri, sans-serif; font-size: 10.5pt; text-indent: 21pt; line-height: 1.7;"></span></p><p class="MsoNormal" style="text-indent:21.0pt"><span lang="EN-US" style="font-size:10.5pt;mso-bidi-font-size:11.0pt;font-family:"Calibri","sans-serif";
mso-ascii-theme-font:minor-latin;mso-fareast-font-family:宋体;mso-fareast-theme-font:
minor-fareast;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;color:#1F497D;mso-themecolor:dark2"><o:p></o:p></span></p><pre>At 2013-06-15 05:27:01,"Serge Hallyn" <<a href="mailto:serge.hallyn@ubuntu.com">serge.hallyn@ubuntu.com</a>> wrote:
>Quoting lsmushroom (<a href="mailto:lsmushroom@126.com">lsmushroom@126.com</a>):
>> Hi All,
>>       Recently , we have been trying to find out a suitable way to
>>       limit  network traffic generated from the process running in the
>>       container. The network  type we used for our container is veth.
>>       And we have tried TC combined with cgroup net_cls subsystem ,
>>       which has successfully fulfill our goal . However ,  it requires
>>       to add the configurations inside the container. As we will
>>       provide the container as a service, and it is obviously
>>       unacceptable to allow the end user modify the bandwidth
>>       allocation . 
>
>If I just set the veth pair name to xxx and issue:
>
>sudo tc qdisc add dev xxx root tbf rate 0.5mbit burst 5kb latency 70ms peakrate 1mbit minburst 1540
>
>on the host, the container's network is rated limited.
>
>Do you want something different?
</pre></div></div></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>