<div dir="ltr"><p style="margin-right:0px;margin-bottom:15px;margin-left:0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif,'Segoe UI Emoji','Segoe UI Symbol';font-size:14px;line-height:23.8px;margin-top:0px!important">
Hi all,</p><p style="margin-right:0px;margin-bottom:15px;margin-left:0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif,'Segoe UI Emoji','Segoe UI Symbol';font-size:14px;line-height:23.8px;margin-top:0px!important">
I have 2 problems when use unprivileged container.</p><p style="margin-right:0px;margin-bottom:15px;margin-left:0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif,'Segoe UI Emoji','Segoe UI Symbol';font-size:14px;line-height:23.8px;margin-top:0px!important">
Problem 1:</p><p style="margin:15px 0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif,'Segoe UI Emoji','Segoe UI Symbol';font-size:14px;line-height:23.8px">I configured my container with:<br>
lxc.cgroup.blkio.weight = 500<br>lxc.cgroup.net_cls.classid = 0x00010002 # 1:2</p><p style="margin:15px 0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif,'Segoe UI Emoji','Segoe UI Symbol';font-size:14px;line-height:23.8px">
and ran tc commands:<br>$sudo tc qdisc add dev lxcbr0 root handle 1: htb<br>$sudo tc class add dev lxcbr0 parent 1: classid 1:1 htb rate 10mbit<br>$sudo tc class add dev lxcbr0 parent 1: classid 1:2 htb rate 1mbit<br>$sudo tc filter add dev lxcbr0 protocol ip parent 1: prio 1 handle 1: cgroup</p>
<p style="margin:15px 0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif,'Segoe UI Emoji','Segoe UI Symbol';font-size:14px;line-height:23.8px">then I started container and tested block i/o, network bandwidth by</p>
<ul style="padding:0px 0px 0px 30px;margin:15px 0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif,'Segoe UI Emoji','Segoe UI Symbol';font-size:14px;line-height:23.8px"><li>copy a large file: dd if=/dev/zero of=/tmp/output bs=20k count=100k; rm -f /tmp/output</li>
<li>upload/download a large file. after that, I changed my config:</li></ul><p style="margin:15px 0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif,'Segoe UI Emoji','Segoe UI Symbol';font-size:14px;line-height:23.8px">
lxc-cgroup -n container blkio.weight 1000.<br>lxc-cgroup -n container net_cls.classid 0x00010002</p><p style="margin-top:15px;margin-right:0px;margin-left:0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif,'Segoe UI Emoji','Segoe UI Symbol';font-size:14px;line-height:23.8px;margin-bottom:0px!important">
and tested again, but i didn't see a difference. <br>I also trying the same commands on eth0 instead of lxcbr0, but there was no effect.</p><p style="margin-top:15px;margin-right:0px;margin-left:0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif,'Segoe UI Emoji','Segoe UI Symbol';font-size:14px;line-height:23.8px;margin-bottom:0px!important">
I changed 'lxcbr0' by veth pair name(appear when start container after
use ifconfig cmd, I can't set veth pair name, lxc.network.veth.pair no
effect), and use:<br>$sudo tc qdisc add dev vethxxxxx root handle 1: htb default 2<br>
$sudo tc class add dev vethxxxxx parent 1: classid 1:1 htb rate 10mbit<br>$sudo tc class add dev vethxxxxx parent 1: classid 1:2 htb rate 1mbit<br>$sudo tc filter add dev vethxxxxx protocol ip parent 1: prio 1 handle 1: cgroup<br>
and test again, It's work. So I think it's a problem with net_cls, or lxc.cgroup.net_cls.classid no effect.<br>I feel confused.<br><br>I found many tutorials, but they maybe used for privileged container. </p>
<p style="margin-top:15px;margin-right:0px;margin-left:0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif,'Segoe UI Emoji','Segoe UI Symbol';font-size:14px;line-height:23.8px;margin-bottom:0px!important">
Problem 2:</p><p style="margin-right:0px;margin-bottom:15px;margin-left:0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif,'Segoe UI Emoji','Segoe UI Symbol';font-size:14px;line-height:23.8px;margin-top:0px!important">
I configured network in container:</p><p style="margin-right:0px;margin-bottom:15px;margin-left:0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif,'Segoe UI Emoji','Segoe UI Symbol';font-size:14px;line-height:23.8px;margin-top:0px!important">
<i>lxc.network.type = veth</i></p><p style="margin-right:0px;margin-bottom:15px;margin-left:0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif,'Segoe UI Emoji','Segoe UI Symbol';font-size:14px;line-height:23.8px;margin-top:0px!important">
<i>lxc.network.veth.pair = veth-c1</i></p><p style="margin-right:0px;margin-bottom:15px;margin-left:0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif,'Segoe UI Emoji','Segoe UI Symbol';font-size:14px;line-height:23.8px;margin-top:0px!important">
<i><a href="http://lxc.network.name">lxc.network.name</a> = eth0</i></p><p style="margin-right:0px;margin-bottom:15px;margin-left:0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif,'Segoe UI Emoji','Segoe UI Symbol';font-size:14px;line-height:23.8px;margin-top:0px!important">
<i>lxc.network.flags = up</i></p><p style="margin-right:0px;margin-bottom:15px;margin-left:0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif,'Segoe UI Emoji','Segoe UI Symbol';font-size:14px;line-height:23.8px;margin-top:0px!important">
<i>lxc.network.link = lxcbr0</i></p><p style="margin-right:0px;margin-bottom:15px;margin-left:0px;margin-top:0px!important"><i><font color="#333333" face="Helvetica, arial, freesans, clean, sans-serif, Segoe UI Emoji, Segoe UI Symbol"><span style="font-size:14px;line-height:23.8px">lxc.network.hwaddr = </span></font><font color="#545454" face="arial, sans-serif"><span style="line-height:18.2px">00:16:3e:67:4f:a5</span></font></i></p>
<p style="margin-right:0px;margin-bottom:15px;margin-left:0px;margin-top:0px!important"><font color="#545454" face="arial, sans-serif"><span style="line-height:18.2px">but veth inteface don't rename at host ( veth-$random instead veth-c1)</span></font></p>
<p style="margin-right:0px;margin-bottom:15px;margin-left:0px;margin-top:0px!important">So lxc.network.veth.pair is not effect, or am I missing something ?</p><p style="margin-top:15px;margin-right:0px;margin-left:0px;color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,sans-serif,'Segoe UI Emoji','Segoe UI Symbol';font-size:14px;line-height:23.8px;margin-bottom:0px!important">
Host Ubuntu 14.04 LTS, container Ubuntu 12.04 LTS<br></p>
Can someone help me ? Thanks in advance.</div>