(Answer) (Category) VNC FAQ-o-Matic : (Category) VNC and Firewalls :
How should I setup my firewall to work with VNC?
If you've administrative control over your firewall/router that 
protects your collection of VNC servers, setting up the firewall 
so that any or all of your VNC servers are accessible from the 
outside is fairly straightforward.

Suppose, for example, you have 5 PC's, all of which are running VNC 
servers, and you want to be able to access them from the "outside".
You'll need to make 5 "port forwarding" entries:

1. External TCP port 5900 to your first PC's port 5900
2. External TCP port 5901 to your second PC's port 5900
3. External TCP port 5902 to your third PC's port 5900
4. External TCP port 5903 to your fourth PC's port 5900
5. External TCP port 5904 to your fifth PC's port 5900

Then if you point a VNC viewer to your external IP address, "Display 0" 
will reach your first PC, "Display 1" will reach your second, etc.
Keep in mind the relationship: "Display N" = "TCP port 5900+N".

If you wish to connect with the web-browser client, you'll need to
make three additional adjustments. First, apply similar port-forwarding
rules for TCP ports 5800-5804 (ie, 5800 to your first PC, 5801 to
your second PC, etc). Secondly, change the "destination" TCP port
on all of the entries to be the same as the "arrival" TCP port (so
instead of 5902 to 5900, make it 5902 to 5902). Lastly, change each
of your VNC Servers to listen to the correct "Display Number" (eg,
for the PC being forwarded 5902, have it listen to "Display 2").
If this is not setup correctly, you'll get a "java.net:NoRouteTohost" 
error when you try to connect.

        One user's experience in getting this all to work is described
here: (Xref) How to get VNC to work behind a router
[Append to This Answer]
Previous: (Answer) What UDP ports does VNC use?
Next: (Answer) How do I configure my WinXP firewall to work with VNC?
This document is: http://faq.gotomyvnc.com/cgi-bin/fom?file=64
[Search] [Appearance]
This is a Faq-O-Matic 2.721.
This FAQ administered by sbest@best.com