bhyve Better approach for bhve networking + NFS?

Hi,

I'm virtualising my Linux development environment for $DAY_JOB using bhyve, vm-bhyve, and NAT. I expose files on the guest to the host using NFS, and edit those files on the host.

Networking is via NAT on either Ethernet (on my desktop), or Wi-Fi (on my laptop). It's the latter that's giving me trouble.

Because I'm moving around on my laptop, my Wi-Fi connection (on wlan0) periodically drops and reconnects, causing problems for NFS as the public switch I'm using for my bhyve guests is connected to
wlan0. When my Wi-Fi connection changes, host processes - especially my editor - occasionally get stuck in a system call and lock up.

Can anyone suggest a better networking setup, that provides Internet access to the guest, but is resilient to intermittent network connectivity on the host?
 
use a separate bridge for the VMs? for NAT you don't need to bridge VMs' host side interfaces with host's public network interface.
 
Thinking outside the box a little bit. You could setup a 9P filesystem share. This only works one way though, so the files would reside on the host. You could then map the shared folders in your Linux guest as needed. This way networking is completely out of the equation for file sharing.
 
I have been using 9P for that exact use case for about 6 month and it works beautifully. It is rock solid.
Here is an example of my configs:

vm-bhyve on the host:
Code:
disk0_type="nvme"
disk0_dev="sparse-zvol"
disk0_name="disk0"

disk1_type="virtio-9p"
disk1_name="my_share_name=/home/mpizarro/work"
disk1_dev="custom"

/etc/fstab on a debian vm
Code:
my_share_name    /home/mpizarro/my_mount_point    9p    trans-virtio,version=9p2000.L,msize=104857600,rw    0    0


and/or, if at some point you need to use mount:
mount -t 9p -o trans=virtio,version=9p2000.L,rw my_share_name /home/mpizarro/my_mount_point
 
Follow-up: I ended up setting up a Linux-based dev environment inside the VM, and use X forwarding to display Emacs, Firefox, etc. on the host machine. Works a treat, and certain things (e.g. LSP indexing) are as expected much faster running entirely within the VM vs. over NFS / SSHFS.
 
Can you share a bit more about how emacs is setup? I tried emacs with X forwarding and it took like 15 seconds to render the init screen. m-x prompt took several seconds as well. I read something about how emacs with X forwarding is terribly slow (like I saw), so I'm curious what your config is that it works well.
 
Back
Top