Novnc is a HTML5 VNC client that uses HTML5 Websockets, canvas, and JavaScript implementations, and NOVNC is commonly used in cloud computing, virtual machine control panels such as OpenStack Dashboard and Opennebula Sunstone all use the NoVNC. Said earlier NoVNC use WebSockets implementation, but most of the current VNC server does not support WebSockets, so NoVNC is not directly connected to the VNC server, how to do? This requires an agent to implement the conversion between WebSockets and TCP sockets, which is websockify.
Using NOVNC to remotely access multiple remote hosts, the topology is as follows.
Only one machine is required as the NOVNC agent, and the other machines being accessed will be able to install VNC server.
Vncserver Installation and use
Host Target2
The Target2 host is the CentOS operating system and can use Tigervnc-server as the VNC server.
Installation:
[email protected] desktop]# Yum install tigervnc-server-y
When you are finished installing, review the Vncserver configuration file:
[Email protected] desktop]# RPM-QC tigervnc-server/etc/sysconfig/vncservers
In this configuration file, you can modify the configuration of vncserver, such as the sessionnumber of Remote Desktop, user name at login, screen resolution and so on.
Start Sncserver:
Vncserver or Vncserver:n
here n is sessionnumber, the default is 1, the first start will prompt for the password, you can also use the VNCPASSWD command to change the password. the default port number for VNC is 5900, while the Remote Desktop Connection port number is 5900+n. If you start VNC Server with the "vncserver:1" command, the port should be 5901.
To view connections:
[[email protected] desktop]# VNCSERVER-LISTTIGERVNC server sessions:x DISPLAY # PROCESS id:2 2,968:1
I have established two VNC connections here, with port numbers 5902 and 5901, respectively.
If you want to delete a connection, use:
Vncserver-kill:n
Host Target1
The TARGET1 host is a Windows Server R2 operating system that can use Tigervnc-server as a VNC server.
can be installed directly.
After the installation is complete, configure, set the connection VNC server password, etc.:
Connect to VNC server using Novnc
Novnc principle
NOVNC provides a HTML5 canvas on a Web page that accesses the VNC service provided by the Vncserver on the machine and requires a conversion of TCP to WebSocket to be displayed in the HTML5. Web page is a client, similar to win under the Vncviewer, but this time is not to fill the bare vnc service Ip+port, but by the NOVNC provided by the WebSockets agent, on the NOVNC proxy server to configure each VNC service, NOVNC provides an identity to the VNC service configured by the reverse proxy.
NOVNC Installation and use
Installing NOVNC
Install Novnc on Node1, if Node1 does not have git installed, install git first
[email protected] desktop]# Yum install git-y
Installing NOVNC
[[email protected] ~]# git clone git://github.com/kanaka/novnc
Use token
Why use tokens?
We want to access all the machines in the LAN through NOVNC, do you want to install the configuration novnc for each machine, and then use the IP address of each machine to access it? It is clear that this is a cumbersome and clumsy practice. In fact, we only need one machine as the NOVNC agent, and the other machines that are being accessed will be able to install VNC server.
In, we use a machine as an agent, ip:10.70.117.190, the other two machines target1:10.70.117.181 and target2:10.70.117.183 above install vncserver, how do we go through the agent to visit Target1 and Target2? This will require token to be a skill.
We need to create a token configuration file on the agent machine, the contents of the/root/novnc/token/token.conf file are:
target1:10.70.117.181:5900target2:10.70.117.183:5902
The host IP of the TARGET1 is the 10.70.117.181,VNC connection port is the 5900,target2 host IP is the 10.70.117.183,VNC connection port is 5902.
Then enter the command on the agent machine Node1:
[Email protected] novnc]#/utils/websockify/websockify.py--web./--target-config=./token/token.conf 6080
Now that everything is ready, you can use your browser to implement Remote Desktop.
Note: Remember to turn off the firewall or set the firewall port exceptions.
Remote Desktop to Target1
In the browser input Http://10.70.117.190:6080/vnc.html?path=websockify/?token=target1
Click on the link to enter the vncserver password
Successful Remote Desktop to Target1
Remote Desktop to Target2
In the browser input Http://10.70.117.190:6080/vnc.html?path=websockify/?token=target2
Click on the link to enter the vncserver password
Novnc Connecting multiple remote hosts