[cs631apue] Connecting to Netbsd running on VM

Jan Schaumann jschauma at stevens.edu
Thu Aug 29 18:14:50 EDT 2019


Elliot Wasem <ewasem at stevens.edu> wrote:
> I figured it out by doing the following:
> 
> 1. Setup the 2nd network interface on the VM to be host only

You don't even need a second nic.  A single nic in NAT
mode ought to be sufficient.

> 2. Restart your vm, and install openssh. Start sshd

No need to install openssh; it's part of the NetBSD
operating system, so you just need to configure the OS
to start it.  You can do that at install time via the
dialog, or later by adding

sshd=YES

to /etc/rc.conf and either rebooting or running

/etc/rc.d/sshd start

> 3. Find the inet ip address for your vm
> 4. Through VirtualBox, forward some port (i used 2222) from 127.0.0.1 on
> your host machine to the inet ip on port 22 of your VM.

In the VirtualBox configuration, you can even leave
out the guest IP and simply forward a given port from
localhost to the VM.  You can also do that via the
command-line:

VBoxManage modifyvm "your VM name here" --natpf1 "ssh,tcp,127.0.0.1,2222,,22"

See also:
https://www.virtualbox.org/manual/ch06.html#natforward

I'll see if I can make the time to provide a
step-by-step guide to set up your VM, but don't wait
for those instructions.

-Jan


More information about the cs631apue mailing list