How do you reset the range of available ports that libvirt autoport can use?

Posted by bcmcfc on Server Fault See other posts from Server Fault or by bcmcfc
Published on 2014-06-02T15:26:08Z Indexed on 2014/06/02 15:30 UTC
Read the original article Hit count: 205

Filed under:

Libvirt is using its autoport setting to automatically allocate ports within a range starting at 5900.

Example excerpt from an XML configuration for a VM:

<graphics type='spice' port='6000' autoport='yes' listen='127.0.0.1' keymap='en-gb'>
    <listen type='address' address='127.0.0.1'/>
</graphics>

Currently, there are free ports at various points within the range 5900 to 5999.

However, newly booted VMs are picking up ports from 6000 on. I need for it to reuse the available ports in the 59xx range.

Is this possible? If so, how do I do this?

The problem arose because VMs are being accessed via websockets, and it tried to use 6000 which is a reserved port for X11. A solution that explains how to blacklist ports from being picked up by autport would also be sufficient.

© Server Fault or respective owner

Related posts about libvirt