Question:
How does a client receive a message from a server when there are multiple clients connected to the same router?
Akash
2014-08-13 10:05:44 UTC
Lets say I have 2 devices with local IP's 192.168.0.101 and 192.168.0.102.
I use the first device to send a request to a server ( Lets say google.com)
Now the response from google will reach the router and then what happens?
Does the router use ARP to find which device sent the request and send the response only to that device or does the router broadcast the response to every device connected to the router and only the required client accepts the message.
Four answers:
Nathaniel
2014-08-13 10:13:44 UTC
Within your router will be a 'switch', a switch directs traffic across the LAN, enabling the computers to talk to each other and share resources.

All computers included in the LAN must contain a network interface card (NIC). The card assigns a unique address to the machine in which it is installed. This address is called a Medium Access Control (MAC). Whether wireless or wired, the switch acts as a relay, reading traffic packets as they arrive from the various machines and directing the packets to the proper MAC address.



Before the days of the switch, a device known as a 'hub' was used. In a hub's case the messages were broadcasted to all devices and the correct device would accept the packets. Switches are more intelligent.
anonymous
2014-08-13 10:23:20 UTC
No its called encapsulation...



Each layer attaches its own Data to the Packet... and takes the data is needs...



So a computer with the IP address of 192.168.0.101 will send a packet out of its ports... with that IP address... the router takes that data and compresses it and adds its own information... ie... the WAN IP address... and sends it off to the server...



When the server responds it responds with the WAN IP and the router strips/removes that information and adds the IP address back to the requesting... to the Switch...



Same thing with the Switch... a switch does not deal with IP address but only Mac address... so it strips/removes the IP address and sends it to the correct MAC address...



Its called Encapsulation: The term encapsulation is often used interchangeably with information hiding. Not all agree on the distinctions between the two though; one may think of information hiding as being the principle and encapsulation being the technique. A software module hides information by encapsulating the information into a module or other construct which presents an interface
Comp-Elect
2014-08-13 10:18:27 UTC
Simple explanation:



Each client has an individual E-Mail Account on the E-Mail Server.



Each E-Mail Account has an ID.



The routers, switches, etc handle the packets from the E-mail server. The information as to where each packet goes is contained in the header.



Once a client logs into the network and access their E-Mail the E-mail server routes the E-mail with that ID to the person.



If more than one person logs in each one is handled in sequence.
BigE
2014-08-14 12:59:17 UTC
You guys are missing it. We are talking SNAT or source NATTing by the firewall.

The firewall takes the outbound connection and maps it. It uses a different source port to the outside entity.

So your input packet is from 192.168.0.101 port XXX to google.com port 80. The firewall takes the source pair (192.168.0.101/XXX) and maps it so that data FROM google.com port 80 should go back to that ip/port. Outbound, it sends it to google.com/80, but the source is the external/WAN side IP with a different random port. When google sends back to external/port, it sends that the packet to 192.168.0.101 port XXX (with a bunch of rewrites).



The ROUTER has to keep a track of these connections, dynamically.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...