Routing and Switching – Communication Between a Switch and Router

routerroutingswitchswitching

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

Best Answer

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.