Sign in with
Sign up | Sign in
Your question

Internet Service Sharing behind a DSL Router?

Last response: in Networking
Share
Anonymous
October 1, 2001 9:57:15 PM

Hi Everyone,

Quick question for any network protocol gurus who don't mind coaching a newb. I'm struggling trying to understand the routing of packet traffic when two or more computers share one ISP through a DSL router. Allow me to explain:

1. Hypothetical situation: two computers on a DSL router, both sharing one Internet connection. The router has IP address 128.128.128.128 (I don't know if this is a legal IP, and it doesn't matter. Please bear with me.). The first computer has IP address 10.0.0.1, and the second computer has IP address 10.0.0.2.

2. When 10.0.0.1 sends packets to a server (let's say 255.255.255.255), they are recoded by the router as coming from source IP 128.128.128.128. The server receiving the packets then responds to 128.128.128.128 with its own packets.

3. The router receives packets emerging from source 255.255.255.255, targeted for 128.128.128.128. How does the router software determine where to send the packets? It can send them to 10.0.0.1, or 10.0.0.2. What gives?

If anyone can point out what I'm missing here, it will be sincerely appreciated.

<A HREF="http://bible.gospelcom.net/cgi-bin/bible?passage=PS+17:..." target="_new"> PS 17 </A>
October 8, 2001 1:41:23 AM

From my understanding, there is something like a turnaround key field somewhere in the IP header. This allows the ROuter to insert the source IP when it sends the packet out to the server, and the server will re-insert whatever was in that field back into that field when it sends packets back out to the source. Then the DSl router simply examines that turnaround field to see who it originally came from.

<i>It's always the one thing you never suspected.</i>
October 8, 2001 5:34:29 AM

Okay, from the top...

What you are trying to describe is overload NAT (Network Address Translation).

It allows many hosts to share a single address to talk to downstream devices. In your case the public IP address of the router serves to 'hide' the two private addresses of the actual PCs.

The mechanism used is via TCP and UDP socket numbers. As you may or may not know, above IP there are additional protocols that cover more detail of the network packet. If you are surfing the web, for instance, the majority of hosts you connect to you do so by sending requests to UDP port 80 (HTTP). When your PC does this, the end server has to know how to talk back to your PC. Therefore your PC assigns an arbitary socket for the server to talk back on. The socket will be above 1023.

So, you pc defines this socket in its outbound communication, and then the server returns your information - aimed <b>at</b> the socket number your PC gave it.

Now in an overload NAT device, the router will substitue two components, the source IP address (your inside, private IP) <b>AND</b> the source socket number. It substitutes the IP address to its own - and assigns its own arbitary source socket port. Now the external server thinks the router has made the request, not your PC!

The router maintains a table of thost socket numbers as a conversation table. It knows that if it receives an IP packet itself, but on the socket port that it substituted, it must forward that packet onto the original host, again translating the now destination IP address to that of the original PC.

In this way we can see that under a basic configuration it would never be possible for a PC behind the NAT router to be contacted, unless it had first established communication. Packets would be aimed at the router on ports that had no meaning to it and would be dropped. Good security, but bad if you want to make a server!

-* This Space For Rent *-
email for application details
Related resources
October 8, 2001 3:31:44 PM

thanks pete - I see I was wrong. So it uses discreet socket ID number as a reverse lookup for returning packets. That makes sense. Thanks for clearing that up.

Jeff

<i>It's always the one thing you never suspected.</i>
October 24, 2001 4:12:20 AM

How do you find out what your socket is? Because I want to run a FTP server on my computer that is behind my router... I can't get people to connect to be because I cant get past the router. pleast help. thanks.

AMD for Life!
Anonymous
October 24, 2001 12:01:03 PM

thats different.....NAT (OR PAT, port address translation, which is really what we're talkin about) keeps track of internal address and ports for outgoing packets so that it knows where to send the responce. If you are going to allow people to request information directly from one of your pcs which is behind the NAT router you must instruct the router (in the interface program) to forward port xyz (where xyz is the port number....heh heh). for ftp, the common port to forward is 21. so, in the router program you would tell the router to forward all port 21 requests to xxx.yyy.zzz.aaa


ignore everything i say
!