VNC to a server behind a NAT router

Illtud Daniel illtud.daniel@llgc.org.uk
Tue Nov 19 16:20:01 2002


Rafael Rubio wrote:
> 
> As many others, my configuration is a small LAN connected to the Internet
> through an ADSL router that performs NAT, i.e. all the PC's have subnet IP
> addresses (10.0.0.X), which means they cannot be accessed as such from a
> remote VNC client through the Internet.
> 
> I know the public IP address of the router, but haven't found anything on how
> to build an IP address for individual PC's in the LAN (the ones running VNC
> servers) that can be addressed from a remote VNC client.

OK, this is an expanded answer to the one I gave somebody else
asking about VNC'ing to a server behind NAT. I assumed that
they had control of the NAT, I didn't realise that some ISPs
NAT'd people's connections.

So, I'm assuming that this is your setup (xDSL with home router):
(fixed font for this, folks)

                     ________
                    /        \
                    |  xDSL  | 
--------POTS--------| ROUTER |----ethernet------PC1 (10.0.0.1)
                    | a.b.c.d|  
                    |        |----ethernet------PC2 (10.0.0.2)
                    |        | 
                    |        |----ethernet------PC3 (10.0.0.3)
                    \________/

In this example, the router has an IP address a.b.c.d (static, I
assume - you say you know it). Since the router is the only one
with a 'proper' (ie, public - ie, addressable through the internet)
IP address, you can only connect your VNCviewer to ports on this
router. Your problem is that you want to connect your viewer to
port 5900 on PCs 1,2 & 3. So you need to forward 3 ports on the
router to port 5900 on PC1,2 & 3.

So, go into your router config, find 'port forwarding' (this may
be called something else - anyone seen a different term for this?)
and setup (for example)

forward router port 5901 -> 10.0.0.1:5900
forward router port 5902 -> 10.0.0.2:5900
forward router port 5903 -> 10.0.0.3:5900

....so you can now connect via the internet to your PCs using
vncviewer, and connecting to a.b.c.d:1 will give you PC1,
a.b.c.d:2 will give you PC2 etc.

Does that make sense? Post the model of your router and somebody
can probably give you the exact details of the port forwarding
config.

-- 
Illtud Daniel                                 illtud.daniel@llgc.org.uk
Uwch Ddadansoddwr Systemau                       Senior Systems Analyst
Llyfrgell Genedlaethol Cymru                  National Library of Wales
Yn siarad drosof fy hun, nid LlGC   -  Speaking personally, not for NLW