this post was submitted on 17 Dec 2023
19 points (91.3% liked)

Selfhosted

40296 readers
344 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

I have recently setup a system with TrueNAS scale and while it's been mostly smooth sailing (lies), I can't figure out why TrueNAS itself cannot connect to virtual machines and vice versa, which kinda sucks for me as I have a wireguard server setup on a virtual machine, which works but clients connecting to it cannot connect to anything hosted on the host itself...

(And the whole reason I have wireguard setup like this is because I couldn't figure out how to setup the wg-quick app, it just refuses to work for unknown to me reasons... and by "work" I mean that the WG clients just cannot connect to it, the webui itself works).

The VMs are set with Virtio as their NIC and truenas itself is set to a static IP and can connect to everything else...

Any help would be appreciated...

[SOLUTION]

This is gonna be a quick overview on how to fix this issue, as it seems to be fairly common. You can find more detailed instructions here: https://forum.level1techs.com/t/truenas-scale-ultimate-home-setup-incl-tailscale/186444

Scroll down to the section titled “Oh but wait”

Note: This problem cannot be fixed through neither the webui, web shell, nor SSH, you need to have physical access to the machine, a display adapter and a monitor to display the TUI on.

  1. From the cli menu, go to "Configure network interfaces"

  2. Remove DHCP/Any other static alias you have on your main interface by either pressing delete on it or by manually going to it and deleting it, just leave the alias field blank and ipv4_dhcp to "No", then click on Save

  3. Create a new interface by bressing "n", select type 'BRIDGE", set name to "br0" (without the quotes) and either enable DHCP or add the IP alias that you previously removed from your main interface as an alias here and click on Save

  4. Back on the main "Configure network interfaces screen" press "a" to save changes, then "p" to make them permanent (again without the quotes).

  5. At this point, your network should drop out and you shouldn't be able to connect to the WebUI. Reboot the system and everything should work properly again!

  6. That's it! Problem solved. Now you should go and change the NICs of the VMs to use the new br0 and they should able to connect to the truenas host just fine.

all 9 comments
sorted by: hot top controversial new old
[–] Voroxpete@sh.itjust.works 9 points 11 months ago (2 children)

From what I understand Scale uses libvirtd and KVM virtualization. You're probably using the builtin virtio virtual network, which uses macvlan if I recall correctly. Anyway, because of the way it's set up, communication between the VMs and the host is impossible. I'm guessing that what you need to do is create a bridge on the host, and then assign it directly to each of the VMs. That's how it works with regular KVM anyway. If TrueNAS are doing something different that might throw a wrench.

[–] Sethayy@sh.itjust.works 1 points 11 months ago

Though if you have hairpin mode on your router/switch I believe it works, just most not bought specific for it don't have the option

[–] kylian0087@lemmy.world 1 points 11 months ago

This is corect. You need too use a bridge for VMs to communicate with the host. Been doing it like this for about a year. Also i added a special bridge gave the bridge a static IP so i can connect VMs to things like network shares without any fysical network connectivity.

[–] yoast@notdigg.com 4 points 11 months ago* (last edited 11 months ago) (1 children)

This guide explains what's going on and how to fix it. Scroll down to the section titled "Oh no but wait"

https://forum.level1techs.com/t/truenas-scale-ultimate-home-setup-incl-tailscale/186444

Here's the corresponding video

https://youtu.be/R7BXEuKjJ0k?si=TvTONP3tbsCQeU5X

[–] Presi300@lemmy.world 3 points 11 months ago

Yep, that fixed it, tysm, adding a solved flag and a few quick steps on fixing it for anyone else who might have the same problem, as it does seem to be a common issue with truenas

[–] CMahaff@lemmy.world 4 points 11 months ago* (last edited 11 months ago) (1 children)

I ran into the same thing. I've always just worked around it, but I believe I did find the solution at one point (can't find the link now).

But if I am remembering right, I believe you need to manually create a bridge between the two networks - by default it isolates the VMs from TrueNAS itself for security reasons.

Sorry I can't link the exact fix right now, but hopefully this will help you Google the post I found on the subject.

[–] Presi300@lemmy.world 1 points 11 months ago

I got that I need to do something like that but... I have no idea how, I'm very new to TrueNAS

[–] mouse@midwest.social 1 points 11 months ago* (last edited 11 months ago)