When a computer, Computer A, wants to communicate with Computer B, it (Computer A) will use MAC and IP addresses. It will send the packet of information to Switch, which, based upon the MAC destination address contained in the packet of information, will look on its lookup table if the computer that owns the mentioned MAC Destination Address is available on the LAN network, right?

If it is unable to locate the computer on the LAN (suppose here that the lookup table is full), will it send it to Router, or does Computer A decide to send directly to the MAC address of the Network Interface Card of Router (the link with the WAN or the Internet for my LAN)?

I am a little bit confused related to the way that switches communicate with routers. When and how is this done?

enter image description here

2 Answers 2


A host will first determine if the destination IP address is on the same network. If not, it will send the IP packet to its configured gateway.

A switch doesn't decide this, and, to a switch, a router is just another host. The MAC address to which a frame is delivered is determined by the host before the host encapsulates the packet in a frame.

  • you mean CA decides and knows that the IP destination address of CB is not on the network ?
    – user24308
    Apr 7, 2016 at 18:50
  • I still don't get it ?
    – user24308
    Apr 7, 2016 at 18:51
  • Frame is an information packet, right ? you mean by host : Computer A or Computer B ?
    – user24308
    Apr 7, 2016 at 18:52
  • 1
    Exactly, A host has a configured IP address and mask. It masks its IP address to get its network. It will mask a destination address to get the network of the destination. If the two networks are not identical, it knows that the destination is on a different network. If the destination is on a different network, it will send the packet to its configured gateway.
    – Ron Maupin
    Apr 7, 2016 at 18:53
  • A frame is a layer-2 datagram, and a packet is a layer-3 datagram. A packet has the layer-3 (IP) source and destination addresses. A frame has the layer-2 (MAC) source and destination addresses. A layer-4 datagram (TCP/UDP) has layer-4 source and destination addresses (ports).
    – Ron Maupin
    Apr 7, 2016 at 18:55

Firstly when computer A is initiating traffic to computer B . ComputerA runs ANDing process to know whether source and destination are in same networks or different networks

If same networks

Packet will be forwarded to layer2 which is connected directly to Computer A . In Switch layer2 lookup is verified mac address of destination is checked with mac -address table of switch and frame is forwarded accordinglly with the mac -address in switch . . If different networks

Packet will be forwarded to gateway of computerA . From gateway it's will forward to further destination based of routing table in layer3 device .

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.