SR-IOV virtual function setup
HRio opened this issue · comments
Not sure if this is in scope for ifupdown-ng or not, opening this issue as a place to discuss it
Currently I setup vf NICs with a simple script, but it would be nice to be able to do with a file in /etc/network/interfaces.d/
.
Example for creation of 5 virtual functions for eth0
ip link set eth0 up
echo 1 > /sys/class/net/eth0/device/sriov_drivers_autoprobe
echo 5 > /sys/class/net/eth0/device/sriov_numvfs
After this MAC addresses can optionaly be set on each virtual function
# set mac
ip link set eth0 vf 0 mac 00:16:3e:8e:af:6f
ip link set eth0 vf 1 mac 00:16:3e:b2:3f:f4
ip link set eth0 vf 2 mac 00:16:3e:b8:c2:e0
ip link set eth0 vf 3 mac 00:16:3e:59:be:e3
ip link set eth0 vf 4 mac 00:16:3e:25:cb:2c
And anti-spoof filtering can be enabled as well
# enable anti spoof filter
ip link set eth0 vf 0 spoofchk on
ip link set eth0 vf 1 spoofchk on
ip link set eth0 vf 2 spoofchk on
ip link set eth0 vf 3 spoofchk on
ip link set eth0 vf 4 spoofchk on
Regarding MACs it would be nice to randomize them on first setup but then keep the "state" for later reboots.
How this could look
iface eth0 inet manual
vf-numvfs <int>
vf-drivers-autoprobe <bool>
vf-random-mac-keep-state <bool>
vf-spoofchk <bool>