<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p></p>
<div class="sites-codeblock sites-codesnippet-block"><code>help <br>
<br>
oracle@g70:~ lxc config show lxdora7a<br>
<br>
name: lxdora7a </code><br>
<code>profiles: </code><br>
<code>- default </code><br>
<code>config: </code><br>
<code>volatile.base_image: ad1d975af5bee4ef947ecca36084dbe2934277ed62e6a02c1fa60f1c902d2280
</code><br>
<code>volatile.eth0.hwaddr: 00:16:3e:da:03:3e </code><br>
<code>volatile.last_state.idmap: '[{"Isuid":true,"Isgid":false,"Hostid":231072,"Nsid":0,"Maprange":65536},{"Isuid":false,"Isgid":true,"Hostid":231072,"Nsid":0,"Maprange":65536}]'
</code><br>
<code>devices: </code><br>
<code><span style="color:rgb(255,0,0)"><b>eth0: </b></span></code><span style="color:rgb(255,0,0)"><b><br>
<code><span style="color:rgb(255,0,0)">host_name: lxdora7a </span></code><br>
<span style="color:rgb(255,0,0)"><code><span style="color:rgb(255,0,0)">name: eth0
</span></code><br>
<span style="color:rgb(255,0,0)"><code><span style="color:rgb(255,0,0)">nictype: bridged
</span></code><br>
<span style="color:rgb(255,0,0)"><code><span style="color:rgb(255,0,0)">parent: sw1
</span></code><br>
<span style="color:rgb(255,0,0)"><code><span style="color:rgb(255,0,0)">type: nic
</span></code></span></span></span></span></b></span><br>
<code>root: </code><br>
<code>path: / </code><br>
<code>type: disk </code><br>
<code>ephemeral: false </code><br>
<br>
<code>oracle@g70:~$<br>
<br>
How do I put a VLAN TAG=10 on the above so that the lxdora7a port on my sw1 switch gets created with a TAG=10?<br>
<br>
</code></div>
<p><code><span style="font-family:arial,sans-serif"><span style="color:rgb(0,0,0)"><font size="3">I could not find a reference for how to add VLAN tagging in the lxc config file above, but I was able to manually put the VLAN tag on the port that the LXD container
 automatically creates when it boots using the following command after it had already booted.  At that point, eth0 is still unconfigured even though onboot is set to YES in the ifcfg-eth0 because the VLAN 10 is not passing the traffic from the LXD container
 lxdora7a because of the VLAN'g.</font></span></span></code></p>
<p><code><span style="font-family:arial,sans-serif"><span style="color:rgb(0,0,0)"><font size="3"><br>
</font></span></span></code></p>
<p><code><span style="font-family:arial,sans-serif"><span style="color:rgb(0,0,0)"><font size="3">So I ran this command to put a VLAN 10 on the port after the lxdora7a container had already booted:<br>
</font></span></span></code></p>
<p><code><span style="font-family:arial,sans-serif"><span style="color:rgb(0,0,0)"><font size="3"><br>
</font></span></span></code></p>
<div class="sites-codeblock sites-codesnippet-block"><font size="3"><font size="4"><code>sudo ovs-vsctl set port lxdora7a tag=10<br>
<br>
</code></font></font></div>
<p><code><span style="font-family:arial,sans-serif"><span style="color:rgb(0,0,0)"><font size="3">Then I logged into the container using:</font></span></span></code></p>
<p><code><span style="font-family:arial,sans-serif"><span style="color:rgb(0,0,0)"><font size="3"><br>
</font></span></span></code></p>
<p><code><span style="font-family:arial,sans-serif"><span style="color:rgb(0,0,0)"><font size="3">lxc exec lxdora7a /bin/sh
<br>
</font></span></span></code></p>
<p><code><span style="font-family:arial,sans-serif"><span style="color:rgb(0,0,0)"><font size="3"><br>
</font></span></span></code></p>
<p><code><span style="font-family:arial,sans-serif"><span style="color:rgb(0,0,0)"><font size="3">command and ran "ifup eth0" which brought up the network interface, got a dhcp address from my isc-dhcp-server and updated my DNS dynamically with the DNS IP info. 
 Again, not an elegant solution, but at least it gets me in business.  I'd like to have the lxdora7a port on sw1 created automatically with a vlan tag on it.</font></span></span></code></p>
<p><code><span style="font-family:arial,sans-serif"><span style="color:rgb(0,0,0)"><font size="3"><br>
</font></span></span></code></p>
<p><code><span style="font-family:arial,sans-serif"><span style="color:rgb(0,0,0)"><font size="3">In LXC I do this by using a script - can the same be done with this LXD LXC container config ?  Here's how I do that with LXC:</font></span></span></code></p>
<p><code><span style="font-family:arial,sans-serif"><span style="color:rgb(0,0,0)"><font size="3"><br>
</font></span></span></code></p>
<p><code><span style="font-family:arial,sans-serif"><span style="color:rgb(0,0,0)"><font size="3"></p>
<div>lxc.network.script.up = /etc/network/if-up.d/openvswitch/ora72c10-pub-ifup-sw1<br>
lxc.network.script.down = /etc/network/if-down.d/openvswitch/ora72c10-pub-ifdown-sw1<br>
</div>
<br>
</font></span></span></code>
<p></p>
<p><code><span style="font-family:arial,sans-serif"><span style="color:rgb(0,0,0)"><font size="3">and then the up script looks like this:</font></span></span></code></p>
<p><code><span style="font-family:arial,sans-serif"><span style="color:rgb(0,0,0)"><font size="3"><br>
</font></span></span></code></p>
<p><code><span style="font-family:arial,sans-serif"><span style="color:rgb(0,0,0)"><font size="3"></p>
<div>root@g70:/var/lib/lxc/ora72c10# cat /etc/network/if-up.d/openvswitch/ora72c10-pub-ifup-sw1<br>
#!/bin/bash<br>
ovsBr='sw1'<br>
ovs-vsctl add-port ${ovsBr} $5<br>
ovs-vsctl set port $5 tag=10<br>
root@g70:/var/lib/lxc/ora72c10# <br>
</div>
<br>
</font></span></span></code>
<p></p>
<p><code><span style="font-family:arial,sans-serif"><span style="color:rgb(0,0,0)"><font size="3">Thanks,</font></span></span></code></p>
<p><code><span style="font-family:arial,sans-serif"><span style="color:rgb(0,0,0)"><font size="3"><br>
</font></span></span></code></p>
<p><code><span style="font-family:arial,sans-serif"><span style="color:rgb(0,0,0)"><font size="3">Gilbert<br>
</font></span></span></code><br>
<br>
</p>
<br>
<p></p>
</div>
</body>
</html>