Re: Server in a NAT subet?



On 23 Nov 2006, in the Usenet newsgroup comp.os.linux.networking, in article
<1164304733.481493.48830@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>, UM wrote:

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:

Yes, but you have to allow time. Your comp.protocols.tcp-ip posting
was at '23 Nov 2006 07:28:59 -0800', while this post is just two and a
half hours later at '23 Nov 2006 09:58:53 -0800'.

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?

Well, that does depend on a few circumstances you haven't mentioned, but
is basically correct.

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.

Basically correct. The router might also replace the source port number
as well, but the concept is still the same.

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.

No, because

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.

Ignoring any 'Acceptable Use Policy' or 'Terms of Use' that your ISP may
have, If you have forwarded the port from the router's world address (let's
say '88.107.131.106' that you posted from, and port 80) to the internal
address/port of the real server, then it's essentially the same as above.
The router does of IP re-writing, and the connection goes through.

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?

Yes

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?

Then you've discovered another one of the disadvantages of DHCP.

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.

Not in IP - you're perhaps thinking of something like Portmapper which is
more an NIS function.

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

It's no different that writing one in a non-NAT situation. Where you may
be running into problems is DHCP.

Old guy
.



Relevant Pages

  • Re: Still cant connect to RWW or OWA remotely
    ... No Phantom NICs as far as I can see. ... that it can not find the server. ... Configure your Router as an Eithernet Bridge. ... Once you have this then configure the Routers Firewall and Port ...
    (microsoft.public.windows.server.sbs)
  • Re: Still cant connect to RWW or OWA remotely
    ... No Phantom NICs as far as I can see. ... that it can not find the server. ... Configure your Router as an Eithernet Bridge. ... Once you have this then configure the Routers Firewall and Port ...
    (microsoft.public.windows.server.sbs)
  • Re: changed IP address: cant receive email & need to make domain name match IP address
    ... Port Forwarding for 2Wire 1701HG ... SBS CDs, but it's always a good idea to keep them handy. ... As you are set up now, your SBS server is "bare to the Internet" (not ... need to buy at least another inexpensive router to put between the SBS ...
    (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)