sshipvirtual-machinevmware-player

How can I SSH directly into a VMWare virtual machine from an external computer?


I am running Kali Linux on Virtual Box on my personal computer. There is another computer on the same network that has a virtual machine on it. I want to SSH directly from Kali Linux (on my computer) into that other computer's virtual machine directly.

I don't want to go through two steps (SSH into the other computer, then SSH into its virtual machine). The other computer uses VMWare Player as its virtualization software. Its guest is metasploitable.

Any ideas?

EDIT: The VM on the other machine needs to stay in NAT mode for my purposes.


Solution

  • You need to put your VMware Player network adapter into bridged mode. This will make the VMware Guest visible to the other computers on your network including to your VirtualBox guest.

    If the VM needs to stay NATed then you will have to create a port forward rule on port 22. To do that you need to make sure that vmnetcfg was installed when you installed VMWare Player.

    Open that Utility by going to the directory where you installed VMware Player and run vmnetcfg.exe. From there you will be able to create a port forwarding rule by choosing your VMs network adapter and selecting "NAT Settings". There is a section of that menu where you can create port forwarding rules. You'll want to forward port 22 to the VM (unless you've changed the ssh port on your server, then forward whatever that port is).

    If you don't have that tool installed, you can get it by running

    VMware-player-?.?.?-??????.exe /e .\VMTools
    

    Then from your Kali box you can ssh to the IP of the VMWare host machine and the ssh traffic will get passed through to the VM.