Skip to Content

Setup Port Forwarding on VirtualBox VM

Published on August 28, 2026

Time to read: 2 minutes

Port forwarding can be used with a VirtualBox Virtual Machine (VM) to quickly allow a network connection into the VM from the host. For instance, if you need to ssh into a VM with a specific tool such as vscode, you can use port forwarding as a simple alternative to setting up a full host-only network.

This post assumes you already have a VM imported into VirtualBox

NOTE: Some SCS VMs may have port-forwarding preconfigured

Steps to setup port forwarding

VirtualBox VM Network Settings Tab
VirtualBox VM Network Port Forwarding Window

The next time you start the VM, the port forwarding will be setup. You may get a networking notification that a rule is being setup, and you may have to enter an admin password for your host device.

Test the connection

For the above example, you can test by using a terminal (mac/linux terminal, vscode, powershell, etc) to try an ssh to the VM. The username below is the username on your VM.

ssh -p 2222 username@localhost