Server in a NAT subet?
- From: "UM" <uralmutlu@xxxxxxxxx>
- Date: 23 Nov 2006 09:58:53 -0800
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
.
- Follow-Ups:
- Re: Server in a NAT subet?
- From: Moe Trin
- Re: Server in a NAT subet?
- Prev by Date: Re: PPTPD connection tracking
- Next by Date: Re: How to set default gw not by route command in linux?
- Previous by thread: How to set default gw not by route command in linux?
- Next by thread: Re: Server in a NAT subet?
- Index(es):
Relevant Pages
|