[ovs-discuss] Setting the HW addr of bridge internal interface -- issues

Florian Daniel Otel florian.otel at gmail.com
Wed Dec 26 07:43:44 UTC 2012


Hello all,

First, a disclaimer: As I'm relatively new to OVS (and to this list) pls
point me to the correct resource(s) if this is a known issue / solution.
TIA.

Setup:

I am trying to do some testing with OVS inside a VM.  The challenge is that
in the environment I'm working the Host does a static mapping btw. the MAC
address of  VM's primary interface ("eth0" henceforth) and the  ip address
it assigns to that VM. Since my tests involve putting that primary
interface ("eth0")  in an OVS bridge as per the OVS standard FAQ I need to
first zero out the ip address of the said interface, add  "eth0" to my
bridge and then assign "eth0" ip address  to "br0" -- i.e. to the bridge
internal interface (then reset the default gateway etc. etc accordingly...)

Now, given the peculiarities of my setup that swap doesn't work straight
away since the MAC addrs of "eth0" and "br0" are different, so the
connectivity to the outside world is cut off by the host (it still responds
to e.g. ARP traffic by sending the responses to "eth0" MAC address).

The way I solve this is not only to assign to "br0" the  IP addr of
"eth0"  but swap MAC addresses as well btw the two interfaces, using smth
like this:

        OLDHWADDR=`cat /sys/class/net/eth0/address`
        NEWHWADDR=`cat /sys/class/net/br0/address`

        ifconfig eth0 down
        ifconfig eth0 hw ether $NEWHWADDR
        ifconfig eth0 up

        ifconfig br0 hw ether $OLDHWADDR

As a result "br0" has "eth0" IP _and_ MAC addrs, and all works well.

Problem:

As soon as I do _any_  subsequent operations in OVS -- e.g. add another
(unrelated)  bridge "br1" , add a port to "br1" etc. etc -- the MAC address
of "br0" is  reset to its initial value. Which, given my setup, cuts off
the VM from the outside world again.

Questions:

1) Is this intended behavior ? If yes, any logic behind it and can that be
altered ?

2) How can I make the MAC address assignment to a bridge internal interface
"stick" i.e. make it a one time only operation  ?
   Goes w/o saying that, while I can script any subsequent  OVS operations
by appending them with a command that re-sets the "br0" MAC addr to the one
I need to, that's nothing short of a horrible workaround..

I've confirmed this behavior on Ubuntu 12.04 x64 with both vannilla
packages (1.4.0.1-1ubuntu1.3) and the code currently in the official GitHub
repo.  LMK if there is any more info needed.

TIA for all the help / advice / pointers,

Florian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openvswitch.org/pipermail/ovs-discuss/attachments/20121226/669ca739/attachment.html>


More information about the discuss mailing list