2

You have a router and many devices can connect to it to access the internet. From what I've read, the router assigns private interal ip addresses to the devices that are connect so it knows how to direct the traffic. The router however, is assigned one ip address by the ISP. What the world sees from any request coming from that router, whether from a desktop or a tablet, is that one ip address of the router. So how can a server tell how many users on the other end of that ip address? I know devices have their unique mac addresses, but I read that that information isn't sent to servers.

A more concrete scenario would be for video hosting websites like youtube. How would it know how many users are using the same ip? (for view counts) Also, in places where you expect many users using the same "wifi" such as Starbucks, Burger King, or some university, how are devices connected differentiated on the web?

3
  • 1
    Applications use the transport protocol address (port) for end-to-end connections. Questions about home networking are off-topic here, but you should ask on Super User.
    – Ron Maupin
    Jan 2, 2016 at 20:45
  • The question is not specifically about home networking, but rather how devices are differentiated on the web when they share the same ip address. Sorry about the confusion. Jan 2, 2016 at 20:48
  • As I wrote, applications use the transport layer address for end-to-end communications.
    – Ron Maupin
    Jan 2, 2016 at 20:50

2 Answers 2

1

You should search for the OSI model:

enter image description here

A full explanation of the OSI model is too broad to give here, but applications like browsers and web servers use the transport layer to communicate with each other, not the network layer where IP addresses are.

What you are missing is that HTTP uses TCP as the transport protocol. By default HTTP servers listen on TCP port 80. A host using a browser will use a random, ephemeral, TCP port as its source port. NAT will do something similar for each host for which it translates the IP address, and it keeps track of which port is assigned to which host in a traffic flow. It ends up being a combination of layer-3 address (e.g. IP address), transport protocol (e.g. TCP), and layer-4 address (e.g. TCP port) for what gets used as a unique identifier.

2
  • Thank you very much for this info and sorry I didn't fully understand your previous comment! Time to go read about the OSI model :) Jan 2, 2016 at 21:15
  • You should be aware of the OSI model because the industry uses it's layer numbers but you should also be aware that it doesn't really match up with TCP/IP very well. Jul 23, 2016 at 3:01
0

Multiple requests happening at the same time are distinguished by TCP port numbers. This allows the server to keep track of seperate requests. The NAT will ensure that the TCP port numbers seen by the server for simultansious TCP connections are distinct even if the ports used locally by the client machines were the same.

However TCP connections do not help much in determining whether two requests came from the same machine. Obviously if two requests use the same TCP connection they came from the same machine but it is normal for requests from the same machine to use many different TCP connections.

User sessions on the web are usually tracked using http cookies. Note though that these are per-browser not per machine. There is no robust way for a website to tell the difference between two different browsers running on the same client machine and two different client machines behind the same NAT.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.