Static IP SR-IOV NIC

Hi,

I need to specific static ip addresses for some containers using the sr-iov config https://lxd.readthedocs.io/en/latest/instances/#nic-sriov

Ubuntu 20.04 does support it on the OS level via netplan https://netplan.io/examples/#configuring-sr-iov-virtual-functions. I’m using Ubuntu 20.04 as the host and in the containers.

Is there some onfiguration I can do within the container to get a static ip? Or will I be able to specify an ip address in the lxd config in the future? Having to use DHCP makes things a bit difficult.

When using SR-IOV, LXD itself cannot pre-configure the interface or control its IP allocation as it’s not really in control of it.

Your best bet is to use a cloud-init enabled image (ubuntu:XYZ or images:XYZ/cloud) and use user.network-config to fit cloud-init with your netplan configuration.

That way when the instance first boots, cloud-init will write down the suitable static config into netplan.

OK thanks a lot