Port Forwarding

Port Forwarding is a feature present on many modern routers. In essence, it allows you to map a certain outside port of the router to a specific address and port in the LAN.

This means, for example, that every packet sent to port 9732 on the router from the WAN side is forwarded by the router to 192.168.0.44:1001 on the network:

an009_port_fwd1

As you can see, this is a static configuration. This is configured on the router itself -- it is not related to any Tibbo equipment. The diagram above shows the setup itself -- no connection is in progress, but the router knows what to do when it gets data to port 9732.

After properly configuring port forwarding on the router, every time a connection is established to a specific port on the "real" IP address of the router, the data is forwarded to a specific host and port on the LAN. Hence:

an009_port_fwd2

This shows the same set-up as above, but with a connection in progress. As you can see, the remote host can actually initiate a connection to the Device Server inside the network, because the router knows what to do with the data. Contrast the above diagram with the diagram on How NAT Applies To Device Servers .

Notes on Setting Up Port Forwarding

In order for port forwarding to work, several conditions must be true:

Internally, in the LAN, the DS must use a static IP address. The router knows it should forward the packets to 192.168.0.44 -- so if the DS suddenly becomes 192.168.0.53, it doesn't get the packets. So its address must be static.
The external ("real") IP address of the router must also be static. Otherwise, the Remote Host (212.68.157.9 in the diagram above) will not know where to connect.
The router must be properly configured for port forwarding, using its internal configuration interface. The way to do this varies from router to router, and is documented in the manual for your specific router.
The internal port and the external port aren't necessarily the same -- just because you set the router to forward incoming connections from port 1001, doesn't mean it would forward them inside the network to port 1001. You have to set this correctly.
Remember -- establishing the connection isn't the same as using the connection. This is covered in detail under Important Note above.
The DS must accept incoming connections. That means the Routing Mode (RM) setting must be set to "Server" or "Server/Client".

note_further-wt

In some cases (depending on the application), it may be possible to obviate the requirement for a static IP on the external side of the router by using Dynamic DNS. This, however, is beyond the scope of this application note. To learn more, read the Wikipedia article titled Dynamic DNS.