Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

TCP/IP Port mapping

2005-07-26 by Mark Butcher

Hi All

Now this may seem a bit of a strange question at the lpc2000 group 
but I know that there are some bright sparks out there who may be 
able to help.

[Background: I have been a member of the group for quite a while and 
have been looking around for a good group for discussion of TCP/IP 
issues but have been shocked at the relative lack of anything of any 
use. The LPC2000 group was my first contact with the Yahoo groups 
and I have always used it as a reference of quality and standards.
Most groups with an interesting title have mostly only a small 
handful of members and posting of may be one a month if you are 
lucky. Others which seem to have an interesting level of activity 
are either full of head hunting advertisements from India or links 
to p.o.r.n. sites... it looks desperate. Therefore I decided to 
stick to where the quality is and hope for a tip in the right 
direction...]

First to the project - which I have already 'advertised' a couple of 
times, but I will do it again. It is indeed running on an LPC2106 
although uses a web server implemented on an HC12 (I'm just waiting 
for the Philips alternative with Ethernet integrated..). I have a 
board running a web server at http://212.254.22.36/ (or via link 
from my home page at www.mjbc.ch). It is now possible to write text 
to a display (visible at the web cam) using a Browser. In addition 
we have made a Windows software for designing virtual front panels 
which is also operational over the Internet (webcam demo can also be 
controlled using the software - anyone who wants to be a V1.0 (Beta) 
tester or has interest can load it from the embedded web server (via 
link of course) and install it and control the display (simply set 
up to above IP address and enter port 1923 in the set up menu).

One slight hitch - the software and documentation is presently in 
German so this may make it a little impractical for most - I will be 
translating it all when I get a few free hours...the operation is 
quite intuitive so you could always have a go - I can answer 
questions if there is real interest..

Now to the question for all IP specialists (which I though I was 
becoming until getting stumped today):
When I use UDP via a router to several external IP addresses and the 
same port address, the following behaviour occurs. The first request 
from an external source is translated by the router (gateway) to a 
UDP frame with the routers own internal IP address [typically 
192.168.0.1] with the same port number as sent by the external 
requestor. The device sends answers back to the router's IP address 
to the same port number and it is translated by the router to the 
external IP address, which is never actually visible internally.
When a second source sends a request, the router converts it to its 
IP address and defines a different port number for the internal 
frame. The device knows that it is not from the same source due to 
the different port number and answers to the router's IP address, 
where the internal port is translated to the external port (always 
same) and real external IP address (still not visible internally).
The same happens with further external sources - the external IP 
address is never visible but the device knows that there are several 
real sources due to the different port numbers - the router handles 
the mapping between internal/external ports and external IP 
addresses.

There are a couple of things which are a nuisance with this 
operation:
1. The external IP addresses are never known since the device always 
answers to the router's IP address. This makes it impossible to 
check whether the external IP address is a know address (for example)
2. It is necessary to track the port numbers to know which 
connection is which (rather than IP addresses) - not such a big deal 
though.

What I have just found is a further complication: I have a Windows 
2000 computer which is normally used as a server but I wanted to 
test the operation of a program on it. All seems to work fine until 
I realised that it would loose the connection every few minutes for 
about a minute and then recover before repeating the process a few 
minues later (and so on). Well I think I know what is happening - 
the server has 2 Ethernet connections (redundancy) and I believe it 
switches between the 2 because I could see that the port address was 
changing in sympathy with losing and re-finding the connection, 
which tells me that it was transmitting intermittently with 
different IP addresses. [I believe this is the case because I don't 
get the problem when I disconnect one of the two netwrok cables!!].

This however complicates things. If there is a server with redundant 
Ethernet it's IP address is not stable. This means that (due to the 
router port mapping) also the port number in the messages is not 
stable.

Does anyone understand the subject better than me and know of a 
really good solution to these annoying problems?

Many thanks in advance.

Regards

Mark Butcher

www.mjbc.ch

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.