Monday 28 May 2018

How does Http server distinguish between computers behind a router


HTTP servers usually operate at port 80. Yet NAT routers as most are these days assign port to outgoing requests so they would know when request is returned that which computer connected to it, it's suppose to be. They do it cause they can only use one public IP even though all computers behind router are given public IP address they are local IP address. Meaning they only work for everyone behind that router.


So how does server handles this. It only works at port 80, and router sends at whatever ports it wishes to do based on what is available and how it is programmed.


My understanding:




  1. Computer A to router. 22.22.22.22.22:80




  2. Router to World: 12.68.191.1.102:1 -ISP given IP address:Port to distinguish between computers connected to it.




Now what


Or maybe there is a difference between port and source port.



Answer



You're confusing source ports and destination ports. When the request is sent to the HTTP server, the destination port is 80 since that's what web servers typically listen on. NAT routers can choose whatever source port they want. When they receive replies, they use the destination port (and other information), which should match the source port they choose for the outbound packets, to know which connection the packets are associated with.


Your computer has to do the same thing. Say you fire up two different browsers and you point each at superuser.com. How do you think your computer tells which TCP connection incoming packets belong to?


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...