Redirect port to guest in libvirt

If you want to redirect ports from WAN to quest Virtual Machine than you may do this:
Go to edit VM from Virsh

virsh edit my-vm-name

In header add xmlns

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>

Change interface type to user

<interface type='network'>

to this:

<interface type='user'>

Add qemu redirection

<qemu:commandline>
   <qemu:arg value='-redir'/>
   <qemu:arg value='tcp:5564::3389'/>
</qemu:commandline>

If you want redirect more port:

<qemu:commandline>
   <qemu:arg value='-redir'/>
   <qemu:arg value='tcp:12345::21'/>
   <qemu:arg value='-redir'/>
   <qemu:arg value='tcp:1111::22'/>
</qemu:commandline>
  1. No comments yet.

  1. No trackbacks yet.

You must be logged in to post a comment.