Remote Control for Everybody: VNC Crosses Networks and Platforms

Editor’s Note: After we first posted this story, VNC found a new home and sponsor: be sure to take a look at RealVNC for details.

VNC (Virtual Network Computing) is a gift from AT&T Laboratories Cambridge for users who want free, low-bandwidth, cross-platform remote control of their systems. VNC runs on all Unix variants, Windows, and Mac.

But wait, you say, what about the X protocol itself? X is nice, it has been called a network protocol that draws pictures. However it is bandwidth-hungry, and works best on Unix machines. It’s less helpful for getting to the majority of the applications running on your Windows or Mac machines.

What about SSH? SSH (secure shell) is wonderful, in my opinion the best choice for secure remote access. (technically, it’s not a shell, but a protocol). There are commercial and free versions, and versions for all platforms. It’s more complex to set up and use than VNC, and has more capabilities, though VNC can do one thing that SSH cannot. We’ll get to that presently.

Lean and Mean
VNC is the thinnest of clients. No applications are served to the client machine. The VNC client is a viewer to the server machine. The VNC client sends keyboard and mouse input via TCP/IP to the VNC server, which sends display output back. No data are stored on the viewer, it is a stateless connection. The connection can be broken and restored at any time with no data loss. The user can even go hog-wild and log in from a whole lot of different machines during the same session, displaying the same desktop, and it still won’t mess up data. Or do something useful, like collaborate with other users.

A common use for VNC is using a single keyboard, mouse, and monitor for two or more systems, or if you want to sound technical, running headless boxes. Over ethernet it is fast, there is little or no lag to mouse movements or keystrokes. It will also connect over the Internet- anywhere you have TCP/IP it works. On a dialup connection some lag is often apparent. This can be minimized by running a lean window manager on the VNC client. It has its own X server, so you can run any window manager or desktop environment you like. The default is twm, which is quite minimalist. There are all kinds of X Window managers to choose from that are bandwidth-efficient and feature-rich, like Blackbox, Sawfish, XFce, and IceWM.

Quick Start
VNC has two basic components: vncserver and vncviewer. Windows and Mac installations are easy, download and double-click the packages. Linux installation is a little different from the usual. The binaries are already compiled, simply unpack the tarball, and copy the files into the correct directories as specified in the README. vncserver is a Perl script that controls Xvnc, which is the actual server. The script can be edited if you don’t care for the default directories, and want to move things around. It is better to run it from the script, rather than invoking Xvnc directly. The script specifies display and environment variables.

After server and client are installed, you’re ready to rumble. On Linux, run vncserver from the command line by typing vncserver. It will ask you to create a password. Use vncpasswd to change it when you need to. Connect from a client machine by running the command vncviewer [servername or IP]. Windows and Macs of course have icons to click on, and make nice little boxes to enter the server name in. *nix vncserver can be started remotely, via telnet or ssh. I know you know this, but I must say it: never use telnet over an untrusted network, it sends passwords in cleartext.

And that’s the quick n dirty method to get up and running. Linux can simultaneously run a number of different X sessions. The command vncserver, with no options, runs in the first available display. Specify a display with its number, for example: vncserver :2. The client connects with vncviewer servername:2.

All the viewers have Java, so connecting via a Java-enabled browser is another option: http://servername:portnumber

WinVNC, the Windows VNC server, can run as a service. This is probably the best way to run it, as there is no way to start it remotely. This requires some registry hacks, which are detailed on the VNC web site. Windows and Macs offer only single desktops, poor things, so there is no need to worry about numbering desktops. The viewers are very small, about 150k, and can be run from a floppy- nice for the very mobile user.

Mass Ports
VNC is based on the concept of a remote framebuffer (RFB), which makes it portable to small devices. Sometimes the VNC protocol is referred to as the RFB protocol. This means it is possible to port the VNC system to almost anything. It has been ported to Palm devices, HP Jornada, Windows CE, Newton, and some cell phones.

And Now, The Magic
Okay, with VNC you sit at a single terminal and control a remote machine. Good so far. How would you like to have two different systems running side-by-side, controlled by a single keyboard and mouse? Yes, this can be done most easily with x2vnc, by Fredrik Hubinette. Take your Windows PC and Linux PC and position the monitors side-by-side. All work and no play is very dull- take a break from coding on the Linux box to frag some gibs on the Windows box. Simply slide the mouse cursor over- presto! It appears on the Windows monitor, transferring keyboard control at the same time. Done fragging? Slide back.

Two Windows machines need Win2VNC. Use x2x for two *nix boxes. Whatever your setup, the VNC server for each machine is required. Unlike VNC, x2vnc exchanges keyboard and mouse commands only between two machines, maintaining the local displays. This is such a slick program, it’s fast and fun.

The secret is a one-pixel wide window at the edge of the screens. When the pointer hits this window, it transfers control to the adjacent system. It is based on VNC- see what happens when code is freely shared? All kinds of cool hacks magically appear.

x2vnc 1.4
Tridia VNC, a commercially supported VNC release
TightVNC, an enhanced secure version with speed enhancements


See All Articles by Columnist
Carla Shroder

Latest Articles

Follow Us On Social Media

Explore More