Setting up VNC reverse connection and using VNC for Linux installation

Jephe Wu - http://linuxtechres.blogspot.com

Objective: Allow VNC server machine to connect to VNC viewer which is at listening mode when necessary. Also using VNC method to install Linux.
Environment: CentOS 5.5 32bit, Windows Vista 32bit with TightVNC.


Cases:
1.  Connect Windows to Windows
Install TightVNC first, one PC starts up TightVNC Viewer, then click on 'Listening Mode' button.
On another Windows desktop,  Startup TightVNC server in application mode or service mode, right click the icon at the right bottom of the screen, click 'Attach Listening Viewer', then type in Viewer IP address.
After that, VNC server Windows desktop will appear in the Listening viewer Windows machine.

2. Connect Linux VNC server to Windows VNC viewer at listening mode
Firstly, startup vncserver first on CentOS 5.5 remote console:

$ vncserver

It will automatically choose a display, starting from :1, if someone else has already started up vncserver from some other remote console, it will use :2.  Let's say it starts a vnc server at jephe.domain.com:1


$ vncconfig display=:1 -connect 192.168.100.20
or
$ export DISPLAY=:1; vncconfig -connect 192.168.100.20

note: 
a. before running above command, starting up TightVNC viewer at listening mode first on Windows vista machine, its IP address is 192.168.100.20.
b. Above command will push vnc display :1 to the client side at 192.168.100.20 port 5500 which is listening mode port


3. How to connect to remote Linux server which is pre-deployed somewhere and Linux server can access Internet directly but not other way round

Case description:  You need to physically deploy a pre-configured Linux server in the school, you are not able to directly ssh into that server anymore after deployment, the server itself is able to access Internet through school network (NAT). How do you check that server if someone in school reports to you there might be some problem with that server.

Solution: 
a. On your company data center server, start vncserver service at 1.2.3.4:1, you can remotely vnc connect to that server 1.2.3.4:1 by using TightVNC client. Now you get a X windows terminal on your Windows desktop
b. After that, run 'xhost +schoolpublicipaddress' from the xterm window to allow school IP to be able to push a xterm terminal to your data center vncserver console
c. Before server deployment, prepare a cronjob script to periodically (every 10 minutes) check your data center website URL at http://jephe.domain.com/vnccount
The vnccount file content is just one line which is your today's date such as:
20101010

If the file content is greater than before, of course, save the previous content first, then run xterm command like this:
xterm -display jephe.domain.com:1

Whenever you need to connect to school Linux server, increase the date count, wait for 10 minutes, a xterm window will appear, then you can control that school server.


4. Install Linux using VNC method:
Boot from Linux Installation DVD or CD, type in 'linux vnc vncpassword=jephe1' (note: password string must be at least 6 characters), after setting up a static IP address or letting it get it through DHCP, it will startup a VNC server for you to connect.

Moreover, you can use VNC reverse connection method to directly connect to your Windows VNC viewer which is running a listening mode. type in 'linux vnc vncconnect=10.0.0.4'. IP address 10.0.0.4 is your Windows TightVNC vncviewer PC.

5. References and FAQs
a. Linux vnc installation:

on the kernel line you need the following additional info :
vnc vncconnect=192.168.0.23 headless ip=dhcp ksdevice=eth0 method=http://mirror.centos.org/centos/4/os/i386/ lang=en_GB keymap=uk

b. How to connect to Linux/Unix server xwindows, gnome, kde etc with great performance
You can install freenx or NoMachine Linux server rpm and use NoMachine Windows client to connect to it.
For FreeNX, run 'yum install freenx' after installing DAG RHEL repository rpm.


c. vino-server for Gnome VNC
go to gnome desktop, System menu, perferences, Remote Desktop Preferences, tick 'Allow other users to view your desktop' and uncheck 'Ask you for confirmation' to enable VNC server for gnome itself. You might need to restart gnome to take effect, or use google search 'Enable and control the gnome VNC vino-server from the command line'.

d. vncviewer gnome full screen mode
You can exit from CentOS 5.5 gnome vncviewer full screen mode by pressing F8 key, then uncheck 'full screen'.