Server in a NAT subet?



Hi,

I posted the following message in comp.protocols.tcp-ip earlier but
there was no reply... Since my implementation is in Linux, here it
goes:

I have a few NAT related questions. Here is my scenario; I have a
generic wireless ADSL modem/router, and I would like to open a TCP/IP
connection from outside the subnet to a node in the subnet.

My thinking is:

1. The router in its basic form of operation does simple IP
translation? Ie, 192.168.1.2 <-> A.B.C.D where A.B.C.D is the IP
address given by the ADSL provider.

Basically, the router is what it says on the tin, an IP router?

2. Connection establishment:

2.1. Client in the subnet, server somewhere on the internet:

The client in the subnet opens a TCP connection to the server,eg,
connect() call. The sockaddr returned by the server accept() function
has the IP address of the router and the port number which the client
opened? Basically the router replaced the IP header from subnet address
to its address.

Server sends data: The router has a table of open connections (stateful
NAT), and forwards the IP packet to the node which has opened the
connection.

2.2. Server in the subnet and client somewhere else with a global
routable address.

I have a problem at this point. I would like the server to publish its
address which gets stored in a database and at one point in time a
client reads the address and decides to call the server.

I can't publish node's IP address as this is not reachable from
outside, and I am not sure what happens if I publish the routers
address.

Question 1. Is it possible for a node in the subnet, to know that it is
in a subnet and its address isn't global. How would an application
check this? I mean what socket functions do I need?

Question 2. Let's assume the node knows it is in a subnet, how would
the node read the global address of the router?

Question 3. Let's assume the server published router's address and
the client connects(). Since, there is no open connection from within
the subnet, how does the router know where to route the packets?

Question 4. Is this where port forwarding comes in play? The router
sends all packets destined for a certain port number to the node which
is registered for port forwarding? But this requires administrative
changes in the router, what if the user moves to a subnet, gets IP with
dhcp and can't register for port forwarding?

Question 5. Is there such a broadcast packet (ARP message) in the
routers as "who is listening on port X?"? The server that publishes
the address is listen()'ing for connect() from clients.

Any general comments on how to write a server behind a NAT would be
helpful.


Regards,

UM

.



Relevant Pages

  • RE: SBS client updates over WAN remote sites
    ... User Wizard for the remote users on the SBS 2003 server, ... client applications such as Internet Explorer 6.0, Microsoft Office Outlook ... You can apply the following software on the subnet 10.0.2.0 using Group ...
    (microsoft.public.windows.server.sbs)
  • Re: IP-Adressen und Netzwerkfreigabe
    ... der andere mit einem Router. ... gestartet, keine Chance, ich komme nicht mehr auf den Server. ... Client und Server neu gestartet? ... Hardwaredefekt (Netzwerkkarte, Kabel, Port des Routers / Kabelmodems) ...
    (microsoft.public.de.german.windows.server.setup)
  • RE: VPN woes
    ... I was able connect to a VPN from the external side of the server of the ... the GRE packets were able to be received by the server from a client ... I can only assume that the router is the problem. ... I have spoken to Linksys and they say that the router should pass the GRE ...
    (microsoft.public.windows.server.sbs)
  • Re: Urgent! New router and big disaster
    ... just File and Printer Sharing and the Microsoft Client ... running the internet connection wizard, ... If neother SBS server nor client workstation had ... I wonder if I may have missed a firewall setting on the router as well. ...
    (microsoft.public.windows.server.sbs)
  • Re: 2 NIC SBS2003R2 LAN/WAN Firewall Router Connection Failure
    ... I have to admit to a preference for VMWare Server which can only be ... I've asked the other SBS MVP's to comment on the current status of SBS ... I connected directly to the router and changed its LAN side subnet ...
    (microsoft.public.windows.server.sbs)