Deleting port on one openvswitch bridge causes change in MAC address on another bridge

networkingopenstackopenvswitch

I am trying to set an explicit MAC address on an openvswitch bridge
named br-ex. I am running Fedora 20 and using the native
ifdown/ifup commands to configure the bridge (details of my
network configuration files are at the bottom of this question).

After re-recreating br-ex by running ifdown br-ex followed by
ifup eth0, my OVS configuration looks like this:

# ovs-vsctl show
1ab8ae7e-e9da-4af9-9226-03b54f5d2544
    Bridge br-int
        Port br-int
            Interface br-int
                type: internal
        Port int-br-ex
            Interface int-br-ex
        Port "tapa1747c68-d3"
            tag: 1
            Interface "tapa1747c68-d3"
                type: internal
    Bridge br-ex
        Port "eth0"
            Interface "eth0"
        Port br-ex
            Interface br-ex
                type: internal
    ovs_version: "2.0.1"

Note the MAC address on br-ex:

# ip link show dev br-ex
80: br-ex: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default 
    link/ether fa:16:3e:ef:91:ec brd ff:ff:ff:ff:ff:ff

Now delete port int-br-ex from br-int, which is no longer
connected in any way to br-ex
:

# ovs-vsctl --if-exists del-port br-int int-br-ex

And note that the MAC address on br-ex has changed:

# ip link show dev br-ex
80: br-ex: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default 
    link/ether f2:2a:d3:bf:3c:47 brd ff:ff:ff:ff:ff:ff

What just happened?

Network configuration

I have, in /etc/sysconfig/network-scripts:

# cat ifcfg-br-ex
DEVICE=br-ex
DEVICETYPE=ovs
TYPE=OVSBridge
ONBOOT=yes
OVSBOOTPROTO=dhcp
OVSDHCPINTERFACES=eth0
MACADDR=fa:16:3e:ef:91:ec

# cat ifcfg-eth0
DEVICE="eth0"
ONBOOT="yes"
BOOTPROTO=none
TYPE=OVSPort
DEVICETYPE=ovs
OVS_BRIDGE=br-ex

What's going on here? Why is the MAC address on br-ex changing?
How do I make it stick?

Best Answer

It looks like it is not possible to set a persistent MAC address on an OVS bridge using the ip set link command. Instead, you need to set via ovs-vsctl:

ovs-vsctl set bridge br-ex other-config:hwaddr=$MACADDR

If you're on RHEL/CentOS/Fedora, you can accomplish this by setting the following in your interface configuration file:

OVS_EXTRA="set bridge br-ex other-config:hwaddr=$MACADDR"
Related Topic