Port Forwarding To a VirtualBox VM

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>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s