Moving VNC Server ports to a number less than the default 5800

Calculating VNC Server and VNC Viewer Ports

To start a vnc server session you normally issue a command such as


vncserver :<number>


Where number is the X server display you want it to be


vncserver :1


To connect to the vncserver above using the linux vncviewer application this equates to a vncviewer host:port setting of

vncviewer localhost:5901

or when using the host:x_display_number syntax

vncviewer localhost:1

or if using the java web applet a URL of:

http://localhost:5801/


X Display

VNC HTTP Port

-httpport

VNC Port

-rfbport

Linux

X11 protocol

0

5800

5900

6000

1

5801

5901

6001

2

5802

5902

6002

65534

5798

5898

5998

65535

5799

5899

5999



However when you want to move the vnc tcp server port so that perhaps you can attach from behind a firewall you may need to specify a port number under 5800/5900


vncserver :<number> = 65536 - 5900 + "rfbport" <-- the port you want to use to connect using vnc i.e 80, 21, 1494 etc


vncserver :<number> = 65536 - 5900 + 1494


vncserver :<number> = 61130


command vncviewer "<host>:<port>"


vncviewer port = 65536 + "< real TCP port>"


vncviewer port = 65536 + 1494


vncviewer port = 67030




X Display

VNC HTTP Port

-httpport

VNC Port

-rfbport

Linux

X11 protocol

0

5800

21

6000

1

5801

5901

6001

2

5802

5902

6002

65534

5798

5898

5998

65535

5799

5899

5999