Skip to content

Instantly share code, notes, and snippets.

@alyssaq
Last active February 13, 2024 08:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alyssaq/79908d1a032cfbb6f4fee9733295a2c9 to your computer and use it in GitHub Desktop.
Save alyssaq/79908d1a032cfbb6f4fee9733295a2c9 to your computer and use it in GitHub Desktop.
Create a VM in virtualbox with a static IP to allow ssh - ubuntu 16.04 amd64

Create a host-only network

In the virutal box UI, Global Tools tab > create vboxnet0 host network with DHCP disabled (untick Enable Server).

Create/modify a VM with host-only network

Select the VM (it must be shut down to add a 2nd network adapter) > Settings > Network tab > Adapter 2 > Attach Host-only adapter and vboxnet0

Set static IP in VM (ubuntu 16.04 amd64)

Start the VM.
Edit /etc/network/interfaces

auto enp0s8
iface enp0s8 inet static
	address 192.168.56.10
	netmask 255.255.255.0

Restart interface

sudo ifdown enp0s8
sudo ifup enp0s8

Check that it has been updated

ifconfig

Make VM ssh-able

sudo apt-get update
sudo apt-get install openssh-server

On host machine, you should be able to ssh:

ssh root@192.168.56.10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment