[lxc-devel] [lxc/master] Configure a static MAC address on the LXC bridge
ccope on Github
lxc-bot at linuxcontainers.org
Tue Nov 22 21:29:47 UTC 2016
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 599 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20161122/b1bd83a6/attachment.bin>
-------------- next part --------------
From e5254cef12eca4eaff63b6f657726a94c2265845 Mon Sep 17 00:00:00 2001
From: Cam Cope <cam at dropbox.com>
Date: Tue, 22 Nov 2016 12:58:49 -0800
Subject: [PATCH] Configure a static MAC address on the LXC bridge
---
config/init/common/lxc-net.in | 2 ++
lxc.spec.in | 1 +
2 files changed, 3 insertions(+)
diff --git a/config/init/common/lxc-net.in b/config/init/common/lxc-net.in
index d457e78..7c6d293 100644
--- a/config/init/common/lxc-net.in
+++ b/config/init/common/lxc-net.in
@@ -9,6 +9,7 @@ varlib="@LOCALSTATEDIR@/lib"
USE_LXC_BRIDGE="true"
LXC_BRIDGE="lxcbr0"
+LXC_BRIDGE_MAC="fe:7f:01:00:00:00"
LXC_ADDR="10.0.3.1"
LXC_NETMASK="255.255.255.0"
LXC_NETWORK="10.0.3.0/24"
@@ -45,6 +46,7 @@ ifup() {
MASK=`_netmask2cidr ${LXC_NETMASK}`
CIDR_ADDR="${LXC_ADDR}/${MASK}"
ip addr add ${CIDR_ADDR} dev $1
+ ip link set dev $1 address $LXC_BRIDGE_MAC
ip link set dev $1 up
}
diff --git a/lxc.spec.in b/lxc.spec.in
index 94a9504..f56d1cb 100644
--- a/lxc.spec.in
+++ b/lxc.spec.in
@@ -196,6 +196,7 @@ USE_LXC_BRIDGE="true"
# If you have the dnsmasq daemon installed, you'll also have to update
# /etc/dnsmasq.d/lxc and restart the system wide dnsmasq daemon.
LXC_BRIDGE="lxcbr0"
+LXC_BRIDGE_MAC="fe:7f:01:00:00:00"
LXC_ADDR="$SUBNET.1"
LXC_NETMASK="255.255.255.0"
LXC_NETWORK="$SUBNET.0/24"
More information about the lxc-devel
mailing list