Re: SR-IOV pool with static MAC address and vlan

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Paul,

You can set the static MAC address and VLAN in the interface section of the VM xml.
So it will not change even when the VM shuts down and restarts.
VM interface xml:
<interface type='network'>
<mac address='52:54:00:85:e2:cd'/>
<source network='hostdev_net'/>
      <vlan>
        <tag id='42'/>
      </vlan>
    </interface>

And set the network(vf pool) with xml like below:
# cat hostnet.xml
<network>
 <name>hostdev_net</name>
  <forward mode='hostdev' managed='yes'>
    <pf dev='eth0'/>
  </forward>
</network>
(eth0 is the PF's name, refer to https://libvirt.org/formatnetwork.html#connectivity, hostdev part)
or:
# cat hostnet.xml
<network>
 <name>hostdev_net</name>
  <forward mode='hostdev' managed='yes'>
   <address type='pci' domain='0x0000' bus='0x03' slot='0x10' function='0x0'/>
  <address type='pci' domain='0x0000' bus='0x03' slot='0x10' function='0x2'/>
  </forward>
</network>
(the address is VF's pci address, you can specify multiple addresses at once)

# virsh net-define hostnet.xml
# virsh net-start hostdev_net

Hope it helps.

BR
Yalan


On Sun, Apr 2, 2023 at 10:06 AM Paul B. Henson <henson@xxxxxxx> wrote:
I'm planning to set up a libvirt/kvm system using a card with SR-IOV
support. I'd like to use the vf pool option rather than statically
assigning a vf to each vm. However, I'd also like each vm to have a
static MAC address and I have multiple VLANs they will be on.

I found in the documentation a syntax for specifying a MAC and a vlan
when the vf is statically assigned, but I don't see anything in the
documentation about doing so when using a vf pool?

Did I miss something? Is it possible to do so? If not, is there some
other way to handle MAC addresses and vlans with a vf pool, or if you
need those are you stuck with static assignment?

Thanks much...


[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux