[libvirt-users] Port forwarding for KVM

陳韋任 (Wei-Ren Chen) chenwj at iis.sinica.edu.tw
Fri Apr 12 11:06:45 UTC 2013


Hi all,

  Let me illustrate what I want to do. I want to launch a QEMU
"inside" a KVM virtual machine, then get that QEMU's vnc output.
I am using libvirt 0.9.13 (`libvirtd --version`), and attach is
my vm's original config xml. Is there a simple way to achieve my goal?
I was told that iptable solution I found on the web is for "tap"
interface, and I can use "hostfwd" QEMU option if I use "user"
interface. For the latter approach, I basically follow this one [1]
with the QEMU cmdline option below:

  <qemu:commandline>
    <qemu:arg value='-net user,hostfwd=::5902-:5901'/>
  </qemu:commandline>

But virsh always keep saying:

  error: internal error Process exited while reading console log output:
  kvm: -net user,hostfwd=::5902-:5901: invalid option   

What I am missing here? I also found there was a patch for user mode
port forwarding [2]. Does that mean I can write libvirt xml directly
to do port forwarding? If so, could someone give me hint on how to
write one? The last question is, do I have to change the interface
type from "network" to "user" so that I can do port forwarding?

  Thanks in advance! :)

[1] http://snippets.webaware.com.au/snippets/running-qemu-with-port-redirection-through-libvirt/
[2] http://www.redhat.com/archives/libvir-list/2012-May/msg00538.html

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ubuntu.xml
Type: application/xml
Size: 2174 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20130412/9d09cb78/attachment.wsdl>


More information about the libvirt-users mailing list