<div dir="ltr">Yes, it's looking for a bridge name that has qvb + short port UUID and a device name of tap + short port UUID.<div><br></div><div><a href="https://github.com/openstack/neutron/blob/master/neutron/agent/linux/iptables_firewall.py#L868-L872">https://github.com/openstack/neutron/blob/master/neutron/agent/linux/iptables_firewall.py#L868-L872</a><br></div><div><br></div><div><br></div><div>I would grep the openvswitch agent logs for the short port UUID to see if it's failing to wire because of something else before it gets to the security groups code.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 24, 2017 at 12:25 AM, duhongwei <span dir="ltr"><<a href="mailto:duhongwei@qiniu.com" target="_blank">duhongwei@qiniu.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br></div><div>Dmitry Sutyagin also replied, quote:</div><span class=""><div><br></div><div><span style="font-family:"lucida Grande",Verdana"><i>Afaik, iptables are set by Nova, and the driver is set via firewall_driver option in nova.conf</i></span></div><div><span style="font-family:"lucida Grande",Verdana"><i><br></i></span></div></span><div><font face="lucida Grande, Verdana">After some investigation, I am thinking both Nova and Neutron provide security_group implementation, while Nova operates on vm granularity and Neuton operates on port.</font></div><div><font face="lucida Grande, Verdana"><br></font></div><div><font face="lucida Grande, Verdana">In my openstack environment, I see <i>firewall_driver = nova.virt.firewall.<wbr>NoopFirewallDriver</i> in nova.conf and <i>firewall_driver = neutron.agent.linux.iptables_<wbr>firewall.<wbr>OVSHybridIptablesFirewallDrive<wbr>r</i> in ml2_conf.ini. So it seems I'm using Neutron's security_group implementation.</font></div><div><span style="font-family:"lucida Grande",Verdana"><br></span></div><div><font face="lucida Grande, Verdana">Back to my question, I tried to name qbr, qvo, qvb as qbr1234567890, ... and, container side veth as veth0, qbr side veth as tap1234567890. As a result, no iptables rules added, therefore packets from veth0 are dropped on qbr1234567890.</font></div><div><font face="lucida Grande, Verdana"><br></font></div><div><font face="lucida Grande, Verdana">So, how would Neutron know that it has to add iptables rules for a device, by device name prefix or what? What can I do to let it happen?</font></div><div><u></u><div><br></div><div>Regards,</div><div>Dastan</div><div> </div><div style="font:Verdana normal 14px;color:#000"><div style="FONT-SIZE:12px;FONT-FAMILY:Arial Narrow;padding:2px 0 2px 0">------------------ Original --<wbr>----------------</div><div style="FONT-SIZE:12px;background:#efefef;padding:8px"><div id="m_7294974784964363669menu_sender"><b>From: </b> "Kevin Benton"<kevin@benton.pub>;</div><div><b>Date: </b> Wed, May 24, 2017 05:21 AM</div><div><div class="h5"><div><b>To: </b> "duhongwei"<<a href="mailto:duhongwei@qiniu.com" target="_blank">duhongwei@qiniu.<wbr>com</a>>; </div><div><b>Cc: </b> "openstack"<<a href="mailto:openstack@lists.openstack.org" target="_blank">openstack@lists.<wbr>openstack.org</a>>; "Vallachorum Tyranorum"<<a href="mailto:ardeleandanflorin@gmail.com" target="_blank">ardeleandanflorin@<wbr>gmail.com</a>>; </div><div><b>Subject: </b> Re: [Openstack] How to utilize Neutron independently with veths</div></div></div></div><div><div class="h5"><div> </div><div dir="ltr">Neutron sets up the iptables rules if you have security groups enabled and the agent firewall is set to iptables_hybrid or neutron.agent.linux.iptables_<wbr>firewall:<wbr>OVSHybridIptablesFirewallDrive<wbr>r .<div><br></div><div>What are you naming your vNIC? The iptables rules setup by the agent match specifically on 'tap' + port UUID prefix. So if the bridge is qvb1234567890 then the vnic you plug into it needs to be named tap1234567890 .</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 23, 2017 at 12:15 AM, duhongwei <span dir="ltr"><<a href="mailto:duhongwei@qiniu.com" target="_blank">duhongwei@qiniu.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br></div><div>Thanks Kevin! I've made a big step forward!</div><div><br></div><div>Till now, I've successfully connect <b>vNIC</b> directly into <b>br-int </b>without <b>qbr</b>, <b>qvo</b>, and <b>qvb</b>. And, it works well.</div><div><br></div><div>However, following your scripts (connect <b>vNIC</b> into <b>qbr</b>, then connect <b>qbr</b> into <b>br-int</b>) exposes another problem. In this scenario, <b>qbr</b> won't forward packets from <b>vNIC</b> to <b>br-int</b> (packets seem to be dropped on <b>qbr</b>).</div><div><br></div><div>After some troubleshooting, it turns out to be <b>iptables</b> who drops packets on <b>qbr</b>. Reviewing the <b>FORWARD</b> chain in <b>filter</b> table, packets come from <b>vNIC</b> won't match any rule of <b>neutron-filter-top</b> and <b>neutron-openvswi-FORWARD</b> so that the default policy <b>DROP</b> applies.</div><div><br></div><div>So, after setting up all these <b>qbr</b>, <b>qvo</b>, <b>qvb</b>, <b>vNIC</b>, it seems there're still some <b>iptables rules</b> missed. Question is,</div><div><br></div><div>Who's adding this iptables rules? (Nova or Neutron?) How can I make it happen?</div><div><br></div><div>Regards,</div><div>Dastan</div><div><u></u><div> </div><div> </div><div style="font:Verdana normal 14px;color:#000"><div style="FONT-SIZE:12px;FONT-FAMILY:Arial Narrow;padding:2px 0 2px 0">------------------ Original --<wbr>----------------</div><div style="FONT-SIZE:12px;background:#efefef;padding:8px"><div id="m_7294974784964363669m_1427632649770753526menu_sender"><b>From: </b> "Kevin Benton"<kevin@benton.pub>;</div><div><b>Date: </b> Mon, May 22, 2017 10:47 PM</div><div><div class="m_7294974784964363669h5"><div><b>To: </b> "duhongwei"<<a href="mailto:duhongwei@qiniu.com" target="_blank">duhongwei@qiniu.c<wbr>om</a>>; </div><div><b>Cc: </b> "openstack"<<a href="mailto:openstack@lists.openstack.org" target="_blank">openstack@lists.o<wbr>penstack.org</a>>; "Vallachorum Tyranorum"<<a href="mailto:ardeleandanflorin@gmail.com" target="_blank">ardeleandanflorin@g<wbr>mail.com</a>>; </div><div><b>Subject: </b> Re: [Openstack] How to utilize Neutron independently with veths</div></div></div></div><div><div class="m_7294974784964363669h5"><div> </div><div dir="auto">Yes, the only thing that needs to use the correct MAC is whatever is actually sending traffic. </div><div class="gmail_extra"><br><div class="gmail_quote">On May 21, 2017 22:06, "duhongwei" <<a href="mailto:duhongwei@qiniu.com" target="_blank">duhongwei@qiniu.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br></div><div>Thanks for your patient, Kevin.</div><div><br></div><div>So <b>qvo </b>could be any veth whose mac address doesn't matter, but <b>veth/tap </b>must have exact the same mac address as <b>port</b>, otherwise it will be anti-spoofed.</div><div><br></div><div><b>qvo</b>'s attributes (external-ids) tell neutron which logical <b>port</b> <b>qvo</b> is connecting, so neutron knows how to add flows to ovs <b>br-int </b>and <b>br-tun</b>.</div><div><br></div><div>Am I correct?</div><div><br></div><div>Regards,</div><div>Dastan</div><div><u></u><div> </div><div style="font:Verdana normal 14px;color:#000"><div style="FONT-SIZE:12px;FONT-FAMILY:Arial Narrow;padding:2px 0 2px 0">------------------ Original --<wbr>----------------</div><div style="FONT-SIZE:12px;background:#efefef;padding:8px"><div id="m_7294974784964363669m_1427632649770753526m_-1775130573959943231menu_sender"><b>From: </b> "Kevin Benton"<kevin@benton.pub>;</div><div><b>Date: </b> Sat, May 20, 2017 03:26 AM</div><div><b>To: </b> "duhongwei"<<a href="mailto:duhongwei@qiniu.com" target="_blank">duhongwei@qiniu.c<wbr>om</a>>; </div><div><b>Cc: </b> "openstack"<<a href="mailto:openstack@lists.openstack.org" target="_blank">openstack@lists.o<wbr>penstack.org</a>>; "Vallachorum Tyranorum"<<a href="mailto:ardeleandanflorin@gmail.com" target="_blank">ardeleandanflorin@g<wbr>mail.com</a>>; </div><div><b>Subject: </b> Re: [Openstack] How to utilize Neutron independently with veths</div></div><div> </div><div dir="ltr">><span style="font-size:12.8px">After all these, we create</span><span style="font-size:12.8px"> </span><b style="font-size:12.8px">veth/tap</b><span style="font-size:12.8px"> </span><span style="font-size:12.8px">(as vm/containers vNIC) and plugin it into</span><span style="font-size:12.8px"> </span><b style="font-size:12.8px">qbr</b><span style="font-size:12.8px"> </span><span style="font-size:12.8px">then we're able to talk with other vms/containers on the same network through </span><b style="font-size:12.8px">veth/tap</b><span style="font-size:12.8px">, am I understanding it right?</span><div><span style="font-size:12.8px"><br></span></div><div>Yes, this last step of creating a veth/tap is missing from my script because I didn't need actual dataplane communication for the tests I was doing.</div><div><br></div><div>><span style="font-size:12.8px">1) isn't it necessary that </span><b style="font-size:12.8px">veth/tap</b><span style="font-size:12.8px">'s mac address same as neutron </span><b style="font-size:12.8px">port</b><span style="font-size:12.8px">'s mac address?</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Yeah, if you attach something to qbr to behave like the VM interface, you will need it to be using the mac address of the neutron port, or else the neutron anti-spoofing rules will prevent it from communicating.</span></div><div><br></div><div><br></div><div>><span style="font-size:12.8px">2) after we plug </span><b style="font-size:12.8px">qvo</b><span style="font-size:12.8px"> into ovs </span><b style="font-size:12.8px">br-int</b><span style="font-size:12.8px">, neutron just automatically add flows into ovs bridge?</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Yes, the agent will receive to the new port event from ovs, retrieve port details from the server and then setup the flows.</span></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 19, 2017 at 12:09 AM, duhongwei <span dir="ltr"><<a href="mailto:duhongwei@qiniu.com" target="_blank">duhongwei@qiniu.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br></div><div>This script seems easy and cool!</div><div><br></div><div>So first we have to create a logical neutron <b>port</b>, then create <b>qbr</b>, <b>qvo</b> and <b>qvb</b>, and plug <b>qvb</b> into <b>qbr</b>, finally plug <b>qvo</b> into ovs <b>br-int</b>. After all these, we create <b>veth/tap</b> (as vm/containers vNIC) and plugin it into <b>qbr</b> then we're able to talk with other vms/containers on the same network through <b>veth/tap</b>, am I understanding it right?</div><div><br></div><div>Questions,</div><div><br></div><div>1) isn't it necessary that <b>veth/tap</b>'s mac address same as neutron <b>port</b>'s mac address?<b> </b></div><div>2) after we plug <b>qvo</b> into ovs <b>br-int</b>, neutron just automatically add flows into ovs bridge?</div><div><br></div><div>Regards,</div><div>Dastan</div><div><u></u><div> </div><div style="font:Verdana normal 14px;color:#000"><div style="FONT-SIZE:12px;FONT-FAMILY:Arial Narrow;padding:2px 0 2px 0">------------------ Original --<wbr>----------------</div><div style="FONT-SIZE:12px;background:#efefef;padding:8px"><div id="m_7294974784964363669m_1427632649770753526m_-1775130573959943231m_-1987887124829528714m_-5408302515287801246menu_sender"><b>From: </b> "Kevin Benton"<kevin@benton.pub>;</div><div><b>Date: </b> Sat, May 13, 2017 07:46 AM</div><div><div class="m_7294974784964363669m_1427632649770753526m_-1775130573959943231m_-1987887124829528714h5"><div><b>To: </b> "duhongwei"<<a href="mailto:duhongwei@qiniu.com" target="_blank">duhongwei@qiniu.c<wbr>om</a>>; </div><div><b>Cc: </b> "openstack"<<a href="mailto:openstack@lists.openstack.org" target="_blank">openstack@lists.o<wbr>penstack.org</a>>; "Vallachorum Tyranorum"<<a href="mailto:ardeleandanflorin@gmail.com" target="_blank">ardeleandanflorin@g<wbr>mail.com</a>>; </div><div><b>Subject: </b> Re: [Openstack] How to utilize Neutron independently with veths</div></div></div></div><div><div class="m_7294974784964363669m_1427632649770753526m_-1775130573959943231m_-1987887124829528714h5"><div> </div><div dir="ltr">Nova is only responsible for creating the interface and plugging it into the OVS bridge. It's the neutron agent (or alternative neutron backend like OVN) responsible for setting up all of the flows.<div><br></div><div>Here is a hacky script that I had used to create and delete a bunch of ports like Nova would that you can probably start with: <a href="http://paste.openstack.org/show/609478/" target="_blank">http://paste.openstack.o<wbr>rg/show/609478/</a></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 12, 2017 at 4:25 AM, duhongwei <span dir="ltr"><<a href="mailto:duhongwei@qiniu.com" target="_blank">duhongwei@qiniu.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br></div><div>Thanks Kevin!</div><div><br></div><div>I'll dig into neutron.agent.linux.interface to see how it works. Before that, would you give me any previews about what steps should be taken to add a veth to a existed Neutron network?</div><div><br></div><div>Furthermore, is it Neutron who add a veth to ovs bridge or is it the Neutron caller? (such as Nova)</div><div><br></div><div>Who's adding flows to ovs bridge? Neutron or caller?</div><div><u></u><div><br></div><div>Regards,</div><div>Dastan </div><div> </div><div style="font:Verdana normal 14px;color:#000"><div style="FONT-SIZE:12px;FONT-FAMILY:Arial Narrow;padding:2px 0 2px 0">------------------ Original --<wbr>----------------</div><div style="FONT-SIZE:12px;background:#efefef;padding:8px"><div id="m_7294974784964363669m_1427632649770753526m_-1775130573959943231m_-1987887124829528714m_-5408302515287801246m_-1019438340614061572menu_sender"><b>From: </b> "Kevin Benton"<kevin@benton.pub>;</div><div><b>Date: </b> Fri, May 12, 2017 10:45 AM</div><div><b>To: </b> "duhongwei"<<a href="mailto:duhongwei@qiniu.com" target="_blank">duhongwei@qiniu.c<wbr>om</a>>; </div><div><b>Cc: </b> "openstack"<<a href="mailto:openstack@lists.openstack.org" target="_blank">openstack@lists.o<wbr>penstack.org</a>>; "Vallachorum Tyranorum"<<a href="mailto:ardeleandanflorin@gmail.com" target="_blank">ardeleandanflorin@g<wbr>mail.com</a>>; </div><div><div class="m_7294974784964363669m_1427632649770753526m_-1775130573959943231m_-1987887124829528714m_-5408302515287801246h5"><div><b>Subject: </b> Re: [Openstack] How to utilize Neutron independently with veths</div></div></div></div><div><div class="m_7294974784964363669m_1427632649770753526m_-1775130573959943231m_-1987887124829528714m_-5408302515287801246h5"><div> </div><div dir="auto">You want to look in neutron.agent.linux.interface to see how things are plugged into OVS. That's the module used by the L3 agent to plug into OVS/linux bridge/etc. <div dir="auto"><br></div><div dir="auto">There is a well defined interface name format corresponding to the port ID and the port ID, Mac address, and a couple of other things I can't recall are set in ovsdb to help the agent identify the port as something it should care about. </div></div><div class="gmail_extra"><br><div class="gmail_quote">On May 9, 2017 04:49, "duhongwei" <<a href="mailto:duhongwei@qiniu.com" target="_blank">duhongwei@qiniu.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br></div><div><u></u><div>Thanks Dan!</div><div><br></div><div>I have to write a customized CNI plugin for our product, so it's better if I know more operation details about how to interact with Neutron manually (consider myself as Nova). Therefore Kuryr is not my best option right now, but it's cool!</div><div><br></div><div>Regards,</div><div>Dastan</div><div> </div><div style="font:Verdana normal 14px;color:#000"><div style="FONT-SIZE:12px;FONT-FAMILY:Arial Narrow;padding:2px 0 2px 0">------------------ Original --<wbr>----------------</div><div style="FONT-SIZE:12px;background:#efefef;padding:8px"><div id="m_7294974784964363669m_1427632649770753526m_-1775130573959943231m_-1987887124829528714m_-5408302515287801246m_-1019438340614061572m_-5672911627170774859menu_sender"><b>From: </b> "Vallachorum Tyranorum"<<a href="mailto:ardeleandanflorin@gmail.com" target="_blank">ardeleandanflorin@g<wbr>mail.com</a>>;</div><div><b>Date: </b> Tue, May 9, 2017 04:08 PM</div><div><b>To: </b> "duhongwei"<<a href="mailto:duhongwei@qiniu.com" target="_blank">duhongwei@qiniu.c<wbr>om</a>>; "openstack"<<a href="mailto:openstack@lists.openstack.org" target="_blank">openstack@lists.op<wbr>enstack.org</a>>; </div><div></div><div><b>Subject: </b> Re: [Openstack] How to utilize Neutron independently with veths</div></div><div> </div><div dir="ltr">Hi,<div><br></div><div>Please take a look at <a href="https://wiki.openstack.org/wiki/Kuryr" target="_blank">Kuryr</a>. Maybe this is what you are looking for.</div><div><br></div><div>Dan. </div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, May 9, 2017 at 10:17 AM duhongwei <<a href="mailto:duhongwei@qiniu.com" target="_blank">duhongwei@qiniu.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>Hi everyone,</div><div><br></div><div>I'm new to OpenStack and currently interested in the Neutron part of it. What I'm seeking is some advice about how to utilize Neutron independently, to build a virtual network, for Docker containers maybe.</div><div><br></div><div>Suppose I've already got Neutron and Keystone installed on controller node and compute nodes. I guess the following steps are required to test a virtual network.</div><div><br></div><div>1) create a <i>network</i></div><div>2) create a <i>subnet</i></div><div>3) create two pairs of veths (each pair represents a vm)</div><div><i>for each pair of them</i>:</div><div>4) create a <i>port </i>for one end of the veth pair (passing veth's mac address as a parameter)</div><div>5) attach another end of the veth pair to ovs bridge</div><div>6) ping from one veth pair to another</div><div><br></div><div>The above is my general idea, don't know if it is correct and don't know the operation details either.</div><div>Expecting your suggestions, any links are appreciated.</div><div><br></div><div>Regards,</div><div>Dastan</div></div><div><u></u><u></u></div>______________________________<wbr>_________________<br>
Mailing list: <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi<wbr>-bin/mailman/listinfo/openstac<wbr>k</a><br>
Post to     : <a href="mailto:openstack@lists.openstack.org" target="_blank">openstack@lists.openstack.org</a><br>
Unsubscribe : <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi<wbr>-bin/mailman/listinfo/openstac<wbr>k</a><br>
</blockquote></div>

</div><u></u></div><br>______________________________<wbr>_________________<br>
Mailing list: <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi<wbr>-bin/mailman/listinfo/openstac<wbr>k</a><br>
Post to     : <a href="mailto:openstack@lists.openstack.org" target="_blank">openstack@lists.openstack.org</a><br>
Unsubscribe : <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi<wbr>-bin/mailman/listinfo/openstac<wbr>k</a><br>
<br></blockquote></div></div>

</div></div></div><u></u></div></blockquote></div><br></div>

</div></div></div><u></u></div></blockquote></div><br></div></div>

</div><u></u></div></blockquote></div></div>

</div></div></div><u></u></div></blockquote></div><br></div>

</div></div></div><u></u></div></blockquote></div><br></div>