VirtualBox

Create a VirtualBox nat network

Create a new NAT network

  • Open File -> Preferences or ctrl+G.
  • Open Network -> NAT Networks tab and add a new nat network. Edit its settings accordingly.

Create a host-only network

  • Open File -> Preferences or ctrl+G.
  • Network -> Host-only Networks tab and add a new host-only network. Edit its settings accordingly.

Edit VM’s network settings

  • Shutdown your VM.
  • Open your VM’s settings or ctrl+S.
  • Open Network -> Adapter 1 -> Choose NAT Network.
  • Choose the Name of your Nat Network.
  • Open Network -> Adapter 2 -> Choose your Host-only Adapter (configure Attached to and Name).

IP address

  • Start your VM.
  • Edit /etc/network/interfaces and append the following lines:
auto enp0s8
iface enp0s8 inet static
address 192.168.56.101
netmask 255.255.255.0

You can now access your VM using its 192.168.56.x IP address (if you kept the default ip range ofc).