VM 호스트에서 SR-IOV 적용된 vNIC을 가상머신에 추가하기
VM 호스트 머신의 NIC 및 vNIC 확인
lspci | grep -i eth
41:00.0 Ethernet controller: Intel Corporation Ethernet Controller 10-Gigabit X540-AT2 (rev 01) 41:00.1 Ethernet controller: Intel Corporation Ethernet Controller 10-Gigabit X540-AT2 (rev 01) 41:10.0 Ethernet controller: Intel Corporation X540 Ethernet Controller Virtual Function (rev 01) 41:10.2 Ethernet controller: Intel Corporation X540 Ethernet Controller Virtual Function (rev 01) 41:10.4 Ethernet controller: Intel Corporation X540 Ethernet Controller Virtual Function (rev 01) 41:10.6 Ethernet controller: Intel Corporation X540 Ethernet Controller Virtual Function (rev 01) 41:11.0 Ethernet controller: Intel Corporation X540 Ethernet Controller Virtual Function (rev 01) 41:11.2 Ethernet controller: Intel Corporation X540 Ethernet Controller Virtual Function (rev 01) 41:11.4 Ethernet controller: Intel Corporation X540 Ethernet Controller Virtual Function (rev 01)
ifconfig | grep UP
enp65s0f0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 9000 enp65s0f1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 enp65s0f0v0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 enp65s0f0v1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 enp65s0f0v2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 enp65s0f0v3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 enp65s0f0v4: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 enp65s0f0v5: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 enp65s0f0v6: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
사용할 vNIC 의 PCI 주소 확인
위에서 조회한 vNIC 중에서 enp65s0f0v2 을 사용하도록 함
3번째 줄의 bus-info 는 domain : bus : slot . function 으로 기록되어 있음
0000:41:10.4 → domain=0x0000 / bus=0x41 / slot=0x10 / function=0x4 임을 확인함
ethtool -i enp65s0f0v2
driver: ixgbevf version: 4.18.0-326.el8.x86_64 bus-info: 0000:41:10.4
생성한 VM 에 vNIC 할당
LINE 1 type : hostdev
LINE2 mac : enp65s0f0v2 의 맥주소
LINE5 source address : 위에서 확인한 정보
virsh edit MY_VM_NAME
<interface type='hostdev' managed='yes'> <mac address='a6:86:5c:bc:dd:11'/> <driver name='vfio'/> <source> <address type='pci' domain='0x0000' bus='0x41' slot='0x10' function='0x4'/> </source> <rom bar='off'/> <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/> </interface>