I have Intel Macs and run virtual machines on them using VMware Fusion. At one time, I configured a firewall/router to run in a VMware virtual machine on a Mac mini. It was configured this way:
- If power fails, the Mac was configured to automatically startup and boot.
- At boot time, the Mac would automatically login to an unprivileged account on the Mac.
- The unprivileged account had VMware Fusion set to launch as one of its "Startup Items"
- The firewall/router virtual machine was configured so that it would automatically start up whenever VMware Fusion was launched.
- The firewall/router had its own bridged IP address on the LAN. That virtual machine IP address was the "gateway" for all the devices on the house network LAN.
- The firewall/router had a second USB to Ethernet network interface for the WAN (the public IP address from the ISP).
It worked very reliably and well for a couple years at least. At some point, Apple seems to have changed something in the macOS boot process, where the virtual machine would try to attach to the USB/Ethernet adapter, but the macOS drivers were not yet ready or the device was not yet recognized by the Mac, still booting. The easy, quick fix was to unplug and reconnect the USB/Ethernet adapter after booting the Mac. The virtual machine firewall/router would detect it and connect to the internet and the firewall would work. It was something that I could teach my partner to do if I was away on travel, but I did not like that it had become necessary.
I sent you a PM with a link to the configuration details, but your problem is somewhat different. There were also security issues with my approach, and now I run that same firewall in its own hardware appliance.
I think it can be made to work the way you want, but I do not have experience with VirtualBox, only VMware Fusion. In web searches found some links that talk about how to launch VirtualBox as a service, and I like that idea much better than using automatic login to an account the way I did. In addition, I found this link, which may yield another clue:
https://stackoverflow.com/questions...hostwhen-virtualbox-guest-windows-is-shutdown
Sorry that I do not have a cookbook solution, but I hope this post takes you further toward your goal.