Suppose I have a network of 40 to 50 computers in a LAN. Now suppose a system A open the website google. To open the website, the user of system A types the url in the browser. Now the request will first go the the switch, then the router of the whole network then to the google server via different other routers.

Now when the google gets the request, it will immediately sends the response with a web page. Now, when our network router gets the response, it will transfer it to the switch. Now the question comes here, how does the switch knows which system sends the request to google of 40-50 systems in the network.

How does the switch decide where to send the response ?


1 Answer 1


IP packets have source and destination addresses. Outbound the souce address will be the PC and the destination will be the web server; inbound will be just the opposite.

When the router wants to send the packet to the PC, it encapsulates it into a layer-2 frame. The layer-2 frame has source and destination MAC addresses. Assuming the PC's IP address is not in the router's ARP cache, it will send an ARP request to find the PCs MAC address, then encapsulate the IP packet in the layer-2 frame.

The switch remembers which ports have which MAC addresses, but, if it has forgotten, it will flood the frame to all ports. The switch just switches the frames.

  • IP packets have source and destination addresses, is it public IP addresses or also the private IP addresses. ` The layer-2 frame has source and destination MAC addresses, how does router know which PC in the system originated the request to google, so to which system, the packet will get transferred.
    – Harshit
    Aug 28, 2015 at 3:23
  • The IP addresses are the source and destination IP addresses. The source address is from the device that sent the IP packet, and the destination IP address is the device to which it wants to send the packet. It's not complicated, so don't try to read too much into it. The router knows the PC's IP address from the destination IP address of the inbound packet; it doesn't have to know anything about which PC sent the packet to Google, it just knows the packet goes to a certain IP address.
    – Ron Maupin
    Aug 28, 2015 at 3:30
  • I think you are getting confused about the whole process. Routers switch layer-3 packets, and switches switch layer-2 frames - one at a time, without caring about the whole conversation. Typically, they only need to know the destination address (IP for layer-3, and MAC for layer-2). The end points care about the source address if they want to reply to the source.
    – Ron Maupin
    Aug 28, 2015 at 3:37
  • Yeah, I am little confused about the correct structure of whole routing process, although I got some idea about if after your answer. I think I need to go in-depth to understand this whole process.
    – Harshit
    Aug 28, 2015 at 3:40

Your Answer

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

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