Share your Qemu Guest with your Friends¶
Don’t know about the how useful it will be, but I found some way to enable my friends to access my Qemu Guest Instance running LFSLiveCD in Ubuntu Host using ssh. Here is the steps I did,
Download Qemu Packages
$ sudo apt-get install qemu kqemu-common kqemu-source
Download LFSLiveCD from here
Now start the LFSLiveCD guest using the following command
$ qemu -cdrom lfslivecd-x86-6.3-r2145-min.iso -boot d -m 512 -net nic -net user -redir tcp:35000::22
Now Qemu will start
LFSLiveCDwith user mode network stack, that is, from LFSLiveCD, ip 10.0.2.2 will be the Default gateway and DHCP server. ip 10.0.2.3 will be the DNS server and the LFSLiveCD will get 10.0.2 15. If you looknetstatoutput in Host(here Ubuntu), there will be a line which tells port35000is listening. Qemu process is listening in that port, it will redirect connections from Host(Ubuntu’s) 35000 port to Guest(LFSLiveCD’s) 22(ssh) port. All we need to do is, startsshservice in LFSLiveCD Guest. Type the following command in Qemu.
[root:]# cd /etc/rc.d/init.d
[root:]# ./sysklogd start
[root:]# ./sshd start
[root:]# passwd
New Password: [newrootpassword]
Retype New Password: [newrootpassword]
[root:]# tail -f /var/log/*.log
Now you have sshd running in the guest, and you also changed the root password to a known password. All you need to do is, ask your friends to ssh to your Host’s(Ubuntu) ip address but with 35000 port instead of default 22 port. And ask them to login as root as userid and [newrootpassword] as password. Your friends will be so much happy to see thay are became root. In the mean while you can also login to your guest with ssh root@127.0.0.1 -p 35000. If you want, add a new user and share that userid and password to your friends, so that they can have less power.
Instead of Ubuntu Host, We can do this in Windows XP, as a Normal powerless user. The below thing you need to do,
Download QemuManager Zipfile Edition from here
Download LFSLiveCD from here
Configure LFSLiveCD inside QemuManager(follow this Guide).
While configuring Network, DoubleClick
NetWork Card 1, GoTo Port Redirectors tab, type35000inPort Visible to Hostand22inPort Visible On Guestand clickAddbutton.Start
LFSLiveCDQemu Guest. and Do all changes I explained above to startsshdinside LFSLiveCD.Download Putty.exe from here
Start
Putty.exewith Host as127.0.0.1and Port as35000and Connection Type asssh.Login with
rootas username and[newrootpassword]as your password.If you want to share your Qemu Guest, with your windows friends who’s machines and your’s machine are in same subnet, then ask them to start
putty.exewith host as your machine’s ip address, port as35000, username asrootand password as[newrootpassword]. You can also create seperateuserin your Guest(LFSLiveCD) and share with your friends.Enjoy Virtualization.
I also tried this method in my friend’s Vista laptop, but it failed!! First, it is not allowing to run QemuManager.exe as a normal user, Second, it is giving warning while opening 35000 as listening port, Finally, putty.exe is not at all connecting to Guest Instance, even though sshd is running in the LFSLiveCD Guest. If anyone have success story, kindly share.
Finally Thanks to my company for blocking access to the linux learning server, which make me to go for alternate methods and finally endup in the Windows XP method.
