Table of Contents
VirtualBox
Shortcuts
Switch to/from scale mode:
<Host Key> + c
Networking
Setting up a bridged apater is simplest if you can directly get an IP address from your current network's DHCP server.
However, if you want / need to only have the server accessible locally, you can setup a NAT and then give it a local IP address that you can remote into from there.
First, you'll need to setup the Virtual Box local network. This is done in File → Preferences → Network → Host-only Networks
. Add a new host network, which will be vboxnet0
by default.
In the individual Virtual Box server, go to Settings → Network → Adapter 1
. Toggle Enable Network Adapter
and set Attached to
to NAT
.
For Adapter 2
, also enable the network adapter, but Attached to
is set to Host-only Adapter
. The Name
for this one will be the one created in the preferences, again vboxnet0
by default.
Once the server is started, send a DHCP request for the second Ethernet device, and it will give a local IP address (fex: 192.168.56.101) that you can use to remote into the guest directly from your host box.
Get the IP address for your Local Network on the host:
ifconfig vboxnet0
This will give the IP address (should end with .1), the broadcast and netmask as well. On the guest, set the configuration for the local network IP address to something in that same subdomain, and you should be able to log in just fine.
Here's an example on Ubuntu for eth1
in /etc/network/interfaces
:
auto eth1 iface eth1 inet static address 192.168.56.10 netmask 255.255.255.0
Also, an example for enp0s8
in /etc/conf.d/net
:
config_enp0s8="192.168.56.20 netmask 255.255.255.0"
Gentoo
Install the app-emulation/virtualbox-modules
package, and then add this to /etc/conf.d/modules
:
modules="vboxdrv vboxnetflt vboxnetadp"
Load the new modules:
/etc/init.d/modules restart
Setup the network address manually for the local vboxnet0 network.
Add to /etc/conf.d/net
:
config_enp0s8="192.168.56.2 netmask 255.255.255.0"