Specify VNC port for VMs


itimpi

Recommended Posts

At the moment the Edit option for a VM does not allow you to specify the port to be used VNC, but always sets it to 'auto'.   If you manually use the Edit XML option to set the port to a specific value then when you save the settings the GUI is quite happy to correctly display the port you have just set.    The problem is that if you now use the Edit option then it is reset back to the 'auto' setting.

 

What I would like to see is the VM Edit option bringing forward the current setting, and allow you to set it to either auto or to a specific port.

  • Like 3
  • Upvote 3
Link to comment

I really hope this feature gets implemented.  There are certain things (like VNC passwords) that you have to set using the 'Edit' option which in turn wipes out the static port defined using 'Edit XML'.

 

Furthermore, the 'Edit XML' option wipes out the VNC password you specify in the 'Edit' option so there is currently no way to have both a password and a manually specified VNC port.  :(

 

 

Link to comment
  • 1 year later...

This is still true, yes?

 

I'm having issues manually specifying the VNC port to use.

 

I followed these instructions https://www.reddit.com/r/unRAID/comments/44sftz/vnc_configuration/

This is my XML edit:

    <graphics type='vnc' port='5901' autoport='no' websocket='5901' listen='0.0.0.0' keymap='sv'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>

But always end up with the error "Execution error. internal error: Failed to reserve port 5901" when I try to start the VM.

Link to comment
  • 2 weeks later...
On 2/10/2019 at 7:58 PM, Nischi said:

This is still true, yes?

 

I'm having issues manually specifying the VNC port to use.

 

I followed these instructions https://www.reddit.com/r/unRAID/comments/44sftz/vnc_configuration/

This is my XML edit:

    <graphics type='vnc' port='5901' autoport='no' websocket='5901' listen='0.0.0.0' keymap='sv'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>

But always end up with the error "Execution error. internal error: Failed to reserve port 5901" when I try to start the VM.

I do not think you can set the 'port' and 'websocket' to the same value.    I always set the 'websocker' entry to a value in the 5700 range rather than the 5900 range and that seems to work fine.   Cannot remember where I got the idea that the 'websocket' should be in that range :(

Edited by itimpi
Link to comment
  • 1 month later...

Here is a temporary solution until limetech has implemented this feature:

10 minutes ago, JuliusZet said:

Hey everyone!

I have found an easy solution how you can both set a custom port and a password for VNC at the same time:

 

  1. Shut down the VM.
  2. Edit the VM and switch to XML View.
  3. Search for the <graphics type='vnc' ...> element.
  4. Set the autoport attribute to 'no' and change the attributes port and websocket to any unused ports.
    The line should now look something like this:
        <graphics type='vnc' port='5900' autoport='no' websocket='5700' listen='0.0.0.0' keymap='de'>
  5. Append the attribute named "passwd".
    The line should now look something like this:
        <graphics type='vnc' port='5900' autoport='no' websocket='5700' listen='0.0.0.0' keymap='de' passwd='Cd8B8fmCehbdaFLfCsfZyTL6'>
  6. Click the Update button at the bottom of the page to apply the changes.
  7. Start the VM.

You might notice, that the "passwd" attribute and value are no longer visible, after you clicked the Update button.

But looking at the XML file itself from the console reveals, that they are actually there.

(You can type "cat /etc/libvirt/qemu/your-vm-name.xml" into console to verify that.)

I assume, that the unRAID Web GUI hides the "passwd" attribute and value for security reasons.

 

This is however not an ideal solution, because every time you want to change a setting you would have to do this again.

@limetech, it would be great, if you could add an option to change the VNC port of a VM from within the Form View. This would fix the issue.

 

  • Like 2
  • Thanks 2
Link to comment
  • 1 year later...
  • 6 months later...

How is this still not a thing?

 

It's icky enough that editing the xml completely messes up the second you edit the config using the GUI again, would be awesome to fix this at the core, but at the very least having a manual field for this would be incredible.

 

As it is, saving connections in your VNC viewer of choice means you have to start VMs in a particular order or constantly go back and check. :(

  • Like 2
Link to comment
  • 4 months later...
  • 1 month later...
  • 2 months later...
  • 2 months later...
31 minutes ago, JohnG75 said:

Ran into the need for this feature.

Handful of VMs running and the VNC Client saves the links with the port number. Reboot Unraid after patching and each of them shuffled to different VNC ports.

I agree this is needed, but I suggest not relying on the host VNC for daily use, rather set up something like nomachine in the client, and relegate the host VNC to situations where you must have baremetal type management.

Link to comment
23 minutes ago, JonathanM said:

I agree this is needed, but I suggest not relying on the host VNC for daily use, rather set up something like nomachine in the client, and relegate the host VNC to situations where you must have baremetal type management.

I agree - noMachine gives far better performance (and more capabilities) than using VNC.   I only use the initial VNC support to allow me to install noMachine server within the VM (works for both Linux and Windows VMs).

Link to comment

Both good suggestions, but most of my time is in environments with a lot of ports blocked so I don't have the option of using a normal VNC client or Remote Desktop. So being able to set the port via unraid and not having that setting changed if I reconfigure, update or reboot would help. Right now, it just means I can't tag a bookmark and go to the machine I want and instead go to the VM page, wait for it to load and pick the machine. Not a deal breaker, but a frustration.

Link to comment
51 minutes ago, JohnG75 said:

Both good suggestions, but most of my time is in environments with a lot of ports blocked so I don't have the option of using a normal VNC client or Remote Desktop. So being able to set the port via unraid and not having that setting changed if I reconfigure, update or reboot would help. Right now, it just means I can't tag a bookmark and go to the machine I want and instead go to the VM page, wait for it to load and pick the machine. Not a deal breaker, but a frustration.

OK,

 

You CAN set the port explicitly if you edit in XML mode, but the problem with that is that if you switch back to form mode for any reason the setting gets lost and reset to default of ‘next port available’.   

Link to comment
  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.