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'>
</domain>

Change interface type to user

<interface type='network'>
</interface>

to this:

<interface type='user'>
</interface>

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>

Добавить комментарий