<tt><font size=2>Shahar Havivi <shaharh@redhat.com> wrote on 06/20/2011
07:39:35 AM:<br>
<br>
> From: Shahar Havivi <shaharh@redhat.com></font></tt>
<br><tt><font size=2>> To: libvirt-list@redhat.com</font></tt>
<br><tt><font size=2>> Cc: Stefan Berger/Watson/IBM@IBMUS</font></tt>
<br><tt><font size=2>> Date: 06/20/2011 07:42 AM</font></tt>
<br><tt><font size=2>> Subject: nwfilter: limit VM traffic to specific
MAC</font></tt>
<br><tt><font size=2>> <br>
> Hi,<br>
> I am trying to add custom filter to block VM traffic to other VMs
by limiting<br>
> the traffic only to the gateways MAC address.<br>
> The filter XML:<br>
> <br>
> <filter name='rhev' chain='root'><br>
>     <uuid>cd4e5890-ccc9-1b0f-303f-e7fe7123646d</uuid><br>
>     <filterref filter='allow-dhcp'/><br>
>     <rule action='drop' direction='out' priority='500'><br>
>         <mac match='no' dstmacaddr='$MAC'/><br>
>     </rule><br>
> </filter></font></tt>
<br>
<br><tt><font size=2>> <br>
> The MAC is not the interface MAC address it's the gateways MAC that
pass as a<br>
> parameter (I use the gateway address hardcoded as well).<br>
> <br>
> The VM is getting DHCP ip but cannot get any traffic,<br>
> I notice that when I edit (comment and uncomment) the drop rule, thefilter
is<br>
> working fine, ie no traffic other then the gateway.<br>
> <br>
> 1. Am I doing something wrong?<br>
</font></tt>
<br><tt><font size=2>Try to put the concret MAC address of the gateway
into the dstmacaddr field. $MAC is going to be translated to the MAC address
of the interface. Once it works, try using $GATEWAY_MAC and have that defined
via <parameter name='GATEWAY_MAC' value='a.b.c.d'/> from wherever
you are referencing the 'rhev' filter.</font></tt>
<br>
<br><tt><font size=2>The DHCP server must be running on the gateway.</font></tt>
<br>
<br><tt><font size=2>> 1. What is the table name that libvirt use for
ebtables?</font></tt>
<br>
<br><tt><font size=2>It's the 'nat' table : 'ebtables -t nat -L' shows
you the resulting rules.</font></tt>
<br>
<br><tt><font size=2>   Stefan</font></tt>
<br><tt><font size=2><br>
> <br>
> Shahar.<br>
</font></tt>