[GH-ISSUE #535] Access VNC Console through Wan #400

Closed
opened 2026-02-27 16:39:09 +03:00 by kerem · 15 comments
Owner

Originally created by @ghost on GitHub (Mar 29, 2015).
Original GitHub issue: https://github.com/retspen/webvirtmgr/issues/535

Hi there!

I have setup my test lab with it:

  • Kvm Server with IP 192.168.0.55/24
  • Web Server with External IP
  • OpenVPN between Web Server and Kvm Server. The tunnel IP is 192.168.25.0/24

I can connect to the KVM Server through Web Server using the IP tunnel with OpenVPN (192.168.25.2). I can create, destroy, etc, but I can't connect to the VM console. Maybe why the connections to console use the 127.0.0.1. Is possible to solve this ?

Thanks.

Originally created by @ghost on GitHub (Mar 29, 2015). Original GitHub issue: https://github.com/retspen/webvirtmgr/issues/535 Hi there! I have setup my test lab with it: - Kvm Server with IP 192.168.0.55/24 - Web Server with External IP - OpenVPN between Web Server and Kvm Server. The tunnel IP is 192.168.25.0/24 I can connect to the KVM Server through Web Server using the IP tunnel with OpenVPN (192.168.25.2). I can create, destroy, etc, but I can't connect to the VM console. Maybe why the connections to console use the 127.0.0.1. Is possible to solve this ? Thanks.
kerem closed this issue 2026-02-27 16:39:09 +03:00
Author
Owner

@brenard commented on GitHub (Mar 29, 2015):

Hello,

You have to use last version with SSH tunneling to access VM console. Your KVM host have to be configure using SSH connexion. It's require if you want to use SSH tunneling. Another solution is to configure your VM console to listen on 0.0.0.0 or the IP address of your KVM host in your OpenVPN tunnel.

<!-- gh-comment-id:87486810 --> @brenard commented on GitHub (Mar 29, 2015): Hello, You have to use last version with SSH tunneling to access VM console. Your KVM host have to be configure using SSH connexion. It's require if you want to use SSH tunneling. Another solution is to configure your VM console to listen on 0.0.0.0 or the IP address of your KVM host in your OpenVPN tunnel.
Author
Owner

@ghost commented on GitHub (Mar 29, 2015):

Hello brenard,

I will try with SSH first. In cause of failure, how can I change the VM console to listen on 0.0.0.0 ??

Thanks.

<!-- gh-comment-id:87487194 --> @ghost commented on GitHub (Mar 29, 2015): Hello brenard, I will try with SSH first. In cause of failure, how can I change the VM console to listen on 0.0.0.0 ?? Thanks.
Author
Owner

@brenard commented on GitHub (Mar 29, 2015):

Use XML configuration editor of your VMs and in graphics XML balise you have to add listen attribute to specify the listen address. Refer on libvirt documentation for more details.

<!-- gh-comment-id:87487601 --> @brenard commented on GitHub (Mar 29, 2015): Use XML configuration editor of your VMs and in graphics XML balise you have to add listen attribute to specify the listen address. Refer on libvirt documentation for more details.
Author
Owner

@ghost commented on GitHub (Mar 29, 2015):

I did this config, but the console show time out. I changed directly to xml file.

<!-- gh-comment-id:87488125 --> @ghost commented on GitHub (Mar 29, 2015): I did this config, but the console show time out. I changed directly to xml file.
Author
Owner

@ghost commented on GitHub (Mar 29, 2015):

I can see the nginx logs that the connection is go to correct IP but try at port 8000. But this port is listen to 127.0.0.1. How can I change this?

<!-- gh-comment-id:87491997 --> @ghost commented on GitHub (Mar 29, 2015): I can see the nginx logs that the connection is go to correct IP but try at port 8000. But this port is listen to 127.0.0.1. How can I change this?
Author
Owner

@brenard commented on GitHub (Mar 29, 2015):

In your local_settings.py file, you have to put this variables :

WS_PORT = 6080
WS_HOST = '0.0.0.0'
WS_PUBLIC_HOST = ip address or fqdn of your webvirtmgr host

You have to use the latest version of webvirtmgr, I' m not sure that old versions have all this variables.

<!-- gh-comment-id:87493201 --> @brenard commented on GitHub (Mar 29, 2015): In your local_settings.py file, you have to put this variables : WS_PORT = 6080 WS_HOST = '0.0.0.0' WS_PUBLIC_HOST = ip address or fqdn of your webvirtmgr host You have to use the latest version of webvirtmgr, I' m not sure that old versions have all this variables.
Author
Owner

@ghost commented on GitHub (Mar 29, 2015):

I give up!!! :)

Doesn't work!!! :(

<!-- gh-comment-id:87496351 --> @ghost commented on GitHub (Mar 29, 2015): I give up!!! :) Doesn't work!!! :(
Author
Owner

@ghost commented on GitHub (Mar 29, 2015):

WebSocket server settings:

  • Listen on 192.168.0.55:6080
  • Flash security policy server
  • SSL/TLS support
    Traceback (most recent call last):
    File "/var/www/webvirtmgr/console/webvirtmgr-console", line 218, in
    server.start_server()
    File "/usr/lib/python2.7/dist-packages/websockify/websocket.py", line 751, in start_server
    lsock = self.socket(self.listen_host, self.listen_port, False, self.prefer_ipv6)
    File "/usr/lib/python2.7/dist-packages/websockify/websocket.py", line 193, in socket
    sock.bind(addrs[0][4])
    File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
    socket.error: [Errno 99] Cannot assign requested address
<!-- gh-comment-id:87498577 --> @ghost commented on GitHub (Mar 29, 2015): WebSocket server settings: - Listen on 192.168.0.55:6080 - Flash security policy server - SSL/TLS support Traceback (most recent call last): File "/var/www/webvirtmgr/console/webvirtmgr-console", line 218, in <module> server.start_server() File "/usr/lib/python2.7/dist-packages/websockify/websocket.py", line 751, in start_server lsock = self.socket(self.listen_host, self.listen_port, False, self.prefer_ipv6) File "/usr/lib/python2.7/dist-packages/websockify/websocket.py", line 193, in socket sock.bind(addrs[0][4]) File "/usr/lib/python2.7/socket.py", line 224, in meth return getattr(self._sock,name)(*args) socket.error: [Errno 99] Cannot assign requested address
Author
Owner

@brenard commented on GitHub (Mar 30, 2015):

This IP address is your KVM host IP address, right ? This process is normaly running on your web server host on the public IP address. Your web browser have to be able to connect on this port (websocket connection).

<!-- gh-comment-id:87499363 --> @brenard commented on GitHub (Mar 30, 2015): This IP address is your KVM host IP address, right ? This process is normaly running on your web server host on the public IP address. Your web browser have to be able to connect on this port (websocket connection).
Author
Owner

@ghost commented on GitHub (Mar 30, 2015):

Correct, this IP is my KVM server. I'm using Google Chrome! Insinde my LAN is OK, but outside no.
Is there any files that need to be changed too?

<!-- gh-comment-id:87499796 --> @ghost commented on GitHub (Mar 30, 2015): Correct, this IP is my KVM server. I'm using Google Chrome! Insinde my LAN is OK, but outside no. Is there any files that need to be changed too?
Author
Owner

@brenard commented on GitHub (Mar 30, 2015):

This service must running on a public IP address to be accessible outside of your LAN. You have to move this service on a host that is both connect on public and private network (or make NAT). This service is use to connect your web browser and your VM console throught a websocket so firewalling have to be opened for that.

<!-- gh-comment-id:87500881 --> @brenard commented on GitHub (Mar 30, 2015): This service must running on a public IP address to be accessible outside of your LAN. You have to move this service on a host that is both connect on public and private network (or make NAT). This service is use to connect your web browser and your VM console throught a websocket so firewalling have to be opened for that.
Author
Owner

@ghost commented on GitHub (Mar 30, 2015):

Ah Ok, so this case is the same to vpn, right? If doens't has a NAT, doens't work!

<!-- gh-comment-id:87501248 --> @ghost commented on GitHub (Mar 30, 2015): Ah Ok, so this case is the same to vpn, right? If doens't has a NAT, doens't work!
Author
Owner

@ghost commented on GitHub (Mar 30, 2015):

I have setup the NAT at my router (NAT 5900 and 6080) and now I got the other error.
Failed to connect to server (code: 1006)

<!-- gh-comment-id:87503172 --> @ghost commented on GitHub (Mar 30, 2015): I have setup the NAT at my router (NAT 5900 and 6080) and now I got the other error. Failed to connect to server (code: 1006)
Author
Owner

@brenard commented on GitHub (Mar 30, 2015):

Consider this service as another webserver (as Nginx) that permit to access console. So as your HTTP webserver, this service as to be running on your webvirtmgr host and being accessible directly from your web client.

This error is really common. To understand your problem, check the javascript console of your web browser and the log of webvirtmgr-console script.

<!-- gh-comment-id:87505128 --> @brenard commented on GitHub (Mar 30, 2015): Consider this service as another webserver (as Nginx) that permit to access console. So as your HTTP webserver, this service as to be running on your webvirtmgr host and being accessible directly from your web client. This error is really common. To understand your problem, check the javascript console of your web browser and the log of webvirtmgr-console script.
Author
Owner

@ghost commented on GitHub (Mar 30, 2015):

I did other setup. I'm using the KVM Server and Webvirt WebServer in the same LAN.
Now, I can reach the console. I set up the NAT on the ports 5900, 6080 to my KVM Server.
When I access from my Webserver and try to access the console, the console is show with sucess!

The only config changed was the settings.py at WS_HOST = '192.168.0.55'

I need protect to VNC access now.

One more question, can I add two or more KVM server at the webvirtmgr?

Thank you @brenard

<!-- gh-comment-id:87506324 --> @ghost commented on GitHub (Mar 30, 2015): I did other setup. I'm using the KVM Server and Webvirt WebServer in the same LAN. Now, I can reach the console. I set up the NAT on the ports 5900, 6080 to my KVM Server. When I access from my Webserver and try to access the console, the console is show with sucess! The only config changed was the settings.py at WS_HOST = '192.168.0.55' I need protect to VNC access now. One more question, can I add two or more KVM server at the webvirtmgr? Thank you @brenard
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/webvirtmgr#400
No description provided.