Using an SR-IOV Network Interface in a Proxmox LXC

For fun I was trying to work out how I could use an SR-IOV Interface for my LanCache container. Since it would let me run it with very low disk overhead, compared to a VM, and low network overhead compared to a virtual bridge; I am aware that this probably doesn’t affect much though.

Firstly you need to have SR-IOV enabled and working, and also have the VF’s showing up on the host, eg. interfaces similar to ens6f0v2 showing up in ip a.

Since as you may have noticed, proxmox doesn’t support this in the UI so you’re going to have to add these to the LXC’s config (nano /etc/pve/lxc/<ct-id>.conf). phys ens6f0v32  # Replace with your VF interface up  # Replace with your IP  # Replace with your Gateway eth0  # Not needed, but it makes things easier
# 9000  # Enable Jumbo Frames, doesn't work on my NIC

Depending if you’ve already got a network interface in the container, you may need to change the to or higher. Then you can start the container and your interface should show up in the container’s ip a:

root@lancache:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
299: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 0a:5b:a7:31:6d:4c brd ff:ff:ff:ff:ff:ff
    altname enp129s0f0v32
    inet brd scope global eth0
       valid_lft forever preferred_lft forever
    inet6 2001:<removed>/64 scope global dynamic mngtmpaddr 
       valid_lft 49244sec preferred_lft 49244sec
    inet6 fe80::85b:a7ff:fe31:6d4c/64 scope link 
       valid_lft forever preferred_lft forever


Thanks for reading!

This site doesn't use any Google services, read more here.
If I helped you please buy me a croissant or sponsor me on GitHub.

© Stephen Horvath 2023