Posting this little tidbit for myself. Turns out VirtualBox has a lot of interesting NAT options:

Nat Forwarding - VirtualBox

To forward a port from a host machine to a VM, all you need to do is find VBoxManager (.exe at the end for windows) and type:

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

And now you have forwarded port 2222 of your host machine to 22 of your VM.

Would love to know how to delete these rules though.

EDIT: just found it, awesome: VBoxManage Command Reference

--natpf<1-N> delete <name>


comments powered by Disqus

About Yusuke Tsutsumi
I work at Zillow. I focus on tools and services for developer productivity, including build and testing.

My other interests include programming language design, game development, and learning languages (the non-programming ones).