« NIC SR-IOV » : différence entre les versions
Aller à la navigation
Aller à la recherche
| Ligne 50 : | Ligne 50 : | ||
[Service] | [Service] | ||
Type=oneshot | Type=oneshot | ||
ExecStart=/bin/bash -c 'set -e | ExecStart=/bin/bash -c 'set -e; \ | ||
DEV=<font color=green>enp8s0f1np1</font> | DEV=<font color=green>enp8s0f1np1</font>; \ | ||
# wait for the PF to exist | # wait for the PF to exist | ||
for i in {1..20}; do | for i in {1..20}; do [ -e /sys/class/net/$DEV ] && break; sleep 0.2; done; \ | ||
echo 0 > /sys/class/net/$DEV/device/sriov_numvfs; \ | |||
sleep 1; \ | |||
echo <font color=green>4</font> > /sys/class/net/$DEV/device/sriov_numvfs; \ | |||
sleep 1; \ | |||
echo 0 > /sys/class/net/$DEV/device/sriov_numvfs | ip link set $DEV vf 0 mac 02:00:00:10:01:00; \ | ||
sleep 1 | ip link set $DEV vf 1 mac 02:00:00:10:01:01; \ | ||
echo <font color=green>4</font> > /sys/class/net/$DEV/device/sriov_numvfs | ip link set $DEV vf 2 mac 02:00:00:10:01:02; \ | ||
sleep 1 | ip link set $DEV vf 3 mac 02:00:00:10:01:03' | ||
ip link set $DEV vf 0 mac 02:00:00:10:01:00 | |||
ip link set $DEV vf 1 mac 02:00:00:10:01:01 | |||
ip link set $DEV vf 2 mac 02:00:00:10:01:02 | |||
ip link set $DEV vf 3 mac 02:00:00:10:01:03 | |||
RemainAfterExit=yes | RemainAfterExit=yes | ||
Version du 27 février 2026 à 12:45
Voir le nombre MAX de VF supportées
root@proxmox:~# cat /sys/class/net/enp8s0f1np1/device/sriov_totalvfs
Voir combien de VF sont actives actuellement
root@proxmox:~# cat /sys/class/net/enp8s0f1np1/device/sriov_numvfs
Créer des VF temporaire
Exemple : créer 4 VF
root@proxmox:~# echo 4 > /sys/class/net/enp8s0f1np1/device/sriov_numvfs
Créer des VF
On crée un service :
root@proxmoxve:~# vi /etc/systemd/system/sriov-x710.service
Contenu :
[Unit] Description=Enable SR-IOV on Intel X710 After=systemd-modules-load.service Before=pve-guests.service [Service] Type=oneshot ExecStart=/bin/sh -c 'echo 4 > /sys/class/net/enp8s0f1np1/device/sriov_numvfs' RemainAfterExit=yes [Install] WantedBy=multi-user.target
Puis on active le service ;
systemctl daemon-reload systemctl enable sriov-x710 systemctl start sriov-x710
Créer des VF avec adresses MAC fixes
On crée un service :
root@proxmoxve:~# vi /etc/systemd/system/sriov-x710.service
Contenu :
[Unit]
Description=Enable SR-IOV on Intel X710 (fixed VF MACs)
After=systemd-modules-load.service
Before=pve-guests.service
[Service]
Type=oneshot
ExecStart=/bin/bash -c 'set -e; \
DEV=enp8s0f1np1; \
# wait for the PF to exist
for i in {1..20}; do [ -e /sys/class/net/$DEV ] && break; sleep 0.2; done; \
echo 0 > /sys/class/net/$DEV/device/sriov_numvfs; \
sleep 1; \
echo 4 > /sys/class/net/$DEV/device/sriov_numvfs; \
sleep 1; \
ip link set $DEV vf 0 mac 02:00:00:10:01:00; \
ip link set $DEV vf 1 mac 02:00:00:10:01:01; \
ip link set $DEV vf 2 mac 02:00:00:10:01:02; \
ip link set $DEV vf 3 mac 02:00:00:10:01:03'
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
Puis on active le service ;
systemctl daemon-reload systemctl enable sriov-x710 systemctl start sriov-x710