The small linux problem thread

what’s your /etc/exports say? on the share host

/etc/exports on the share / host is:

/mnt/homeserver_share 192.168.0.*(rw,sync,no_root_squash)

This nfs share works on my desktop and laptop. But not on the VM.

Can you confirm the VM can ping the NFS server?

What happens if try auto (just to eliminate some variables)?

Are you using NFSv3 or v4?

I cannot ping the NFS server, which is also the VM host. Is it an issue that the VM is using a bridge connection with the same computer it is trying to connect to?

1 Like

Bingo

Add another virtual nic on the VM using nat

1 Like

Are you sure you’re having heat issues and not sensor issues? NCT6775 isn’t fully supported and the on-die CPU temp monitor isn’t working under Linux last I checked. You might just not be ramping your fans the way you should be.

I’ve had my 1700 thermal shutdown at 65c before, only to find out that the sensor that’s “CPU” isn’t actually CPU, but CPU socket.

3 Likes

It’s not related to your problem but it it isn’t recommended to use no_root_squash for NFS as it is entirely possible for a remote user to use it to gain privilege escalation and access to a root shell. might not be terribly important for a local file share but its something to think about. instead root_squash should be used.

2 Likes

This is true.

2 Likes

How exactly would that work? The VM would be on a different network, and I wouldn’t be able to SSH to it and it wouldn’t be able to see the NFS server, right?

I’ve always had a real hard time understanding how the virtual adapters and NAT works, so sorry if that sounds dumb.

1 Like

keep the virtual nic that is bridged, just add another virtual nic and choose NAT. It should get a dhcp. Check the IP of the host machine. just connect NFS using that virtual network. Will have to add the new IP in the /etc/exports file too.

1 Like

I’m probably missing a step or not understanding something.

I added the second virtual NIC, linking it to a virtual network that is set to NAT and linked to the physical NIC on the host. This virtual network has an IP range that does not (and cannot) match the physical network.

The original virtual NIC is directly attached to the same physical host NIC, and is set to bridge mode.

I added the second IP range to the exports file and updated it.

The VM boots, but does not connect to the NFS share still.

1 Like

Take screenshots if you dont mind … but you may need to adjust firewall / restart services

1 Like

VM NIC1:
001

VM NIC2:
002

Virtual Network Setup:
003

VM ifconfig:
004

Host exports:
005

3 Likes

I’d further recommend using all_squash along with anonuid and anongid to associate user/group with a specific host or subnet.

Or use kerberos/NFS4 if you’re feeling fancy…

1 Like

@marasm on the NFS server, can you now ping 192.168.100.215?

@marasm are you using macvtap for any particular reason for that first NIC? Because, as the warning in your first screenshot says, “In most configurations, macvtap does not work for hosts to guest network communication.”

Switch to the default NAT networking, and you’ll be able to connect from the VM to the host OS (edit: and vice versa).

@nx2l Yes, the host can ping the guest, but not vice versa. Probably/possibly because of the use of macvtap as @magicthighs suggested?

@magicthighs The reason the first NIC is using that mode is because that’s the only way I have found to be able to access the VM from the physical network. Is there a better way?

@oO.o I will definitely look into changing the NFS settings, but probably not until I get this initial issue working first. Gotta change one thing at a time. I’m all for better security and better performance, and I’ll probably ask about getting that set up right a bit later. I remember it took me forever a couple years ago to get NFS setup and working, so I have just been transferring that client setup from install to install because it’s a known working config.

Probably. From your ifconfig output I conclude you have two NICs in your server. You could try dedicating one of them for your VMs. That way all the VMs that make use of this bridge get an IP on your local network.
The procedure is described here: https://wiki.libvirt.org/page/Networking#Bridged_networking_.28aka_.22shared_physical_device.22.29

I’ve been using a setup like this for a few years, it works really well. Any VMs you really don’t want to be accessible from the local net (maybe because you only want to use a reverse proxy for those) can just use the default NAT networking.

Edit: spelling

The server does not have two NICs, but I can add another one. I remember having to do this previously. So there really is no way to do this without having a second physical host NIC?

In any case, I’ll shut it down, throw in the second NIC, and set up the bridge for the VM(s).

You can do it with a single NIC too, no problem. I like using separate NICs if I can, but there’s no reason it shouldn’t work with a single one.