Pass through NIC to VM for promisc mode in Unraid


d4nk

Recommended Posts

I want to pass through a NIC to my VM for use with promisc mode, so it can do network monitoring. I have another NIC which Unraid is using for normal ops. 

I read here https://forums.unraid.net/topic/37959-guide-passing-through-network-controllers-to-unraid-6-virtual-machines/ that all I need to do is add pci-stub.ids=[id] to the startup config but after doing that and rebooting, the NIC is still in use by Unraid and I can't do a port down on it because it's eth0.

lspci shows:

08:00.0 Ethernet controller: Intel Corporation I211 Gigabit Network Connection (rev 03)

 

lspci -n shows:

08:00.0 0200: 8086:1539 (rev 03)

 

Here's my syslinux config:

kernel /bzimage
append pci-stub.ids=8086:1539 initrd=/bzroot

 

But after rebooting, that NIC is still showing up as eth0 in the Network Settings and when I configure passthrough in the VM settings:

<hostdev mode='subsystem' type='pci' managed='yes'>
<source>
<address domain='0x0000' bus='0x08' slot='0x00' function='0x0'/>
</source>
</hostdev>

 

I get error:

"unsupported configuration: host doesn't support passthrough of host PCI devices"

What am I doing wrong?

 

I'm running Unraid 6.8.2

Edited by d4nk
Link to comment
20 hours ago, lusitopp said:

Now im a noob here. But since unraid is complaining about eth0, try to shut down array, go to network settings and make sure to switch nic, so the nic you want to use is not eth0

There is no option to "switch NIC" in Network Settings.

 

eth1 is configured with the IP, gateway, DNS, etc.

eth0, the one I want to pass through, is not configured with an IP or anything but it is in the Network Settings at the top and there's no option next to it for "Port Down".

Link to comment

Hi,

I also had to set up a PCI nic because of the operating system i was using did not support Wireshark. I had a lot of issues using the command line and manual XML because i am also new to a lot of the unraid but there is a really easy way to manage all the PCI stuff by using virt manager.

have a look at this post



Virt Manager is much more powerful to use than what unraid has in-built. Once you have set up virt manager, all you will need to do is go into your virtual machines hardware settings and add a new "PCI Host Device". just make sure you don't select your Eth0 device, since that will pass over what unraid uses for management. Vert manager will actually have a little "(eth0)" or "(eth1)" at the end of the device name in the pci hardware list to make this even easier.

If you want to switch what unraid uses as Eth0, take the array offline, then go "Settings > Network Settings > Interfaces Rules section" 
you will see the network devices as MAC addresses. switch these around.

Lastly, if you have trouble seeing the device in your PCI hardware list you may need to check IOMMU setting in your motherboard bios

Edited by PCwhale
Link to comment
47 minutes ago, PCwhale said:

If you want to switch what unraid uses as Eth0, take the array offline, then go "Settings > Network Settings > Interfaces Rules section" 
you will see the network devices as MAC addresses. switch these around.

This is all I have under Interface Rules in Network Settings when the Array is Offline. No option to switch what Unraid uses as eth0.

image.thumb.png.f7c878b30530425eb8c94b92dcecfe04.png

Link to comment
9 minutes ago, d4nk said:

This is all I have under Interface Rules in Network Settings when the Array is Offline. No option to switch what Unraid uses as eth0.

image.thumb.png.f7c878b30530425eb8c94b92dcecfe04.png

if the device 0x8086... A0:36:... is your main NIC for unraid then that is correct. your eth allocation is a bit jumbled up but its fine. if you assigned your NIC correctly you should see it in your list of devices under "other PCI devices" when you edit your VM. for example like this NVME PCI SSD and USB controllerimage.png.3351f2dc8179f28382647f53e1287904.png

If you don't see the Network PCI device then you must assign it, i recommend you do it with virt manager for your own sanity. 

 

Unraid will automatically give over control of that PCI device when you turn on the virtual machine

Link to comment

This is Solved.

 

The issue was with eth0 being assigned to the NIC I wanted to use. But I couldn't change it because I had already done the pci-stub. 

The solution was to remove the pci-stub from syslinux config, restart, change the NIC to be eth2 in the Network Settings under Interface Rules, restart, add the pci-stub, restart, and then, it worked correctly. 

 

However I then ran into the issue that IOMMU was not enabled, which is required to pass through a PCI device to a VM. I enabled that on my AMD motherboard (not easy to find in the BIOS) rebooted, and finally was able to easily assign the PCI NIC to the VM in the GUI (no need for VM XML editing or virt manager). After that, setting ifconfig promisc in the VM worked like it would on physical hardware. Success!

 

Easy.

Link to comment
  • 2 months later...
On 4/6/2020 at 3:18 PM, d4nk said:

This is Solved.

 

The issue was with eth0 being assigned to the NIC I wanted to use. But I couldn't change it because I had already done the pci-stub. 

The solution was to remove the pci-stub from syslinux config, restart, change the NIC to be eth2 in the Network Settings under Interface Rules, restart, add the pci-stub, restart, and then, it worked correctly. 

 

However I then ran into the issue that IOMMU was not enabled, which is required to pass through a PCI device to a VM. I enabled that on my AMD motherboard (not easy to find in the BIOS) rebooted, and finally was able to easily assign the PCI NIC to the VM in the GUI (no need for VM XML editing or virt manager). After that, setting ifconfig promisc in the VM worked like it would on physical hardware. Success!

 

Easy.

 

Update 2 - I have now also come up with a way to do all this without using an entire NIC passed through to each VM.  See my post at:

 

 

Update 1 - I also solved the issue by passing through a PCIe slot as well as "half" a 4-port NIC.  Everything below is just for history in case it helps other people.

 

Would very much like to know how you managed to get this working.  I'm not passing through a NIC (because I wanted multiple VMs to capture from the same physical interface) in my case but I don't think that should matter since the problem I'm running into was reported both with/without pass through as per:

 

https://forums.unraid.net/topic/79511-enable-promiscuous-mode/?_fromLogin=1

 

I'm having the same issue as those folks in that I have promiscuous mode up and running yet all I see on any VMs attached to the bridged interface is broadcast traffic.  In your case, did you try without pass through and then moved on to pass through because you had the same issue?

 

Many thanks in advance for any insight/help.

 

 

Edited by Hadrian_Aurelius
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.