9

I know how to configure NAT-based port forwarding using the VirtualBox graphical interface (as in the example below).

How can I do the same via the command line?

Port forwarding via VirtualBox GUI

14

If the machine is powered off, you may use the modifyvm command:

VBoxManage modifyvm "VM name" --natpf1 "guestssh,tcp,,2222,,22"

If it's powered on, controlvm.

  • 1
    Thanks for the natfp<nic number> on controlvm. That helps automating the setup of my VMs. – Jari Turkia Apr 18 '18 at 11:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.