Skip to content

Instantly share code, notes, and snippets.

@jarolrod
Last active July 6, 2022 03:18
Show Gist options
  • Save jarolrod/385dc063bb02c90aea0cbe8a147fc418 to your computer and use it in GitHub Desktop.
Save jarolrod/385dc063bb02c90aea0cbe8a147fc418 to your computer and use it in GitHub Desktop.

Setting up a NetBSD VM with VirtualBox for testing of #25549

Pre-requisites

  • Download the NetBSD 9.2 release.
  • VirtualBox installed and properly setup on your system.

Install and Setup

  1. Setup the installation of the VM as you would any VM installation in Virtual Box.
  2. Boot into the installation image.

Basic Setup

Replicate the steps performed in the following screens. These screenshots skip over simple confirmation pages.

netbsd-basic-install-steps

Manual Configuration

After completing the above steps, you will be asked to perform some manual configuration. You should configure the network, set the appropriate time zone for you, leave root shell as /bin/sh, change the root password, enable installation of binary packages, enable sshd=YES, enable ntpd=YES, run ntpdate at boot=YES, add a user, then click on "Finished Configuring".

11-net

Setup SSH Server on VM

Within the VM, we want to open up the /etc/rc.conf file using an available text editor; such as vi. Append the following to the bottom of the file:

sshd=YES

You can now shutdown the VM. Before the next restart, make sure to remove the installation image from the VM's settings.

Setup SSH Settings on Host

We are going to run this vm headless then ssh into it. To do so, navigate to the settings page for the NetBSD vm you just installed, then click on the Network tab.

netbsd-settings

Click on Advanced, then click on Port Forwarding.

The following screen will pop-up. We are going to forward the vm's port 22 to an unused Host port. You should be able to use the port number shown in the following screenshot. Otherwise, fill in an unused port.

netbsd-port-settings

SSH into VM

In VirtualBox, run the VM as a headless system. Then from your Host system, once the VM has finally booted up, you can SSH into the VM with the following command (assuming you forwarded to the same HOST port as shown in this guide):

ssh -p 3022 <USER>@127.0.0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment