Scenario :I am using KVM as a hypervisor and Ubuntu as guest and host OS. There are many VMs on a PM and I am assigning IP addresses to those VMs using NAT. To create VMs I am using a baseimage. So username in all the VMs will be same. Now I want to use those VMs from any machine outside of that PM, which are in the same subnet of the PM.

One way to resolve the problem may be to use a bridge to assign IP address using DHCP. But this is not usable/feasible in my case.

So is there any other way to do it ? How to do ssh on a VM with an local IP address ? Can we use some proxy type setting without having some security problems for the host OS ?


You can set up port forwarding on the physical machine, so that some physical machine's port in physical network is forwarded to the VM SSH port.

For example if the physical machine is and VM network, then port forwards can be like this: port 225 forwarded to port 22 port 226 forwarded to port 22

That is, the host machine's port number identifies the final target.

  • But how it will distinguish between two VMs ?
    – A-B
    May 3 '15 at 16:52
  • Updated the answer and added examples of the principle. May 3 '15 at 16:55

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.