0

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 ?

2

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 10.10.10.1 and VM network 192.168.0.0/24, then port forwards can be like this:

10.10.10.1 port 225 forwarded to 192.168.0.1 port 22 10.10.10.1 port 226 forwarded to 192.168.0.1 port 22

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

2
  • 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.