Pierre Labastie wrote:
Le 01/12/2014 11:37, Pierre Labastie a écrit :
Le 01/12/2014 04:11, Bruce Dubbs a écrit :
Let's say you are on machine A and want to run qemu (virtual system
C) on machine B. If you want to ssh into the qemu system, how do the
network packets get forwarded from A to C? The only way I could see
to do that is via a bridge on B that has both the ip addresses for B
and C.
Use port forwarding:
launch qemu (on machine B) with:
-net user,vlan=0,hostfwd=tcp::2222-10.0.2.9:22
(this needs the VM to be configured with a static IP, 10.0.2.9 in this
example)
then use ssh <user>@<B address or B name> -p 2222 (on machine A)
where <user> is username on C machine. You can change 2222 to any
value above 1024, which is not in use on your computer.
Just to be clear : if you change 2222 to something else, it has to be
done both in the "-net user" line and the "-p" option
I had not considered ssh port forwarding, but the bridge technique is
still valid. The way I do it is to add the IP for C to A's (and B's)
/etc/hosts file and then connecting is as easy as 'ssh C' from either
system.
Using port forwarding a user can always create an alias or script on A
and B to connect to C with a simple command. The port forwarding has
the advantage of not needing to be run as root (or setting capabilities
on /sbin/ip and /usr/sbin/brctl).
I think this amounts to a preference, however using port forwarding is
instructive (as is the bridge example).
Should we add port forwarding as an alternative to the qemu configuration?
-- Bruce
--
http://lists.linuxfromscratch.org/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page