summaryrefslogtreecommitdiff
path: root/grid5000/steps/data/setup/puppet/modules/env/files/big/kvm/random_mac
diff options
context:
space:
mode:
Diffstat (limited to 'grid5000/steps/data/setup/puppet/modules/env/files/big/kvm/random_mac')
-rw-r--r--grid5000/steps/data/setup/puppet/modules/env/files/big/kvm/random_mac38
1 files changed, 38 insertions, 0 deletions
diff --git a/grid5000/steps/data/setup/puppet/modules/env/files/big/kvm/random_mac b/grid5000/steps/data/setup/puppet/modules/env/files/big/kvm/random_mac
new file mode 100644
index 0000000..9c2bc8a
--- /dev/null
+++ b/grid5000/steps/data/setup/puppet/modules/env/files/big/kvm/random_mac
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+SITE_NAME=$(hostname | cut -d. -f2)
+
+# Code the 2nd byte of the IP in the mac address, in order to avoid conflicts
+# with g5k-subnets (see [[Virtual network interlink]])
+
+if [ "x$SITE_NAME" = "xbordeaux" ] ; then
+ SITE_HEX=83
+elif [ "x$SITE_NAME" = "xlille" ] ; then
+ SITE_HEX=8b
+elif [ "x$SITE_NAME" = "xlyon" ] ; then
+ SITE_HEX=8f
+elif [ "x$SITE_NAME" = "xnancy" ] ; then
+ SITE_HEX=93
+elif [ "x$SITE_NAME" = "xrennes" ] ; then
+ SITE_HEX=9f
+elif [ "x$SITE_NAME" = "xtoulouse" ] ; then
+ SITE_HEX=a3
+elif [ "x$SITE_NAME" = "xsophia" ] ; then
+ SITE_HEX=a7
+elif [ "x$SITE_NAME" = "xreims" ] ; then
+ SITE_HEX=ab
+elif [ "x$SITE_NAME" = "xluxembourg" ] ; then
+ SITE_HEX=af
+elif [ "x$SITE_NAME" = "xnantes" ] ; then
+ SITE_HEX=b3
+elif [ "x$SITE_NAME" = "xgrenoble" ] ; then
+ SITE_HEX=b7
+elif [ "x$SITE_NAME" = "xqualif" ] ; then
+ SITE_HEX=ff
+else
+ # Orsay (or unknown site)
+ SITE_HEX=97
+fi
+
+MACADDR="00:16:3e:$SITE_HEX:$(dd if=/dev/urandom count=1 2>/dev/null | md5sum | sed 's/^\(..\)\(..\).*$/\1:\2/')"
+echo $MACADDR