I have a mac host, and a VirtualBox Linux guest, currently using Bridged mode.
I need to be able to easily SSH into the guest from the host. It would be nice to use a hostname, but a never-changing IP address would be fine too (currently, the IP changes with each new network I join, and the hostname has never worked).
I also need internet access from the guest.
Other machines on the network do not need access to the guest.
What is the best way to configure my VirtualBox network?
Best Answer
First, you'll have to create the
vboxnet0
interface.VirtualBox > File > Preferences > Network > Host-only Networks > Add (you will get vboxnet0)
Then, run this on the host machine. You'll see a new interface,
vboxnet0
, appeared.Shutdown your VM and do:
Start VM, on guest run
and check ip
Check these links:
There is also solution for NAT but I haven't checked it.
Configuring port forwarding with NAT in your host machine
connect to your linux via the port 2222 of your host machine
For host-only networking with static ip check this:
https://stackoverflow.com/questions/5906441/how-to-ssh-to-a-virtualbox-guest-externally-through-a-host/27152153#27152153
It's for Solaris 10 and Ubuntu 16.04 but should be easy to adapt.