Get VNC port from VM?

DLZ-TVotR

Member
Sep 2, 2020
10
1
8
33
Just started using proxmox. I like to use vnc viewer to connect to vms but UI have not been able to find anything about getting a VNC port from a running VM.

I did find that you can go to the monitor tab and run "change vnc <IP:increment> where increment is some increment from 5900 and ip is the interface to listen on. Is this the only way?

I.E "change vnc 0.0.0.0:1" allows me to now connect on any interface, port 5901 with a vnc client like vnc viewer. Was there already a port listening I could see somewhere or is this the way to go?
 
Is it possible to use the latest release of novnc instead of the proxmox novnc version which requires end user access to port 8006?

If possible, which url have to be set in the iframe?

For example:

HTML:
<iframe src="/vnc/vnc.html?host={proxmox_domain}&port={vncwebsocket_port e.g. 5900}&autoconnect=1&encrypt=1" frameborder="0" scrolling="no" width="1024" height="600"></iframe>

results in this websocket error:

Code:
WebSocket connection to 'wss://{proxmox_domain}:5900/websockify' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED


vncproxy and vncwebsocket API calls work properly. While generating the websocket proxmox opens also port 5900 (netstat -tulpn) and the proxmox admin task log shows a successful console connection. PVEAuthCookie also set with the ticket from vncproxy API call.
 
Last edited:
Is it possible to use the latest release of novnc instead of the proxmox novnc version which requires end user access to port 8006?
I don't know. I have not tested it yet but the port you get from the API 1 and it is the same URL just the port is different.
 
It works, but not out of the box.

I have setup a new server with the websockify service, generating a vncproxy ticket from Proxmox API, setting up a custom target in the websockify service and it works like a charm :)

The main benefit is, that port 8006 could be still private. The VNC ports also just have to be available vor the websockify server and the vnc traffic could be routed over HTTPS (443).

Thanks!
 

Attachments

  • vnc-console.png
    vnc-console.png
    127.5 KB · Views: 133
Es funktioniert, aber nicht sofort einsatzbereit.

Ich habe einen neuen Server mit dem Websockify-Dienst eingerichtet, ein vncproxy-Ticket über die Proxmox-API generiert, ein benutzerdefiniertes Ziel im Websockify-Dienst eingerichtet und es funktioniert wie ein Zauber :) :)

Der Hauptvorteil ist, dass Port 8006 noch privat sein könnte. Die VNC-Ports müssen auch nur für den Websockify-Server verfügbar sein, und der VNC-Verkehr kann über HTTPS (443) geleitet werden.

Vielen Dank!
Könntest du hier ein Wiki machen? Danke
 
websockify
It works, but not out of the box.

I have setup a new server with the websockify service, generating a vncproxy ticket from Proxmox API, setting up a custom target in the websockify service and it works like a charm :)

The main benefit is, that port 8006 could be still private. The VNC ports also just have to be available vor the websockify server and the vnc traffic could be routed over HTTPS (443).

Thanks!
Hi @linushstge im struggling with same issue, would you mind to create wiki/tutorial for this? thanks.
 
Hi @linushstge im struggling with same issue, would you mind to create wiki/tutorial for this? thanks.
I have the same problem and have solved it: here is my conf

```
server {
listen 8443 ssl;
listen [::]:8443 ssl;
server_name pve.xxx.com;

ssl_certificate /etc/acme/xxx.com/fullchain.cer;
ssl_certificate_key /etc/acme/xxx.com/xxx.com.key;

ssl_session_timeout 10m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;

location / {
proxy_buffering off;
proxy_buffer_size 4k;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass_header authorization;

proxy_pass https://192.168.1.4:8006
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
```
 
@m2m be careful exposing the full proxmox webinterface with your reverse proxy configuration.

As already mentioned before, you can create a VNC tunnel by API using the /vncproxy endpoint.
With the return value of the API request you get:
- VNC Ticket
- VNC Port

With this information you can host a public accessibly websocket server like websockify to declare the possible VNC connections with the previous gathered data to the VNC Ports instead of the Webinterface Port.

E.G with the native text backend adapter:
Code:
# VNC-Ticket                              | Proxmox-IP   | VNC Port
dfd47639f9622822b216a40053ccffc600ae4421: 100.100.100.100:5900
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!