[ovs-discuss] [PATCH] support persistent mac addresses on OVS bridges on RHEL

Lars Kellogg-Stedman lars at redhat.com
Fri May 23 21:22:18 UTC 2014


This patch adds support for setting the persistent MAC address (on
RHEL-derived systems) of an OVS bridge via the MACADDR setting in the
interface configuration file.

Without this change, when an administrator provides MACADDR in the
interface configuration file that address will be set in ifup-eth using
the "ip link set" command.  While this appears to work, any operation
that updates the OVS configuration will cause the MAC address to revert.

Persistent MAC addresses must be set using ovs-vsctl.
---
 rhel/etc_sysconfig_network-scripts_ifup-ovs | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/rhel/etc_sysconfig_network-scripts_ifup-ovs b/rhel/etc_sysconfig_network-scripts_ifup-ovs
index 57768c2..429e9c2 100755
--- a/rhel/etc_sysconfig_network-scripts_ifup-ovs
+++ b/rhel/etc_sysconfig_network-scripts_ifup-ovs
@@ -85,6 +85,14 @@ case "$TYPE" in
 			OVSBRIDGECONFIGURED="yes"
 		fi
 
+		# If MACADDR is provided in the interface configuration file, we need to 
+		# set it using ovs-vsctl; setting it with the "ip" command in ifup-eth
+		# not make the change persistent.
+		if [ -n "$MACADDR" ]; then
+			ovs-vsctl -t ${TIMEOUT} -- set bridge "$DEVICE" \
+				other-config:hwaddr="$MACADDR"
+		fi
+
 		# When dhcp is enabled, the assumption is that there will be a port to
 		# attach (otherwise, we can't reach out for dhcp). So, we do not
 		# configure the bridge through rhel's ifup infrastructure unless
-- 
1.9.0

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://openvswitch.org/pipermail/ovs-discuss/attachments/20140523/ae08c604/attachment-0002.sig>


More information about the discuss mailing list