Virtualbox development environment setup

Networking between host and guest

Adapter 1 leave as NAT

Add Adapter 2 as Host-only Adapter on vboxnet0 with Promiscuous Mode denied.

[Optional] Set up SSH server on guest

File-sharing between host and guest

First rule is that the Guest Additions Shared Folders are very rudimentary and do not maintain user ownership nor permissions.

For a secure network such as the host-only network between host and guest, use NFS.

  1. Host: Install NFS server software: # sudo apt install nfs-kernel-server
  2. Guest: Install NFS client software: # sudo apt install nfs-common
  3. Determine your host and guest ip numbers and either use them or assign names to them in /etc/hosts
  4. Host: Export shared directory: Edit /etc/exports adding a line like:
    /sharedhostdirectory guestname (rw,sync,no_subtree_check)

    After editing the exports file, restart host NFS-server sudo systemctl restart nfs-kernel-server

  5. Guest: Mount shared directory: Edit /etc/fstab adding a line like:
    hostname:/sharedhostdirectory guestmountpoint nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0

    For example:

    vbhost:/srv/www /srv/www nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0

References

5 / 2025