Skip to content

Port forwarding

Ari edited this page Nov 26, 2026 · 1 revision

With NAT networking (the default) a VM can reach the internet, but nothing on your PC can reach the VM. Port forwarding fixes that for the services you pick: a port on your PC passes through to a port in the guest.

Setting one up

  1. Power off the VM. Hardware can't change while it runs.
  2. Open the Hardware tab and scroll to Port forwarding.
  3. Click a preset or Add:
Button This PC Guest For
SSH 2222 22 ssh -p 2222 user@127.0.0.1
RDP 3389 3389 Remote Desktop to 127.0.0.1
HTTP 8080 80 a web server in the guest, open http://127.0.0.1:8080
Add 10022 22 a blank row to change
  1. Click Save, then power on.

If a preset's port is already in your list, it takes the next free one (a second SSH row gets 2223). The Summary tab lists the forwards under Network.

Things to know

  • Only your PC can use them. Forwards listen on 127.0.0.1, so other machines on your network can't connect to the VM through them.
  • The service has to be running in the guest. Forwarding port 22 doesn't install SSH. On Debian or Ubuntu that's sudo apt install openssh-server. A guest firewall can still block it.
  • Each port on your PC can only be used once. The same number on TCP and UDP is fine. Rows with a bad or repeated port show the problem in red and Save stays off until it's fixed.
  • "In use on this PC right now" (amber) means another program already has that port. You can still save, but the VM won't start while the port is taken. The usual one is RDP: if Remote Desktop is turned on in Windows, 3389 is taken, so use something like 13389 instead.
  • Only with NAT. With Network set to Disconnected the forwards stay in the list but aren't used.

When it doesn't work

  • "TCP port 2222 on this PC is already in use" when powering on: another program or another running VM has it. Change the port on the Hardware tab, or close the other thing.
  • Connection refused or it hangs: check the service is running in the guest and listening on the guest port (ss -tlnp on Linux).
  • SSH says the host key changed: you forwarded the same port to a different VM before. Remove the old line from %USERPROFILE%\.ssh\known_hosts, or give each VM its own host port.

See also Hardware settings and Troubleshooting.

Clone this wiki locally