Friday, January 31, 2020

Quick question about MAC addresses regarding local and unicast bits

I'd like to ensure that I've read and interpreted the rules correctly for setting the local and unicast bits for randomly generated mac addresses. My understanding is that the first octet needs to end with a 2, 6, a, or e, specifically:

  • x2:xx:xx:xx:xx:xx
  • x6:xx:xx:xx:xx:xx
  • xa:xx:xx:xx:xx:xx
  • xe:xx:xx:xx:xx:xx

Is this correct?

My goal is I need to generate random MAC addresses for SR-IOV VFs and I would like to ensure they comply with standards. Below are the sets of MAC address groups I would like to use (each set would be applied only to particular SR-IOV VFs as a means for easily identify the underling physical device):

  • 22:26:2a:xx:xx:xx
  • 62:66:6a:xx:xx:xx
  • a2:a6:aa:xx:xx:xx
  • e2:e6:ea:xx:xx:xx

  • 26:2a:2e:xx:xx:xx
  • 66:6a:6e:xx:xx:xx
  • a6:aa:ae:xx:xx:xx
  • e6:ea:ee:xx:xx:xx

  • 2a:2e:22:xx:xx:xx
  • 6a:6e:62:xx:xx:xx
  • aa:ae:a2:xx:xx:xx
  • ea:ee:e2:xx:xx:xx

  • 2e:22:26:xx:xx:xx
  • 6e:62:66:xx:xx:xx
  • ae:a2:a6:xx:xx:xx
  • ee:e2:e6:xx:xx:xx

This is the /etc/network/interfaces (Ubuntu 16.04) code I'm planning to use:

auto eno1 iface eno1 inet manual bond-master bond0 bond-primary eno1 bond-primary-reselect better post-up echo 6 > /sys/class/net/eno1/device/sriov_numvfs post-up for i in $(seq 0 5); do ip link set eno1 vf $i mac $(printf "22:26:2a"; od -An -N3 -tx1 /dev/urandom | sed 's/ /:/g'); done post-up for device in $(ls /sys/bus/pci/drivers/bnx2x | egrep -v "0000:[0-9a-f]{2}:00" | grep 0000); do echo $device > /sys/bus/pci/drivers/bnx2x/unbind; done auto eno2 iface eno2 inet manual bond-master bond0 post-up echo 6 > /sys/class/net/eno2/device/sriov_numvfs post-up for i in $(seq 0 5); do ip link set eno2 vf $i mac $(printf "62:66:6a"; od -An -N3 -tx1 /dev/urandom | sed 's/ /:/g'); done post-up for device in $(ls /sys/bus/pci/drivers/bnx2x | egrep -v "0000:[0-9a-f]{2}:00" | grep 0000); do echo $device > /sys/bus/pci/drivers/bnx2x/unbind; done auto eno3 iface eno3 inet manual bond-master bond1 bond-primary eno3 bond-primary-reselect better post-up echo 6 > /sys/class/net/eno3/device/sriov_numvfs post-up for i in $(seq 0 5); do ip link set eno3 vf $i mac $(printf "a2:a6:aa"; od -An -N3 -tx1 /dev/urandom | sed 's/ /:/g'); done post-up for device in $(ls /sys/bus/pci/drivers/bnx2x | egrep -v "0000:[0-9a-f]{2}:00" | grep 0000); do echo $device > /sys/bus/pci/drivers/bnx2x/unbind; done auto eno4 iface eno4 inet manual bond-master bond1 post-up echo 6 > /sys/class/net/eno4/device/sriov_numvfs post-up for i in $(seq 0 5); do ip link set eno4 vf $i mac $(printf "e2:e6:ea"; od -An -N3 -tx1 /dev/urandom | sed 's/ /:/g'); done post-up for device in $(ls /sys/bus/pci/drivers/bnx2x | egrep -v "0000:[0-9a-f]{2}:00" | grep 0000); do echo $device > /sys/bus/pci/drivers/bnx2x/unbind; done 


No comments:

Post a Comment