0

For some reasons I installed virtual machines inside a virtual machine, like this:

A( B( C ))

where A is the physical machine, B is a vm and the network type is NAT. And C is also a virtual machine and the network type is bridged.

The OSes are Ubuntu 12.04 and the hypervisors are kvm.

I can access B via VNC and via ssh from A, but for C I can't use ssh because C has no IP address at the start. And I assume I can only access C via VNC.

I tried something like(on A):

iptables -t nat -A PREROUTING -d $ip-of-A -p tcp --dport 6500 -j DNAT --to-destination $ip-of-B:5900

(I referred to this)

But it doesn't work. And I'm reading the man pages of iptables and hope someone could help :)

1

I don’t have enough reputation to comment.

Assuming all Machines has single network adapter. B is NAT and C is Bridged. You can access B through A.

Can C is accessed through B?

Can C is accessed through A?

If C can be accessed through B, you will have to forward a port from A to B and forward that port from B to port 5900 of C.

Assuming 65535 port of A is forwarded to 65535 port of B, 65535 port of B will be forwarded to 5900 port of C for VNC access. Same can be done for SSH and other services.

1
  • Sorry for reply so late. I think this problem can be solved through pre-configuring the IP address of KVM virtual machine. And I'm searching for how. – can. Nov 26 '12 at 2:35

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.